pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix consistency issues with replication slot copy
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix consistency issues with replication slot copy
@ 2020-03-17 19:22 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Alvaro Herrera @ 2020-03-17 19:22 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/bcd1c3630095e48bc3b1eb0fc8e8c8a7c851eba1

Modified Files
--------------
src/backend/replication/logical/logical.c |  2 ++
src/backend/replication/slotfuncs.c       | 46 ++++++++++++++++++++++++++-----
2 files changed, 41 insertions(+), 7 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Fix consistency issues with replication slot copy
@ 2020-03-17 19:22 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Alvaro Herrera @ 2020-03-17 19:22 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/e58e13e846953e0540b1a2c9a7739b666e134997

Modified Files
--------------
src/backend/replication/logical/logical.c |  2 ++
src/backend/replication/slotfuncs.c       | 46 ++++++++++++++++++++++++++-----
2 files changed, 41 insertions(+), 7 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2020-03-17 19:22 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-03-17 19:22 pgsql: Fix consistency issues with replication slot copy Alvaro Herrera <alvherre@alvh.no-ip.org>
2020-03-17 19:22 pgsql: Fix consistency issues with replication slot copy Alvaro Herrera <alvherre@alvh.no-ip.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox