Re: Bug in amcheck?
Peter Geoghegan <pg@bowt.ie>
From: Peter Geoghegan <pg@bowt.ie>
To: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: Mihail Nikalayeu <mihailnikalayeu@gmail.com>,
Konstantin Knizhnik <knizhnik@garret.ru>, akorotkov@postgresql.org, aekorotkov@gmail.com, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-12-02T17:59:19Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix amcheck's handling of half-dead B-tree pages
- fbb4b607832d 14.21 landed
- 7792bdc45860 15.16 landed
- 1829016268c3 16.12 landed
- e8ae594458a3 17.8 landed
- 19e786727c4f 18.2 landed
- cbe04e5d729f 19 (unreleased) landed
-
Fix amcheck's handling of incomplete root splits in B-tree
- a4cb21ea9cd7 14.21 landed
- 721b58fbec5f 15.16 landed
- f2a6df9fd56d 16.12 landed
- 5a2d1df00718 17.8 landed
- 50c63ebb05fc 18.2 landed
- 6c05ef5729c0 19 (unreleased) landed
-
Add a test for half-dead pages in B-tree indexes
- c085aab27819 19 (unreleased) landed
-
Add a test for incomplete splits in B-tree indexes
- 1e4e5783e7d7 19 (unreleased) landed
-
Improve checking of child pages in contrib/amcheck.
- d114cc538715 13.0 cited
On Mon, Dec 1, 2025 at 4:20 PM Heikki Linnakangas <hlinnaka@iki.fi> wrote: > Ok, here's a proper patch with tests. The patch itself is the above > one-liner. It's in patch 0004. > > While testing this, I bumped into another similar amcheck bug: if the > root page split is interrupted, verify_btree() complains: > > ERROR: block 3 is not true root in index "nbtree_incomplete_splits_i_idx" > > Attached patch 0002 contains a fix and a test for that. The fix for that > is also one-liner. Good catch. > Summary of the patches: > > Patch 0001 adds an injection point test for incomplete splits. We > already had such a test for GIN, which handles incomplete splits the > same way as B-tree. I copy-pasted and adapted the GIN test for B-tree. > This was an easy way to increase our test coverage. > > Patch 0002 fixes the incomplete-root-split bug in amcheck. It modifies > the test added in patch 0001 to cover the bug fix. > > Patch 0003 adds a test for half-dead pages, similar to what 0001 did for > incomplete splits. > > Patch 0004 fixes the bogus half-deaf-page error in amcheck, i.e. the > issue that started this thread. It modifies the test introduced in patch > 0003 to add amcheck calls, to cover the bug fix. All seem reasonable. These tests will increase nbtree code coverage quite a bit, which is a nice bonus. -- Peter Geoghegan