Skip to content

Commit e119076

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 0a05920 commit e119076

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

src/backend/access/heap/heapam.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6278,10 +6278,9 @@ heap_inplace_lock(Relation relation,
62786278
LockTupleMode lockmode = LockTupleNoKeyExclusive;
62796279
MultiXactStatus mxact_status = MultiXactStatusNoKeyUpdate;
62806280
int remain;
6281-
bool current_is_member;
62826281

62836282
if (DoesMultiXactIdConflict((MultiXactId) xwait, infomask,
6284-
lockmode, &current_is_member))
6283+
lockmode, NULL))
62856284
{
62866285
LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
62876286
ret = false;

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

Lines changed: 24 additions & 0 deletions
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

Lines changed: 8 additions & 0 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy