Content-Length: 262005 | pFad | http://github.com/postgrespro/postgres/commit/5ad165d2c024ae2fdc0a5ddd17522d5c92d7aa1a

6D Acquire spinlock when updating 2PC slot data during logical decoding … · postgrespro/postgres@5ad165d · GitHub
Skip to content

Commit 5ad165d

Browse files
committed
Acquire spinlock when updating 2PC slot data during logical decoding creation
The creation of a logical decoding context in CreateDecodingContext() updates some data of its slot for two-phase transactions if enabled by the caller, but the code forgot to acquire a spinlock when updating these fields like any other code paths. This could lead to the read of inconsistent data. Oversight in a8fd13c. Author: Sawada Masahiko Discussion: https://postgr.es/m/CAD21AoAD8_fp47191LKuecjDd3DYhoQ4TaucFco1_TEr_jQ-Zw@mail.gmail.com Backpatch-through: 15
1 parent f0e6d6d commit 5ad165d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/backend/replication/logical/logical.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,8 +555,10 @@ CreateDecodingContext(XLogRecPtr start_lsn,
555555
/* Mark slot to allow two_phase decoding if not already marked */
556556
if (ctx->twophase && !slot->data.two_phase)
557557
{
558+
SpinLockAcquire(&slot->mutex);
558559
slot->data.two_phase = true;
559560
slot->data.two_phase_at = start_lsn;
561+
SpinLockRelease(&slot->mutex);
560562
ReplicationSlotMarkDirty();
561563
ReplicationSlotSave();
562564
SnapBuildSetTwoPhaseAt(ctx->snapshot_builder, start_lsn);

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/5ad165d2c024ae2fdc0a5ddd17522d5c92d7aa1a

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy