liquid_feedback_core
changeset 298:fcdaa4e986b9
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
author | jbe |
---|---|
date | Tue Sep 25 13:36:00 2012 +0200 (2012-09-25) |
parents | bcfde30040f6 |
children | dbd237d86a8a bcbe72e97d27 |
files | core.sql |
line diff
1.1 --- a/core.sql Mon Sep 24 22:47:26 2012 +0200 1.2 +++ b/core.sql Tue Sep 25 13:36:00 2012 +0200 1.3 @@ -2935,7 +2935,10 @@ 1.4 -- is changed, which could affect calculation of snapshots or 1.5 -- counting of votes. Table "delegation" must be table-level-locked, 1.6 -- as it also contains issue- and global-scope delegations. 1.7 - LOCK TABLE "member" IN EXCLUSIVE MODE; -- exclusive avoids deadlocks 1.8 + LOCK TABLE "member" IN SHARE MODE; 1.9 + -- NOTE: As we later cause implicit row-level share locks on many 1.10 + -- active members, we lock them right here to avoid deadlocks 1.11 + PERFORM NULL FROM "member" WHERE "active" FOR SHARE; 1.12 LOCK TABLE "privilege" IN SHARE MODE; 1.13 LOCK TABLE "membership" IN SHARE MODE; 1.14 LOCK TABLE "policy" IN SHARE MODE;