Re: A design for amcheck heapam verification
Peter Geoghegan <pg@bowt.ie>
From: Peter Geoghegan <pg@bowt.ie>
To: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2017-05-01T23:28:59Z
Lists: pgsql-hackers
On Mon, May 1, 2017 at 2:10 PM, Peter Geoghegan <pg@bowt.ie> wrote: > Actually, I guess amcheck would need to use its own scan's snapshot > xmin instead. This is true because it cares about visibility in a way > that's "backwards" relative to existing code that tests something > against RecentGlobalXmin. Is there any existing thing that works that > way? Looks like pg_visibility has a similar set of concerns, and so sometimes calls GetOldestXmin() to "recompute" what it calls OldestXmin (which I gather is like RecentGlobalXmin, but comes from calling GetOldestXmin() at least once). This happens within pg_visibility's collect_corrupt_items(). So, I could either follow that approach, or, more conservatively, call GetOldestXmin() immediately after each "amcheck whole index scan" finishes, for use later on, when we go to the heap. Within the heap, we expect that any committed tuple whose xmin precedes FooIndex.OldestXmin should be present in that index's bloom filter. Of course, when there are multiple indexes, we might only arrive at the heap much later. (I guess we'd also want to check if the MVCC Snapshot's xmin preceded FooIndex.OldestXmin, and set that as FooIndex.OldestXmin when that happened to be the case.) Anyone have an opinion on any of this? Offhand, I think that calling GetOldestXmin() once per index when its "amcheck whole index scan" finishes would be safe, and yet provide appreciably better test coverage than only expecting things visible to our original MVCC snapshot to be present in the index. I don't see a great reason to be more aggressive and call GetOldestXmin() more often than once per whole index scan, though. -- Peter Geoghegan VMware vCenter Server https://www.vmware.com/
Commits
-
Fix non-portable use of round().
- 686d399f2be6 11.0 landed
-
Add amcheck verification of heap relations belonging to btree indexes.
- 7f563c09f890 11.0 landed
-
Add Bloom filter implementation.
- 51bc271790eb 11.0 landed
-
Use ereport not elog for some corrupt-HOT-chain reports.
- 8ecdc2ffe3da 11.0 cited
-
Introduce 64-bit hash functions with a 64-bit seed.
- 81c5e46c490e 11.0 cited
-
Upgrade src/port/rint.c to be POSIX-compliant.
- 06bf0dd6e354 9.5.0 cited
-
Use type "int64" for memory accounting in tuplesort.c/tuplestore.c.
- 79e0f87a1564 9.4.0 cited