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/jksql.h src/hg/inc/jksql.h index 477a9f2..6802394 100644 --- src/hg/inc/jksql.h +++ src/hg/inc/jksql.h @@ -92,30 +92,33 @@ char* sqlGetDatabase(struct sqlConnection *sc); /* Get the database associated with an connection. Warning: return may be NULL! */ char* sqlGetHost(struct sqlConnection *sc); /* Get the host associated with an connection. */ struct slName *sqlGetAllDatabase(struct sqlConnection *sc); /* Get a list of all database on the server */ struct slName *sqlListTables(struct sqlConnection *conn); /* Return list of tables in database associated with conn. */ struct slName *sqlListFields(struct sqlConnection *conn, char *table); /* Return list of fields in table. */ +struct sqlResult *sqlDescribe(struct sqlConnection *conn, char *table); +/* Run the sql DESCRIBE command or get a cached table description and return the sql result */ + void sqlAddDatabaseFields(char *database, struct hash *hash); /* Add fields from the one database to hash. */ struct hash *sqlAllFields(void); /* Get hash of all fields in database.table.field format. */ struct sqlConnCache *sqlConnCacheNew(); /* Return a new connection cache. (Useful if going to be * doing lots of different queries in different routines * to same database - reduces connection overhead.) */ struct sqlConnCache *sqlConnCacheNewRemote(char *host, char *user, char *password); /* Set up a cache on a remote database. */