liquid_feedback_core
changeset 301:7cad34b945ac
merge: Switched order of row-level and table-level member locking
author | jbe |
---|---|
date | Tue Sep 25 13:54:24 2012 +0200 (2012-09-25) |
parents | dbd237d86a8a bcbe72e97d27 |
children | 548cec6b7a79 |
files | core.sql update/core-update.v2.0.11-v2.1.0.sql |
line diff
1.1 --- a/core.sql Tue Sep 25 13:37:27 2012 +0200 1.2 +++ b/core.sql Tue Sep 25 13:54:24 2012 +0200 1.3 @@ -2999,10 +2999,11 @@ 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 SHARE MODE; 1.8 + PERFORM NULL FROM "member" WHERE "active" FOR SHARE; 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 + -- active members, we lock them before locking any other table 1.13 + -- to avoid deadlocks 1.14 + LOCK TABLE "member" IN SHARE MODE; 1.15 LOCK TABLE "privilege" IN SHARE MODE; 1.16 LOCK TABLE "membership" IN SHARE MODE; 1.17 LOCK TABLE "policy" IN SHARE MODE;
2.1 --- a/update/core-update.v2.0.11-v2.1.0.sql Tue Sep 25 13:37:27 2012 +0200 2.2 +++ b/update/core-update.v2.0.11-v2.1.0.sql Tue Sep 25 13:54:24 2012 +0200 2.3 @@ -431,10 +431,11 @@ 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 SHARE MODE; 2.8 + PERFORM NULL FROM "member" WHERE "active" FOR SHARE; 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 + -- active members, we lock them before locking any other table 2.13 + -- to avoid deadlocks 2.14 + LOCK TABLE "member" IN SHARE MODE; 2.15 LOCK TABLE "privilege" IN SHARE MODE; 2.16 LOCK TABLE "membership" IN SHARE MODE; 2.17 LOCK TABLE "policy" IN SHARE MODE;