postgresql/src/include/replication
Michael Paquier 506aa1f71a Reset properly snapshot export state during transaction abort
During a replication slot creation, an ERROR generated in the same
transaction as the one creating a to-be-exported snapshot would have
left the backend in an inconsistent state, as the associated static
export snapshot state was not being reset on transaction abort, but only
on the follow-up command received by the WAL sender that created this
snapshot on replication slot creation.  This would trigger inconsistency
failures if this session tried to export again a snapshot, like during
the creation of a replication slot.

Note that a snapshot export cannot happen in a transaction block, so
there is no need to worry resetting this state for subtransaction
aborts.  Also, this inconsistent state would very unlikely show up to
users.  For example, one case where this could happen is an
out-of-memory error when building the initial snapshot to-be-exported.
Dilip found this problem while poking at a different patch, that caused
an error in this code path for reasons unrelated to HEAD.

Author: Dilip Kumar
Reviewed-by: Michael Paquier, Zhihong Yu
Discussion: https://postgr.es/m/CAFiTN-s0zA1Kj0ozGHwkYkHwa5U0zUE94RSc_g81WrpcETB5=w@mail.gmail.com
Backpatch-through: 9.6
2021-10-18 11:56:57 +09:00
..
basebackup.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
decode.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
logical.h Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
logicalfuncs.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
logicallauncher.h Add subtransaction handling for table synchronization workers. 2018-07-16 17:33:35 -04:00
logicalproto.h Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
logicalrelation.h Don't try to print data type names in slot_store_error_callback(). 2021-07-02 16:04:54 -04:00
logicalworker.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
message.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
origin.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
output_plugin.h Logical decoding of TRUNCATE 2018-04-07 11:34:10 -04:00
pgoutput.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
reorderbuffer.h Fix ABI break introduced by commit 4daa140a2f. 2021-06-24 15:26:37 +05:30
slot.h Don't call palloc() while holding a spinlock, either. 2020-06-03 12:36:00 -04:00
snapbuild.h Reset properly snapshot export state during transaction abort 2021-10-18 11:56:57 +09:00
syncrep.h Fix race conditions in synchronous standby management. 2020-04-18 14:02:44 -04:00
walreceiver.h In walreceiver, don't try to do ereport() in a signal handler. 2019-06-12 17:29:48 -04:00
walsender.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
walsender_private.h Fix race conditions in synchronous standby management. 2020-04-18 14:02:44 -04:00
worker_internal.h Rename the logical replication global "wrconn" 2021-05-12 19:13:54 -04:00