mirror of
https://github.com/postgres/postgres.git
synced 2025-08-30 06:01:21 +03:00
Fix consistency issues with replication slot copy
Commit 9f06d79ef831's replication slot copying failed to properly reserve the WAL that the slot is expecting to see during DecodingContextFindStartpoint (to set the confirmed_flush LSN), so concurrent activity could remove that WAL and cause the copy process to error out. But it doesn't actually *need* that WAL anyway: instead of running decode to find confirmed_flush, it can be copied from the source slot. Fix this by rearranging things to avoid DecodingContextFindStartpoint() (leaving the target slot's confirmed_flush_lsn to invalid), and set that up afterwards by copying from the target slot's value. Also ensure the source slot's confirmed_flush_lsn is valid. Reported-by: Arseny Sher Author: Masahiko Sawada, Arseny Sher Discussion: https://postgr.es/m/871rr3ohbo.fsf@ars-thinkpad
This commit is contained in:
@@ -208,6 +208,8 @@ StartupDecodingContext(List *output_plugin_options,
|
||||
*
|
||||
* plugin -- contains the name of the output plugin
|
||||
* output_plugin_options -- contains options passed to the output plugin
|
||||
* need_full_snapshot -- if true, must obtain a snapshot able to read all
|
||||
* tables; if false, one that can read only catalogs is acceptable.
|
||||
* restart_lsn -- if given as invalid, it's this routine's responsibility to
|
||||
* mark WAL as reserved by setting a convenient restart_lsn for the slot.
|
||||
* Otherwise, we set for decoding to start from the given LSN without
|
||||
|
Reference in New Issue
Block a user