Re: pg_amcheck contrib application
Robert Haas <robertmhaas@gmail.com>
On Fri, Mar 12, 2021 at 2:31 PM Robert Haas <robertmhaas@gmail.com> wrote: > I'll commit something shortly to address these. There are some interesting failures in the test cases on the buildfarm. One of the tests ($offnum == 13) corrupts the TOAST pointer with a garbage value, expecting to get the message "final toast chunk number 0 differs from expected value 6". But on florican and maybe other systems we instead get "final toast chunk number 0 differs from expected value 5". That's because the value of TOAST_MAX_CHUNK_SIZE depends on MAXIMUM_ALIGNOF. I think that on 4-byte alignment systems it works out to 2000 and on 8-byte alignment systems it works out to 1996, and the value being stored is 10000 bytes, hence the problem. The place where the calculation goes different seems to be in MaximumBytesPerTuple(), where it uses MAXALIGN_DOWN() on a value that, according to my calculations, will be 2038 on all platforms, but the output of MAXALIGN_DOWN() will be 2032 or 2036 depending on the platform. I think the solution to this is just to change the message to match \d+ chunks instead of exactly 6. We should do that right away to avoid having the buildfarm barf. But, I also notice a couple of other things I think could be improved here: 1. amcheck is really reporting the complete absence of any TOAST rows here due to a corrupted va_valueid. It could pick a better phrasing of that message than "final toast chunk number 0 differs from expected value XXX". I mean, there is no chunk 0. There are no chunks at all. 2. Using SSSSSSSSS as the perl unpack code for the varlena header is not ideal, because it's really 2 1-byte fields followed by 4 4-byte fields. So I think you should be using CCllLL, for two unsigned bytes and then two signed 4-byte quantities and then two unsigned 4-byte quantities. I think if you did that you'd be overwriting the va_valueid with the *same* garbage value on every platform, which would be better than different ones. Perhaps when we improve the message as suggested in (1) this will become a live issue, since we might choose to say something like "no TOAST entries for value %u". -- Robert Haas EDB: http://www.enterprisedb.com
Commits
-
amcheck: Improve some confusing reports about TOAST problems.
- 50529e5b4e39 14.0 landed
-
amcheck: Reword some messages and fix an alignment problem.
- 9acaf1a62197 14.0 landed
-
amcheck: fix multiple problems with TOAST pointer validation
- ec7ffb8096e8 14.0 landed
-
amcheck: Remove duplicate XID/MXID bounds checks.
- 4573f6a9af6e 14.0 landed
-
amcheck: Fix verify_heapam's tuple visibility checking rules.
- 3b6c1259f9ca 14.0 landed
-
nbtree VACUUM: Cope with buggy opclasses.
- 5b861baa550a 14.0 landed
-
Improve pg_amcheck's TAP test 003_check.pl.
- 87d90ac61fa1 14.0 landed
-
Fix a confusing amcheck corruption message.
- 4078ce65a0f7 14.0 landed
-
Doc: add note about how to run the pg_amcheck regression tests.
- 58f57490facd 14.0 cited
-
In pg_amcheck tests, don't depend on perl's Q/q pack code.
- 945d2cb7d025 14.0 landed
-
pg_amcheck: Keep trying to fix the tests.
- 9e294d0f34d6 14.0 landed
-
pg_amcheck: Try to fix still more test failures.
- 24189277f6ff 14.0 landed
-
Try to avoid apparent platform-dependency in IPC::Run
- f371a4cdba6d 14.0 landed
-
Fix portability issues in pg_amcheck's 004_verify_heapam.pl.
- 661125612706 14.0 landed
-
Try to fix compiler warnings.
- d60e61de4fb4 14.0 landed
-
Add pg_amcheck, a CLI for contrib/amcheck.
- 9706092839db 14.0 landed
-
Refactor and generalize the ParallelSlot machinery.
- f71519e545a3 14.0 landed
-
Remove old-style VACUUM FULL (which was known for a little while as
- 0a469c87692d 9.0.0 cited