8cc7dee111a52eed9f6e65a01e67730af13b43b4 braney Thu Jun 6 15:30:22 2019 -0700 ongoing work on trackDb caching in shared memory diff --git src/hg/lib/hdb.c src/hg/lib/hdb.c index 806341b..914bcdc 100644 --- src/hg/lib/hdb.c +++ src/hg/lib/hdb.c @@ -4100,57 +4100,44 @@ * but are accessible via the parent pointers of the member tracks. Also, * the supertrack trackDb subtrack fields are not set here (would be * incompatible with the returned list) * Returns list sorted by priority * NOTE: this result is cached, do not free it ! */ { struct trackDb *tdbList = NULL; boolean doCache = FALSE; if (sameOk(cfgOption("cacheTrackDb"), "on")) doCache = TRUE; if (doCache) { - // look for this db in the cache, if it's found it will have a file name, an address, and a size - boolean foundDb = FALSE; + struct trackDb *cacheTdb = trackDbCache(db); + + if (cacheTdb != NULL) + return cacheTdb; - if (foundDb) - { - unsigned long size = 24402580; - char *file = "brtest/flart"; - unsigned long address = 0x7000000; - struct trackDb *clone = mapSharedMemTrackDb(file, address, size); - if (clone != NULL) - return clone; - } memCheckPoint(); // we want to know how much memory is used to build the tdbList } tdbList = loadTrackDb(db, NULL); tdbList = trackDbLinkUpGenerations(tdbList); tdbList = trackDbPolishAfterLinkup(tdbList, db); if (doCache) - { - struct trackDb *clone = cloneTdbListToSharedMem(tdbList, memCheckPoint()); - - // record clone in registy - if (clone == NULL) - warn("unable to clone trackDb"); - } + trackDbCloneTdbListToSharedMem(db, tdbList, memCheckPoint()); return tdbList; } static struct trackDb *loadAndLookupTrackDb(struct sqlConnection *conn, char *where) /* Load trackDb object(s). Nothing done for composite tracks here. */ { return loadTrackDb(sqlGetDatabase(conn), where); } static struct trackDb *loadTrackDbForTrack(struct sqlConnection *conn, char *track) /* Load trackDb object for a track. this is common code for two external * functions. Handle composite tracks and subtrack inheritance here.