# HG changeset patch # User jbe # Date 1348573047 -7200 # Node ID dbd237d86a8a5263e8d0536bc0a452fe7503adde # Parent 779ba19a07df8ef4f4b2fe0a91272f6e4eab46e4# Parent fcdaa4e986b9a352559ee82002aa503e8ed4ca7b merge: In function "lock_issue"("issue"."id"): Instead of accquiring a table-level EXCLUSIVE lock, use a table-level SHARE lock in combination with row-level SHARE locks diff -r 779ba19a07df -r dbd237d86a8a core.sql --- a/core.sql Tue Sep 25 02:32:51 2012 +0200 +++ b/core.sql Tue Sep 25 13:37:27 2012 +0200 @@ -2999,7 +2999,10 @@ -- 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 EXCLUSIVE MODE; -- exclusive avoids deadlocks + LOCK TABLE "member" IN SHARE MODE; + -- 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; LOCK TABLE "privilege" IN SHARE MODE; LOCK TABLE "membership" IN SHARE MODE; LOCK TABLE "policy" IN SHARE MODE; diff -r 779ba19a07df -r dbd237d86a8a update/core-update.v2.0.11-v2.1.0.sql --- a/update/core-update.v2.0.11-v2.1.0.sql Tue Sep 25 02:32:51 2012 +0200 +++ b/update/core-update.v2.0.11-v2.1.0.sql Tue Sep 25 13:37:27 2012 +0200 @@ -431,7 +431,10 @@ -- 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 EXCLUSIVE MODE; -- exclusive avoids deadlocks + LOCK TABLE "member" IN SHARE MODE; + -- 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; LOCK TABLE "privilege" IN SHARE MODE; LOCK TABLE "membership" IN SHARE MODE; LOCK TABLE "policy" IN SHARE MODE;