Acquire spinlock when updating 2PC slot data during logical decoding creation
commit5ad165d2c024ae2fdc0a5ddd17522d5c92d7aa1a
authorMichael Paquier <michael@paquier.xyz>
Thu, 12 Jan 2023 04:40:33 +0000 (12 13:40 +0900)
committerMichael Paquier <michael@paquier.xyz>
Thu, 12 Jan 2023 04:40:33 +0000 (12 13:40 +0900)
treeec7f55227255fa82fdd9b51fc912ac9e7228609d
parentf0e6d6d3c909e14eedd370dd77d7111c2ae24c02
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
src/backend/replication/logical/logical.c