Don't pass InvalidTransactionId to update_next_xid.

update_next_xid() doesn't have any special treatment for the invalid
or other special XIDs, so it will treat InvalidTransactionId (0) as a
regular XID. If old nextXid is smaller than 2^31, 0 will look like a
very old XID, and nothing happens. But if nextXid is greater than 2^31
0 will look like a very new XID, and update_next_xid() will
incorrectly bump up nextXID.
This commit is contained in:
Heikki Linnakangas
2024-01-20 10:28:43 +02:00
committed by Stas Kelvich
parent 93450f11f5
commit d249299821

View File

@@ -102,7 +102,9 @@ impl WalIngest {
buf.advance(decoded.main_data_offset);
assert!(!self.checkpoint_modified);
if self.checkpoint.update_next_xid(decoded.xl_xid) {
if decoded.xl_xid != pg_constants::INVALID_TRANSACTION_ID
&& self.checkpoint.update_next_xid(decoded.xl_xid)
{
self.checkpoint_modified = true;
}