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/inc/hdb.h src/hg/inc/hdb.h index 81cdfdd..f0f10c3 100644 --- src/hg/inc/hdb.h +++ src/hg/inc/hdb.h @@ -190,30 +190,34 @@ * on this database. */ boolean hgPcrOk(char *database); /* Return TRUE if ok to put up hgPcr on this database. */ boolean hTableExists(char *db, char *table); /* Return TRUE if a table exists in database. */ boolean hTableOrSplitExists(char *db, char *table); /* Return TRUE if table (or a chrN_table) exists in database. */ char *hTableForTrack(char *db, char *trackName); /* Return a table for a track in db. Returns one of the split * tables, or main table if not split */ +char *hCloneRewriteFileName(char* fileName); +/* clone and change a filename that can be located in /gbdb to somewhere else + * according to hg.conf's "gbdb.loc". Result has to be freed. */ + void hParseTableName(char *db, char *table, char trackName[HDB_MAX_TABLE_STRING], char chrom[HDB_MAX_CHROM_STRING]); /* Parse an actual table name like "chr17_random_blastzWhatever" into * the track name (blastzWhatever) and chrom (chr17_random). */ int hChromSize(char *db, char *chromName); /* Return size of chromosome. */ struct chromInfo *hGetChromInfo(char *db, char *chrom); /* Get chromInfo for named chromosome (case-insens.) from db. * Return NULL if no such chrom. */ struct dnaSeq *hFetchSeq(char *fileName, char *seqName, int start, int end); /* Fetch sequence from file. If it is a .2bit file then fetch the named sequence. If it is .nib then just ignore seqName. */