diff options
author | Robert Haas <rhaas@postgresql.org> | 2012-12-14 15:44:38 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2012-12-14 15:44:38 -0500 |
commit | 75758a6ff01156e163779f5f7386fa36720fb38f (patch) | |
tree | 47008cc229095656e88487c50fa1d1e37d597599 | |
parent | fdb67eb2b69fe035339c7461c6323dc69010db18 (diff) | |
download | postgresql-75758a6ff01156e163779f5f7386fa36720fb38f.tar.gz postgresql-75758a6ff01156e163779f5f7386fa36720fb38f.zip |
Update comment in heapgetpage() regarding PD_ALL_VISIBLE vs. Hot Standby.
Pavan Deolasee, slightly modified by me
-rw-r--r-- | src/backend/access/heap/heapam.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index e114d3dc45b..186fb8711b5 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -260,10 +260,23 @@ heapgetpage(HeapScanDesc scan, BlockNumber page) /* * If the all-visible flag indicates that all tuples on the page are - * visible to everyone, we can skip the per-tuple visibility tests. But - * not in hot standby mode. A tuple that's already visible to all + * visible to everyone, we can skip the per-tuple visibility tests. + * + * Note: In hot standby, a tuple that's already visible to all * transactions in the master might still be invisible to a read-only - * transaction in the standby. + * transaction in the standby. We partly handle this problem by tracking + * the minimum xmin of visible tuples as the cut-off XID while marking a + * page all-visible on master and WAL log that along with the visibility + * map SET operation. In hot standby, we wait for (or abort) all + * transactions that can potentially may not see one or more tuples on the + * page. That's how index-only scans work fine in hot standby. A crucial + * difference between index-only scans and heap scans is that the + * index-only scan completely relies on the visibility map where as heap + * scan looks at the page-level PD_ALL_VISIBLE flag. We are not sure if the + * page-level flag can be trusted in the same way, because it might get + * propagated somehow without being explicitly WAL-logged, e.g. via a full + * page write. Until we can prove that beyond doubt, let's check each + * tuple for visibility the hard way. */ all_visible = PageIsAllVisible(dp) && !snapshot->takenDuringRecovery; |