Re: new heapcheck contrib module
Peter Geoghegan <pg@bowt.ie>
On Mon, Apr 20, 2020 at 12:42 PM Andres Freund <andres@anarazel.de> wrote: > This is something we really really really need. I'm very excited to see > progress! +1 My experience with amcheck was that the requirement that we document and verify pretty much every invariant (the details of which differ slightly based on the B-Tree version in use) has had intangible benefits. It helped me come up with a simpler, better design in the first place. Also, many of the benchmarks that I perform get to be a stress-test of the feature itself. It saves quite a lot of testing work in the long run. > I wonder if a mode where heapcheck optionally would only checks > non-frozen (perhaps also non-all-visible) regions of a table would be a > good idea? Would make it a lot more viable to run this regularly on > bigger databases. Even if there's a window to not check some data > (because it's frozen before the next heapcheck run). That's a great idea. It could also make it practical to use the rootdescend verification option to verify indexes selectively -- if you don't have too many blocks to check on average, the overhead is tolerable. This is the kind of thing that naturally belongs in the higher level interface that I sketched already. > We also had a *lot* of bugs that we'd have found a lot earlier, possibly > even during development, if we had a way to easily perform these checks. I can think of a case where it was quite unclear what the invariants for the heap even were, at least temporarily. And this was in the context of fixing a bug that was really quite nasty. Formally defining the invariants in one place, and taking a position on exactly what correct looks like seems like a very valuable exercise. Even without the tool catching a single bug. > I have a hard time believing this is going to be really > reliable. E.g. the alignment requirements will vary between platforms, > leading to different layouts. In particular, MAXALIGN differs between > platforms. Over on another thread, I suggested that Mark might want to have a corruption test framework that exposes some of the bufpage.c routines. The idea is that you can destructively manipulate a page using the logical page interface. Something that works one level below the access method, but one level above the raw page image. It probably wouldn't test everything that Mark wants to test, but it would test some things in a way that seems maintainable to me. -- Peter Geoghegan
Commits
-
Add pg_amcheck, a CLI for contrib/amcheck.
- 9706092839db 14.0 landed
-
Refactor and generalize the ParallelSlot machinery.
- f71519e545a3 14.0 landed
-
Generalize parallel slot result handling.
- 418611c84d00 14.0 landed
-
Move some code from src/bin/scripts to src/fe_utils to permit reuse.
- e955bd4b6c2b 14.0 landed
-
Factor pattern-construction logic out of processSQLNamePattern.
- 2c8726c4b0a4 14.0 landed
-
Doc: clean up verify_heapam() documentation.
- 4c49d8fc15ee 14.0 landed
-
Fix more portability issues in new amcheck code.
- 321633e17b07 14.0 landed
-
Fix portability issues in new amcheck test.
- 860593ec3bd1 14.0 landed
-
Try to avoid a compiler warning about using fxid uninitialized.
- 8bb0c9770e80 14.0 landed
-
Extend amcheck to check heap pages.
- 866e24d47db1 14.0 landed
-
Adjust walsender usage of xlogreader, simplify APIs
- 850196b610d2 13.0 cited
-
Improve checking of child pages in contrib/amcheck.
- d114cc538715 13.0 cited
-
Sanitize line pointers within contrib/amcheck.
- a9ce839a3137 12.0 cited
-
Fix possible sorting error when aborting use of abbreviated keys.
- 008c4135ccf6 10.0 cited