Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e947224

Browse files
committed
Stop reading uninitialized memory in heap_inplace_lock().
Stop computing a never-used value. This removes the read; the read had no functional implications. Back-patch to v12, like commit a07e03f. Reported by Alexander Lakhin. Discussion: https://postgr.es/m/6c92f59b-f5bc-e58c-9bdd-d1f21c17c786@gmail.com
1 parent 86c30ce commit e947224

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

src/backend/access/heap/heapam.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -6260,10 +6260,9 @@ heap_inplace_lock(Relation relation,
62606260
LockTupleMode lockmode = LockTupleNoKeyExclusive;
62616261
MultiXactStatus mxact_status = MultiXactStatusNoKeyUpdate;
62626262
int remain;
6263-
bool current_is_member;
62646263

62656264
if (DoesMultiXactIdConflict((MultiXactId) xwait, infomask,
6266-
lockmode, &current_is_member))
6265+
lockmode, NULL))
62676266
{
62686267
LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
62696268
ret = false;

src/test/isolation/expected/intra-grant-inplace.out

+24
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,30 @@ step addk2: ALTER TABLE intra_grant_inplace ADD PRIMARY KEY (c); <waiting ...>
6363
step r3: ROLLBACK;
6464
step addk2: <... completed>
6565

66+
starting permutation: b3 sfnku3 keyshr5 addk2 r3
67+
step b3: BEGIN ISOLATION LEVEL READ COMMITTED;
68+
step sfnku3:
69+
SELECT relhasindex FROM pg_class
70+
WHERE oid = 'intra_grant_inplace'::regclass FOR NO KEY UPDATE;
71+
72+
relhasindex
73+
-----------
74+
f
75+
(1 row)
76+
77+
step keyshr5:
78+
SELECT relhasindex FROM pg_class
79+
WHERE oid = 'intra_grant_inplace'::regclass FOR KEY SHARE;
80+
81+
relhasindex
82+
-----------
83+
f
84+
(1 row)
85+
86+
step addk2: ALTER TABLE intra_grant_inplace ADD PRIMARY KEY (c); <waiting ...>
87+
step r3: ROLLBACK;
88+
step addk2: <... completed>
89+
6690
starting permutation: b2 sfnku2 addk2 c2
6791
step b2: BEGIN;
6892
step sfnku2:

src/test/isolation/specs/intra-grant-inplace.spec

+8
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@ permutation
9696
addk2(r3)
9797
r3
9898

99+
# reproduce bug in DoesMultiXactIdConflict() call
100+
permutation
101+
b3
102+
sfnku3
103+
keyshr5
104+
addk2(r3)
105+
r3
106+
99107
# same-xact rowmark
100108
permutation
101109
b2

0 commit comments

Comments
 (0)