diff options
| author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2025-12-02 21:10:47 +0200 |
|---|---|---|
| committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2025-12-02 21:10:47 +0200 |
| commit | 1e4e5783e7d77adb283ae7fa1ac99b0910a041b2 (patch) | |
| tree | 69c439f0628cc3d16c3fb25feb51b0d7dce6ccd5 /src/backend/access/nbtree/nbtinsert.c | |
| parent | f894acb24a12cf1f369a45af36c8f4049f9af571 (diff) | |
Add a test for incomplete splits in B-tree indexes
To increase our test coverage in general, and because I will add onto
this in the next commit to also test amcheck with incomplete splits.
This is copied from the similar test we had for GIN indexes. B-tree's
incomplete splits work similarly to GIN's, so with small changes, the
same test works for B-tree too.
Reviewed-by: Peter Geoghegan <pg@bowt.ie>
Discussion: https://www.postgresql.org/message-id/abd65090-5336-42cc-b768-2bdd66738404@iki.fi
Diffstat (limited to 'src/backend/access/nbtree/nbtinsert.c')
| -rw-r--r-- | src/backend/access/nbtree/nbtinsert.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/backend/access/nbtree/nbtinsert.c b/src/backend/access/nbtree/nbtinsert.c index 7c113c007e5..3a4b791f2ab 100644 --- a/src/backend/access/nbtree/nbtinsert.c +++ b/src/backend/access/nbtree/nbtinsert.c @@ -26,6 +26,7 @@ #include "miscadmin.h" #include "storage/lmgr.h" #include "storage/predicate.h" +#include "utils/injection_point.h" /* Minimum tree height for application of fastpath optimization */ #define BTREE_FASTPATH_MIN_LEVEL 2 @@ -1239,6 +1240,13 @@ _bt_insertonpg(Relation rel, * page. *---------- */ +#ifdef USE_INJECTION_POINTS + if (P_ISLEAF(opaque)) + INJECTION_POINT("nbtree-leave-leaf-split-incomplete", NULL); + else + INJECTION_POINT("nbtree-leave-internal-split-incomplete", NULL); +#endif + _bt_insert_parent(rel, heaprel, buf, rbuf, stack, isroot, isonly); } else @@ -2285,6 +2293,7 @@ _bt_finish_split(Relation rel, Relation heaprel, Buffer lbuf, BTStack stack) /* Was this the only page on the level before split? */ wasonly = (P_LEFTMOST(lpageop) && P_RIGHTMOST(rpageop)); + INJECTION_POINT("nbtree-finish-incomplete-split", NULL); elog(DEBUG1, "finishing incomplete split of %u/%u", BufferGetBlockNumber(lbuf), BufferGetBlockNumber(rbuf)); |
