# HG changeset patch # User jbe # Date 1348573982 -7200 # Node ID bcbe72e97d27e167f4c951f8626858d68a344025 # Parent fcdaa4e986b9a352559ee82002aa503e8ed4ca7b Switched order of row-level and table-level member locking diff -r fcdaa4e986b9 -r bcbe72e97d27 core.sql --- a/core.sql Tue Sep 25 13:36:00 2012 +0200 +++ b/core.sql Tue Sep 25 13:53:02 2012 +0200 @@ -2935,10 +2935,11 @@ -- is changed, which could affect calculation of snapshots or -- counting of votes. Table "delegation" must be table-level-locked, -- as it also contains issue- and global-scope delegations. - LOCK TABLE "member" IN SHARE MODE; + PERFORM NULL FROM "member" WHERE "active" FOR SHARE; -- NOTE: As we later cause implicit row-level share locks on many - -- active members, we lock them right here to avoid deadlocks - PERFORM NULL FROM "member" WHERE "active" FOR SHARE; + -- active members, we lock them before locking any other table + -- to avoid deadlocks + LOCK TABLE "member" IN SHARE MODE; LOCK TABLE "privilege" IN SHARE MODE; LOCK TABLE "membership" IN SHARE MODE; LOCK TABLE "policy" IN SHARE MODE;