mirror of
https://github.com/postgres/postgres.git
synced 2025-05-11 05:41:32 +03:00
Fix corruption of 2PC recovery with subxacts
Reading 2PC state files during recovery was borked, causing corruptions during recovery. Effect limited to servers with 2PC, subtransactions and recovery/replication. Stas Kelvich, reviewed by Michael Paquier and Pavan Deolasee
This commit is contained in:
parent
1fa42debe6
commit
1fef3d576e
@ -1758,8 +1758,9 @@ PrescanPreparedTransactions(TransactionId **xids_p, int *nxids_p)
|
||||
* need to hold a lock while examining it. We still acquire the
|
||||
* lock to modify it, though.
|
||||
*/
|
||||
subxids = (TransactionId *)
|
||||
(buf + MAXALIGN(sizeof(TwoPhaseFileHeader)));
|
||||
subxids = (TransactionId *) (buf +
|
||||
MAXALIGN(sizeof(TwoPhaseFileHeader)) +
|
||||
MAXALIGN(hdr->gidlen));
|
||||
for (i = 0; i < hdr->nsubxacts; i++)
|
||||
{
|
||||
TransactionId subxid = subxids[i];
|
||||
@ -1877,8 +1878,9 @@ StandbyRecoverPreparedTransactions(bool overwriteOK)
|
||||
* Examine subtransaction XIDs ... they should all follow main
|
||||
* XID.
|
||||
*/
|
||||
subxids = (TransactionId *)
|
||||
(buf + MAXALIGN(sizeof(TwoPhaseFileHeader)));
|
||||
subxids = (TransactionId *) (buf +
|
||||
MAXALIGN(sizeof(TwoPhaseFileHeader)) +
|
||||
MAXALIGN(hdr->gidlen));
|
||||
for (i = 0; i < hdr->nsubxacts; i++)
|
||||
{
|
||||
TransactionId subxid = subxids[i];
|
||||
|
Loading…
x
Reference in New Issue
Block a user