1c3d6739756883f6ac712e75eac7915a715545ef
galt
  Sun Nov 4 15:03:42 2018 -0800
Checking in new version 38 of refreshNamedSessionCustomTracks. I added the function setMinIndexLengthForTrashCleaner() to src/hg/lib/hdb.c since the trash cleaner will fail otherwise whenever you have a saved session with a custom track that is on a hub that is currently unavailable. Rather than risk losing the table in custom trash database, it needs to avoid this error and continue touching and running.

diff --git src/hg/lib/hdb.c src/hg/lib/hdb.c
index f483d69..8155e8f 100644
--- src/hg/lib/hdb.c
+++ src/hg/lib/hdb.c
@@ -216,36 +216,50 @@
          return chrom;
        }
     return NULL;
     }
 }
 
 boolean hgIsOfficialChromName(char *db, char *name)
 /* Determine if name is exact (case-sensitive) match with
  * a chromosome in the given assembly */
 {
 char *chrom;
 return ((chrom = hgOfficialChromName(db, name)) != NULL &&
 	sameString(name, chrom));
 }
 
+static boolean minLen = 0;
+
+void setMinIndexLengthForTrashCleaner()
+/* set the minimum index size so trash cleaner will not die
+ * on custom tracks on hubs that are not currently loading.
+ * However, they might be re-established in the future,
+ * and we want to allow it to proceed without failure
+ * in order to touch the trash database table access times,
+ * preserving them from the trash cleaner.
+ * Only the trash cleaner should call this:
+ *  src/hg/utils/refreshNamedCustomTracks/refreshNamedCustomTracks.c 
+ */
+{
+minLen = 1;  // any value other than 0 is fine.
+}
 
 int hGetMinIndexLength(char *db)
 /* get the minimum index size for the given database that won't smoosh
  * together chromNames. */
 {
-static boolean minLen = 0;
 if (minLen <= 0)
     {
     struct slName *nameList = hAllChromNames(db);
     struct slName *name, *last;
     int len = 4;
     slSort(&nameList, slNameCmp);
     last = nameList;
     if (last != NULL)
         {
 	for (name = nameList->next; name != NULL; name = name->next)
 	    {
 	    while (strncmp(name->name, last->name, len) == 0)
 	        ++len;
 	    last = name;
 	    }