Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 4b373e4

Browse files
committed
Improve C comments in GetSnapshotData.
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.
1 parent 82ef3d3 commit 4b373e4

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/backend/storage/ipc/procarray.c

+6-8
Original file line numberDiff line numberDiff line change
@@ -1307,14 +1307,6 @@ GetSnapshotData(Snapshot snapshot)
13071307
/* initialize xmin calculation with xmax */
13081308
globalxmin = xmin = xmax;
13091309

1310-
/*
1311-
* If we're in recovery then snapshot data comes from a different place,
1312-
* so decide which route we take before grab the lock. It is possible for
1313-
* recovery to end before we finish taking snapshot, and for newly
1314-
* assigned transaction ids to be added to the procarray. Xmax cannot
1315-
* change while we hold ProcArrayLock, so those newly added transaction
1316-
* ids would be filtered away, so we need not be concerned about them.
1317-
*/
13181310
snapshot->takenDuringRecovery = RecoveryInProgress();
13191311

13201312
if (!snapshot->takenDuringRecovery)
@@ -1429,6 +1421,12 @@ GetSnapshotData(Snapshot snapshot)
14291421
* Either way we need to change the way XidInMVCCSnapshot() works
14301422
* depending upon when the snapshot was taken, or change normal
14311423
* snapshot processing so it matches.
1424+
*
1425+
* Note: It is possible for recovery to end before we finish taking the
1426+
* snapshot, and for newly assigned transaction ids to be added to the
1427+
* ProcArray. xmax cannot change while we hold ProcArrayLock, so those
1428+
* newly added transaction ids would be filtered away, so we need not
1429+
* be concerned about them.
14321430
*/
14331431
subcount = KnownAssignedXidsGetAndSetXmin(snapshot->subxip, &xmin,
14341432
xmax);

0 commit comments

Comments
 (0)