d186e66432880373f1ed5497ae34dca8cd2f4c1a
braney
  Thu Apr 22 12:45:31 2021 -0700
Don't open bigBeds when we're listing tracks, this means no itemCount

diff --git src/hg/hubApi/list.c src/hg/hubApi/list.c
index 2b7142c..58b5e73 100644
--- src/hg/hubApi/list.c
+++ src/hg/hubApi/list.c
@@ -304,31 +304,31 @@
 
 static void outputTrackDbVars(struct jsonWrite *jw, struct trackDb *tdb,
     long long itemCount)
 /* JSON output the fundamental trackDb variables */
 {
 if (NULL == tdb)	/* might not be any trackDb */
     return;
 
 boolean isContainer = tdbIsComposite(tdb) || tdbIsCompositeView(tdb);
 
 boolean protectedData = FALSE;
 protectedData = protectedTrack(tdb, tdb->track);
 jsonWriteString(jw, "shortLabel", tdb->shortLabel);
 jsonWriteString(jw, "type", tdb->type);
 jsonWriteString(jw, "longLabel", tdb->longLabel);
-if (! isContainer)	/* containers do not have items to count */
+if (! isContainer && (itemCount > 0))	/* containers do not have items to count and if itemCount == -1 we didn't count */
     jsonWriteNumber(jw, "itemCount", itemCount);
 if (tdb->parent)
     {
     jsonWriteString(jw, "parent", tdb->parent->track);
     if (tdb->parent->parent)
         jsonWriteString(jw, "parentParent", tdb->parent->parent->track);
     }
 if (tdb->settingsHash)
     {
     struct hashEl *hel;
     struct hashCookie hc = hashFirst(tdb->settingsHash);
     while ((hel = hashNext(&hc)) != NULL)
         {
         if (sameWord("track", hel->name))
             continue;	// already output in header
@@ -669,30 +669,31 @@
 	jsonWriteString(jw, "track", table);
     jsonWriteNumber(jw, "dataTimeStamp", (long long)dataTimeStamp);
     freeMem(dataTime);
     jsonWriteNumber(jw, "chromCount", (long long)slCount(ciList));
     jsonWriteObjectStart(jw, "chromosomes");
     for ( ; el != NULL; el = el->next )
 	{
         jsonWriteNumber(jw, el->chrom, (long long)el->size);
 	}
     jsonWriteObjectEnd(jw);	/* chromosomes */
     apiFinishOutput(0, NULL, jw);
     }
 hFreeConn(&conn);
 }
 
+#ifdef NOTUSED
 static long long bbiTableItemCount(struct sqlConnection *conn, char *type, char *tableName)
 /* Given a tableName that has a fileName column pointing to big*, bam or vcfTabix files, return the
  * total itemCount from all rows (BAM and VCF tables may have one row per chrom). */
 {
 long long itemCount = 0;
 char query[2048];
 sqlSafef(query, sizeof query, "select fileName from %s", tableName);
 struct sqlResult *sr = sqlGetResult(conn, query);
 char **row;
 while ((row = sqlNextRow(sr)) != NULL)
     {
     itemCount += bbiItemCount(hReplaceGbdb(row[0]), type, NULL);
     }
 sqlFreeResult(&sr);
 return itemCount;
@@ -743,52 +744,55 @@
                     itemCount = 0;
                     }
                 else
                     {
                     char query[2048];
                     sqlSafef(query, sizeof(query), "select count(*) from %s", tableName);
                     itemCount = sqlQuickNum(conn, query);
                     }
                 }
             hFreeConn(&conn);
 	    }
 	}
     }
 return itemCount;
 }	/*	static long long dataItemCount(char *db, struct trackDb *tdb) */
+#endif
 
 static void recursiveTrackList(struct jsonWrite *jw, struct trackDb *tdb,
     char *db)
 /* output trackDb tags only for real tracks, not containers,
  * recursive when subtracks exist
  */
 {
 boolean isContainer = trackHasNoData(tdb);
 
 /* do *NOT* print containers when 'trackLeavesOnly' requested */
 if (! (trackLeavesOnly && isContainer) )
     {
+#ifdef NOTNOW
     long long itemCount = 0;
     /* do not show counts for protected data or continers (== no items)*/
     if (! (isContainer || protectedTrack(tdb, tdb->track)))
 	itemCount = dataItemCount(db, tdb);
+#endif
     jsonWriteObjectStart(jw, tdb->track);
     if (tdbIsComposite(tdb))
         jsonWriteString(jw, "compositeContainer", "TRUE");
     if (tdbIsCompositeView(tdb))
         jsonWriteString(jw, "compositeViewContainer", "TRUE");
-    outputTrackDbVars(jw, tdb, itemCount);
+    outputTrackDbVars(jw, tdb, -1);
 
     if (tdb->subtracks)
 	{
 	struct trackDb *el = NULL;
 	for (el = tdb->subtracks; el != NULL; el = el->next )
 	    recursiveTrackList(jw, el, db);
 	}
 
     jsonWriteObjectEnd(jw);
     }
 else if (tdb->subtracks)
     {
     struct trackDb *el = NULL;
     for (el = tdb->subtracks; el != NULL; el = el->next )
 	recursiveTrackList(jw, el, db);