]> granicus.if.org Git - postgresql/commitdiff
Revert 1f30295eab65eddaa88528876ab66e7095f4bb65
authorSimon Riggs <simon@2ndQuadrant.com>
Sat, 24 Jun 2017 12:03:55 +0000 (13:03 +0100)
committerSimon Riggs <simon@2ndQuadrant.com>
Sat, 24 Jun 2017 12:03:55 +0000 (13:03 +0100)
Reported-by: Tom Lane
src/backend/utils/time/snapmgr.c

index 6369be78a3173b6806545004429fe4ac279406b6..6bf3a94f057a50169595c12e4d1b2eb0bb70f278 100644 (file)
@@ -2076,6 +2076,14 @@ SerializeSnapshot(Snapshot snapshot, char *start_address)
        serialized_snapshot.whenTaken = snapshot->whenTaken;
        serialized_snapshot.lsn = snapshot->lsn;
 
+       /*
+        * Ignore the SubXID array if it has overflowed, unless the snapshot was
+        * taken during recovey - in that case, top-level XIDs are in subxip as
+        * well, and we mustn't lose them.
+        */
+       if (serialized_snapshot.suboverflowed && !snapshot->takenDuringRecovery)
+               serialized_snapshot.subxcnt = 0;
+
        /* Copy struct to possibly-unaligned buffer */
        memcpy(start_address,
                   &serialized_snapshot, sizeof(SerializedSnapshotData));
@@ -2092,9 +2100,6 @@ SerializeSnapshot(Snapshot snapshot, char *start_address)
         * snapshot taken during recovery; all the top-level XIDs are in subxip as
         * well in that case, so we mustn't lose them.
         */
-       if (serialized_snapshot.suboverflowed && !snapshot->takenDuringRecovery)
-               serialized_snapshot.subxcnt = 0;
-
        if (serialized_snapshot.subxcnt > 0)
        {
                Size            subxipoff = sizeof(SerializedSnapshotData) +