postgresql/src/include/replication
Michael Paquier 409f9ca447 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:55:42 +09:00
..
backup_manifest.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
basebackup.h Code review for server's handling of "tablespace map" files. 2021-03-17 16:18:46 -04:00
decode.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
logical.h Add support for prepared transactions to built-in logical replication. 2021-07-14 07:33:50 +05:30
logicallauncher.h Allow multiple xacts during table sync in logical replication. 2021-02-12 07:41:51 +05:30
logicalproto.h Add logical change details to logical replication worker errcontext. 2021-08-27 08:30:23 +05:30
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 2021 2021-01-02 13:06:25 -05:00
message.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
origin.h Add some const decorations 2021-06-10 16:21:48 +02:00
output_plugin.h Add a xid argument to the filter_prepare callback for output plugins. 2021-03-30 10:34:43 +05:30
pgoutput.h Add support for prepared transactions to built-in logical replication. 2021-07-14 07:33:50 +05:30
reorderbuffer.h Add support for prepared transactions to built-in logical replication. 2021-07-14 07:33:50 +05:30
slot.h Remove code duplication for permission checks with replication slots 2021-09-14 10:15:49 +09:00
snapbuild.h Reset properly snapshot export state during transaction abort 2021-10-18 11:55:42 +09:00
syncrep.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
walreceiver.h Add support for prepared transactions to built-in logical replication. 2021-07-14 07:33:50 +05:30
walsender.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
walsender_private.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
worker_internal.h Optimize fileset usage in apply worker. 2021-09-02 08:13:46 +05:30