diff options
author | Robert Haas <rhaas@postgresql.org> | 2012-08-21 11:47:10 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2012-08-21 11:47:10 -0400 |
commit | 4b373e42d1efd24f871193ce8178c41f199c5df3 (patch) | |
tree | 3e7c441f6604c27d44dfb47e7b0bdf2be5a0d5a7 /src | |
parent | 82ef3d3008f8ec9c565f7a5724196cd0f342d594 (diff) | |
download | postgresql-4b373e42d1efd24f871193ce8178c41f199c5df3.tar.gz postgresql-4b373e42d1efd24f871193ce8178c41f199c5df3.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/storage/ipc/procarray.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c index fad95ca7cee..984c2861cc6 100644 --- a/src/backend/storage/ipc/procarray.c +++ b/src/backend/storage/ipc/procarray.c @@ -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); |