liquid_feedback_core
changeset 300:bcbe72e97d27
Switched order of row-level and table-level member locking
author | jbe |
---|---|
date | Tue Sep 25 13:53:02 2012 +0200 (2012-09-25) |
parents | fcdaa4e986b9 |
children | 7cad34b945ac |
files | core.sql |
line diff
1.1 --- a/core.sql Tue Sep 25 13:36:00 2012 +0200 1.2 +++ b/core.sql Tue Sep 25 13:53:02 2012 +0200 1.3 @@ -2935,10 +2935,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;