# HG changeset patch # User jbe # Date 1348572960 -7200 # Node ID fcdaa4e986b9a352559ee82002aa503e8ed4ca7b # Parent bcfde30040f699031749b508c270fc151e1ba63a 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 bcfde30040f6 -r fcdaa4e986b9 core.sql --- a/core.sql Mon Sep 24 22:47:26 2012 +0200 +++ b/core.sql Tue Sep 25 13:36:00 2012 +0200 @@ -2935,7 +2935,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;