liquid_feedback_core
changeset 299:dbd237d86a8a
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
author | jbe |
---|---|
date | Tue Sep 25 13:37:27 2012 +0200 (2012-09-25) |
parents | 779ba19a07df fcdaa4e986b9 |
children | 7cad34b945ac |
files | core.sql update/core-update.v2.0.11-v2.1.0.sql |
line diff
1.1 --- a/core.sql Tue Sep 25 02:32:51 2012 +0200 1.2 +++ b/core.sql Tue Sep 25 13:37:27 2012 +0200 1.3 @@ -2999,7 +2999,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;
2.1 --- a/update/core-update.v2.0.11-v2.1.0.sql Tue Sep 25 02:32:51 2012 +0200 2.2 +++ b/update/core-update.v2.0.11-v2.1.0.sql Tue Sep 25 13:37:27 2012 +0200 2.3 @@ -431,7 +431,10 @@ 2.4 -- is changed, which could affect calculation of snapshots or 2.5 -- counting of votes. Table "delegation" must be table-level-locked, 2.6 -- as it also contains issue- and global-scope delegations. 2.7 - LOCK TABLE "member" IN EXCLUSIVE MODE; -- exclusive avoids deadlocks 2.8 + LOCK TABLE "member" IN SHARE MODE; 2.9 + -- NOTE: As we later cause implicit row-level share locks on many 2.10 + -- active members, we lock them right here to avoid deadlocks 2.11 + PERFORM NULL FROM "member" WHERE "active" FOR SHARE; 2.12 LOCK TABLE "privilege" IN SHARE MODE; 2.13 LOCK TABLE "membership" IN SHARE MODE; 2.14 LOCK TABLE "policy" IN SHARE MODE;