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/lib/cartDb.sql src/hg/lib/cartDb.sql index a94ef64..4f92b53 100644 --- src/hg/lib/cartDb.sql +++ src/hg/lib/cartDb.sql @@ -1,27 +1,29 @@ # cartDb.sql was originally generated by the autoSql program, which also # generated cartDb.c and cartDb.h. This creates the database representation of # an object which can be loaded and saved from RAM in a fairly # automatic way. #A simple id/contents pair for persistent storing of cart variables CREATE TABLE userDb ( id integer unsigned not null auto_increment, # Cart ID contents longblob not null, # Contents - encoded variables reserved tinyint not null, # True if a user (rather than session) cart firstUse DATETIME not null, # First time this was used lastUse DATETIME not null, # Last time this was used useCount int not null, # Number of times used + sessionKey varchar(255) NOT NULL DEFAULT '', # Random key to protect session ids #Indices PRIMARY KEY(id) ); CREATE TABLE sessionDb ( id integer unsigned not null auto_increment, # Cart ID contents longblob not null, # Contents - encoded variables reserved tinyint not null, # True if a user (rather than session) cart firstUse DATETIME not null, # First time this was used lastUse DATETIME not null, # Last time this was used useCount int not null, # Number of times used + sessionKey varchar(255) NOT NULL DEFAULT '', # Random key to protect session ids #Indices PRIMARY KEY(id) );