Improve C comments in GetSnapshotData.
authorRobert Haas <rhaas@postgresql.org>
Tue, 21 Aug 2012 15:47:10 +0000 (11:47 -0400)
committerRobert Haas <rhaas@postgresql.org>
Tue, 21 Aug 2012 15:47:10 +0000 (11:47 -0400)
Move discussion of why our algorithm for taking snapshots in recovery
to a more appropriate location in the function, and delete incorrect
mention of taking a lock.

src/backend/storage/ipc/procarray.c

index fad95ca7ceebac683c7a01a09b98d8f35735ea3c..984c2861cc6b1df350d274fe15c522122c67a690 100644 (file)
@@ -1307,14 +1307,6 @@ GetSnapshotData(Snapshot snapshot)
        /* initialize xmin calculation with xmax */
        globalxmin = xmin = xmax;
 
-       /*
-        * If we're in recovery then snapshot data comes from a different place,
-        * so decide which route we take before grab the lock. It is possible for
-        * recovery to end before we finish taking snapshot, and for newly
-        * assigned transaction ids to be added to the procarray. Xmax cannot
-        * change while we hold ProcArrayLock, so those newly added transaction
-        * ids would be filtered away, so we need not be concerned about them.
-        */
        snapshot->takenDuringRecovery = RecoveryInProgress();
 
        if (!snapshot->takenDuringRecovery)
@@ -1429,6 +1421,12 @@ GetSnapshotData(Snapshot snapshot)
                 * Either way we need to change the way XidInMVCCSnapshot() works
                 * depending upon when the snapshot was taken, or change normal
                 * snapshot processing so it matches.
+                *
+                * Note: It is possible for recovery to end before we finish taking the
+                * snapshot, and for newly assigned transaction ids to be added to the
+                * ProcArray.  xmax cannot change while we hold ProcArrayLock, so those
+                * newly added transaction ids would be filtered away, so we need not
+                * be concerned about them.
                 */
                subcount = KnownAssignedXidsGetAndSetXmin(snapshot->subxip, &xmin,
                                                                                                  xmax);