diff --git a/src/backend/replication/logical/logical.c b/src/backend/replication/logical/logical.c index 625a7f4273..466f30c22d 100644 --- a/src/backend/replication/logical/logical.c +++ b/src/backend/replication/logical/logical.c @@ -555,8 +555,10 @@ CreateDecodingContext(XLogRecPtr start_lsn, /* Mark slot to allow two_phase decoding if not already marked */ if (ctx->twophase && !slot->data.two_phase) { + SpinLockAcquire(&slot->mutex); slot->data.two_phase = true; slot->data.two_phase_at = start_lsn; + SpinLockRelease(&slot->mutex); ReplicationSlotMarkDirty(); ReplicationSlotSave(); SnapBuildSetTwoPhaseAt(ctx->snapshot_builder, start_lsn);