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

Commit5ad165d

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 bythe caller, but the code forgot to acquire a spinlock when updatingthese fields like any other code paths. This could lead to the read ofinconsistent data.Oversight ina8fd13c.Author: Sawada MasahikoDiscussion:https://postgr.es/m/CAD21AoAD8_fp47191LKuecjDd3DYhoQ4TaucFco1_TEr_jQ-Zw@mail.gmail.comBackpatch-through: 15
1 parentf0e6d6d commit5ad165d

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)

[8]ページ先頭

©2009-2025 Movatter.jp