Re: nbtree backwards scan test coverage - Mailing list pgsql-hackers

From Alexander Lakhin
Subject Re: nbtree backwards scan test coverage
Date
Msg-id b61d9944-d7a3-45f3-b69a-f18c8bfbbbd0@gmail.com
Whole thread
In response to nbtree backwards scan test coverage  (Peter Geoghegan <pg@bowt.ie>)
Responses Re: pg_rewind: Skip vanished source files during traversal
List pgsql-hackers
Hello Peter,

20.07.2026 02:23, Peter Geoghegan wrote:
Attached patches add an isolation test to the nbtree test module,
which uses injection points. This provides thorough test coverage for
nbtree backwards scans, including cases where we must recover from
concurrent page splits, and page deletions by VACUUM.

The new backwards-scan-concurrent-splits test has failed a couple of times
so far: [1], [2]:
# --- /mnt/build/HEAD/pgsql/src/test/modules/nbtree/expected/backwards-scan-concurrent-splits.out
# +++ /mnt/build/HEAD/pgsql.build/src/test/modules/nbtree/output_iso/results/backwards-scan-concurrent-splits.out
# @@ -208,7 +208,6 @@
#                         
#  (1 row)
#  
# -scan_session: NOTICE:  notice triggered for injection point nbtree-walk-left-step-right
#  step b_scan: <... completed>
#  col
#  ---
not ok 1     - backwards-scan-concurrent-splits          310 ms
ok 2         - predicate-empty-index                     214 ms
1..2
# 1 of 2 tests failed.

Looks like it is not immune to autovacuum. I've reproduced this locally with:
--- a/src/test/modules/nbtree/Makefile
+++ b/src/test/modules/nbtree/Makefile
@@ -8 +8 @@ REGRESS = nbtree_half_dead_pages \
-ISOLATION = backwards-scan-concurrent-splits \
+ISOLATION = $(shell printf 'backwards-scan-concurrent-splits %.0s' `seq 100`) \

and
echo "autovacuum_naptime=1s" >/tmp/extra.config
TEMP_CONFIG=/tmp/extra.config make -s check -C src/test/modules/nbtree
...
ok 17        - backwards-scan-concurrent-splits          160 ms
# diff -U3 .../src/test/modules/nbtree/expected/backwards-scan-concurrent-splits.out .../src/test/modules/nbtree/output_iso/results/backwards-scan-concurrent-splits.out
# --- .../src/test/modules/nbtree/expected/backwards-scan-concurrent-splits.out      2026-07-28 22:26:18.306287159 +0300
# +++ .../src/test/modules/nbtree/output_iso/results/backwards-scan-concurrent-splits.out    2026-07-29 07:26:51.016349487 +0300
# @@ -277,8 +277,6 @@
#                         
#  (1 row)
#  
# -scan_session: NOTICE:  notice triggered for injection point nbtree-walk-left-deleted
# -scan_session: NOTICE:  notice triggered for injection point nbtree-walk-left-restart
#  step b_scan_999: <... completed>
#  col
#  ---
not ok 18    - backwards-scan-concurrent-splits          162 ms
ok 19        - backwards-scan-concurrent-splits          165 ms
...
ok 99        - backwards-scan-concurrent-splits          168 ms
ok 100       - backwards-scan-concurrent-splits          160 ms
ok 101       - predicate-empty-index                     104 ms
1..101
# 8 of 101 tests failed.

Could you please have a look?

[1] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=jay&dt=2026-07-28%2021%3A00%3A31
[2] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=basilisk&dt=2026-07-26%2006%3A58%3A54

Best regards,
Alexander
Attachment

pgsql-hackers by date:

Previous
From: Peter Smith
Date:
Subject: Re: A new C function `get_partition_root`.
Next
From: Peter Smith
Date:
Subject: Re: Missing list_free in publicationcmds.c:OpenTableList