Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5174206

Browse files
committed
Fix thinko in lock mode enum
Commit0e5680f contained a thinkomixing LOCKMODE with LockTupleMode. This caused misbehavior in the casewhere a tuple is marked with a multixact with at most a FOR SHARE lock,and another transaction tries to acquire a FOR NO KEY EXCLUSIVE lock;this case should block but doesn't.Include a new isolation tester spec file to explicitely try all thetuple lock combinations; without the fix it shows the problem: starting permutation: s1_begin s1_lcksvpt s1_tuplock2 s2_tuplock3 s1_commit step s1_begin: BEGIN; step s1_lcksvpt: SELECT * FROM multixact_conflict FOR KEY SHARE; SAVEPOINT foo; a 1 step s1_tuplock2: SELECT * FROM multixact_conflict FOR SHARE; a 1 step s2_tuplock3: SELECT * FROM multixact_conflict FOR NO KEY UPDATE; a 1 step s1_commit: COMMIT;With the fixed code, step s2_tuplock3 blocks until session 1 commits,which is the correct behavior.All other cases behave correctly.Backpatch to 9.3, like the commit that introduced the problem.
1 parent7ced1b6 commit5174206

File tree

4 files changed

+537
-2
lines changed

4 files changed

+537
-2
lines changed

‎src/backend/access/heap/heapam.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6111,6 +6111,7 @@ DoesMultiXactIdConflict(MultiXactId multi, uint16 infomask,
61116111
intnmembers;
61126112
MultiXactMember*members;
61136113
boolresult= false;
6114+
LOCKMODEwanted=tupleLockExtraInfo[lockmode].hwlock;
61146115

61156116
allow_old= !(infomask&HEAP_LOCK_MASK)&&HEAP_XMAX_IS_LOCKED_ONLY(infomask);
61166117
nmembers=GetMultiXactIdMembers(multi,&members,allow_old);
@@ -6121,11 +6122,12 @@ DoesMultiXactIdConflict(MultiXactId multi, uint16 infomask,
61216122
for (i=0;i<nmembers;i++)
61226123
{
61236124
TransactionIdmemxid;
6124-
LockTupleModememlockmode;
6125+
LOCKMODEmemlockmode;
61256126

61266127
memlockmode=LOCKMODE_from_mxstatus(members[i].status);
6128+
61276129
/* ignore members that don't conflict with the lock we want */
6128-
if (!DoLockModesConflict(memlockmode,lockmode))
6130+
if (!DoLockModesConflict(memlockmode,wanted))
61296131
continue;
61306132

61316133
/* ignore members from current xact */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp