Why latestRemovedXid|cuteoff_xid are always sent? - Mailing list pgsql-hackers

From Michail Nikolaev
Subject Why latestRemovedXid|cuteoff_xid are always sent?
Date
Msg-id CANtu0oigC0+H0UkxktyovdLLU67ikM0+Dw3J4EQqiDDeGhcwsQ@mail.gmail.com
Whole thread Raw
Responses Re: Why latestRemovedXid|cuteoff_xid are always sent?  (Peter Geoghegan <pg@bowt.ie>)
List pgsql-hackers
Hello, hackers.

Working on some stuff, I realized I do not understand why
latestRemovedXid|cuteoff_xid (in different types of WAL records) are
sent every time they appear on the primary side.

latestRemovedXid|cuteoff_xid is used to call
ResolveRecoveryConflictWithSnapshot and cancel conflicting backend on
Standby. In some of the cases, snapshot conflict resolving is the only
work REDO does (heap_xlog_cleanup_info
 or btree_xlog_reuse_page, for example).

Could we try to somehow optimistically advance the latest sent
latestRemovedXid value in shared memory on the primary and skip
sending it if the newer xid was sent already? In such a way we could
reduce the number of ResolveRecoveryConflictWithSnapshot calls on
Standby and even skip some WAL records.

At least we could do the same optimization on the standby side
(skipping ResolveRecoveryConflictWithSnapshot if it was called with
newer xid already).

Is it a sane idea or I have missed something huge?

Thanks,
Michail.



pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: Move --data-checksums to common options in initdb --help
Next
From: Andrey Borodin
Date:
Subject: Re: archive status ".ready" files may be created too early