2dffcd60f62e3fb25bbe8b009b4235bb3b9eb44f galt Sun Mar 9 14:54:38 2014 -0700 Adding better handling of auto-upgrade for the situation where simultaneous CGIs would try to all upgrade at once. It uses an advisory lock to make sure only one process is trying to upgrade at a time, and it checks again that the field does not exist already before adding the new sessionkey field, it writes the result of success or failure with the error message to a TRASH file so that other CGIs may access it. To prevent them all from repeatedly trying to do the same upgrade with every CGI execution, it checks the time-stamp on the AUTOUPGRADE trash file, and if it is older than 3 minutes, then it will try again to see if the admins have given it the permissions needed - which will then re-write the trash file with the results and its time will be updated. If an error occurs during sql upgrade, it traps the error instead of errAborting and the message is saved to be included in the trash file, and the system proceeds for now without the new sessionKey field. diff --git src/hg/hgGateway/hgGateway.c src/hg/hgGateway/hgGateway.c index 0a2bcc9..33e029d 100644 --- src/hg/hgGateway/hgGateway.c +++ src/hg/hgGateway/hgGateway.c @@ -16,30 +16,33 @@ #include "hubConnect.h" #include "hgConfig.h" #include "jsHelper.h" #include "hPrint.h" #include "suggest.h" #include "search.h" #include "geoMirror.h" #include "trackHub.h" struct cart *cart = NULL; struct hash *oldVars = NULL; char *clade = NULL; char *organism = NULL; char *db = NULL; +// TODO REMOVE AFTER AUTOUPGRADE COMPLETE: (added 2014-03-09) +extern struct dyString *dyUpgradeError; + void hgGateway() /* hgGateway - Human Genome Browser Gateway. */ { char *defaultPosition = hDefaultPos(db); char *position = cloneString(cartUsualString(cart, "position", defaultPosition)); boolean gotClade = hGotClade(); char *survey = cfgOptionEnv("HGDB_SURVEY", "survey"); char *surveyLabel = cfgOptionEnv("HGDB_SURVEY_LABEL", "surveyLabel"); boolean supportsSuggest = FALSE; if (!trackHubDatabase(db)) supportsSuggest = assemblySupportsGeneSuggest(db); /* JavaScript to copy input data on the change genome button to a hidden form This was done in order to be able to flexibly arrange the UI HTML */ @@ -263,30 +266,35 @@ /* tell html routines *not* to escape htmlOut strings*/ htmlNoEscape(); buffer[0] = 0; if ((scientificName != NULL) && (*scientificName != 0)) { if (sameString(clade,"ancestor")) safef(buffer, sizeof(buffer), "(<I>%s</I> Ancestor) ", scientificName); else safef(buffer, sizeof(buffer), "(<I>%s</I>) ", scientificName); } cartWebStart(theCart, db, "%s %s%s Gateway\n", trackHubSkipHubName(organism), buffer, hBrowserName()); htmlDoEscape(); } hgGateway(); + +// TODO REMOVE AFTER AUTOUPGRADE COMPLETE: (added 2014-03-09) +if (dyUpgradeError) + warn(dyUpgradeError->string); + cartWebEnd(); } static void checkForGeoMirrorRedirect() { // Implement Geo/IP based redirection // // NOTE that we want to redirect people as quickly as possible, so for efficiency purposes, this code is designed to be // called from main BEFORE the cart is loaded (so we only use CGI parameters and/or cookies). char *thisNodeStr = geoMirrorNode(); if (thisNodeStr) { char *redirectCookie = findCookieData("redirect"); char *redirect = cgiOptionalString("redirect");