225c0d55992aefae478461bba278644bdfdda3c5
max
  Wed Jan 15 08:33:57 2014 -0800
library changes for the browser box: This changes mostly hdb and jksql,plus - to a smaller extent - various other places in the code that deal
with /gbdb/ files.  The overall aim is to make it possible to have the
data remote at UCSC while having the CGIs on a machine far away. At up to
180msecs distance from UCSC (Europe,Japan), each query can get slow. So
I tried to reduce the number of queries sent to UCSC while allowing to
keep some mysql tables on localhost.

I changed four things:
- extend larry's table cache to include field names. The code uses
"describe" very often, which is slow from remote. With a table name
cache these queries can be handled locally. This is configured in
hg.conf
- mysql "failover" connections: a mysql connection can have a 2nd
connection that is used if a query fails, configured in hg.conf
(I didn't call it "remote" connections, because we use that term already
in the code)
- mysql lazy connects: don't connect a sqlConnection right away, but
only when needed. a mysql connect takes >500msecs from across the
atlantic.
- move gbdb: patch various places that use absolute "/gbdb/" pathnames
to go through a central function that can change the filename of
gbdb files to something else, as configured in hg.conf

Plus patch 1 or 2 lines for more speed + update the hgMirror script

diff --git src/hg/lib/search.c src/hg/lib/search.c
index 2b89f5b..61b0e5a 100644
--- src/hg/lib/search.c
+++ src/hg/lib/search.c
@@ -4,38 +4,46 @@
 #include "cheapcgi.h"
 #include "hdb.h"
 #include "hgConfig.h"
 #include "hPrint.h"
 #include "trix.h"
 #include "mdb.h"
 #include "subText.h"
 #include "jsHelper.h"
 
 void getSearchTrixFile(char *database, char *buf, int len)
 // Fill-in the name of the track search trix file
 {
 char *trixPath = cfgOptionDefault("browser.trixPath", "/gbdb/$db/trackDb.ix");
 struct subText *subList = subTextNew("$db", database);
 subTextStatic(subList, trixPath, buf, len);
+// rewrite the /gbdb-prefix
+char *subBuf = hCloneRewriteFileName(buf);
+memcpy(buf, subBuf, min(len, strlen(subBuf))+1);
+freez(&subBuf);
 }
 
 boolean isSearchTracksSupported(char *database, struct cart *cart)
 // Return TRUE if searchTracks is supported for this database and javascript is supported too
 {
 char trixFile[HDB_MAX_PATH_STRING];
 getSearchTrixFile(database, trixFile, sizeof(trixFile));
+// always return true if trix file is remote
+if (udcIsLocal(trixFile))
     return fileExists(trixFile);
+else
+    return TRUE;
 }
 
 struct slPair *fileFormatSearchWhiteList()
 // Gets the whitelist of approved file formats that is allowed for search
 {
 char *crudeTypes[] =
     {
     "bam",  //    "bam.bai" is now alway selected with bam,
     "tagAlign",
     "bed.gz",
     "bigBed",
     "broadPeak",
     "narrowPeak",
     "fastq",
     "bigWig",