Fix gistkillitems & add regression test to microvacuum

From: Kirill Reshke <reshkekirill(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Fix gistkillitems & add regression test to microvacuum
Date: 2026-01-15 07:00:38
Message-ID: CALdSSPgZWX_D8+Fx4YQqRN5eW5iSx_rJdqQhCfdWTvqKXVfJ4w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers.

While looking at [0] I noticed that XLOG_GIST_DELETE & XLOG_GIST_PAGE_DELETE
records are not covered.

This thread addresses XLOG_GIST_DELETE, which is also known as a
microvacuum feature.

test.sql contains regression test that trigger this code to be
exercised in stream_regress.pl TAP test.

Test is as follows: we create a gist index on the table, then we
insert exactly 407 records, making the root page full (next insert
will trigger page split). Then I delete all tuples from relation and
trigger Index Only scan to do kill-on-select (killtuples). It marks
gist 0 page (which is root and is leaf) as has_garbage. Then, the next
insertion triggers xlog_gist_delete record.

To verify this I use pageinspect and pg_waldimp (locally). Also this
test is dependent on block size being 8192 which is not good.

And all of this does not work actually without v1-0001, because there
is a bug in GiST which does not call gistkillitmes for the very first
(root) page.

There is also test2.sql which inserts a single tuple, not 407. It can
be used to verify v1-0001.

[0] coverage.postgresql.org/src/backend/access/gist/gistxlog.c.gcov.html

--
Best regards,
Kirill Reshke

Attachment Content-Type Size
test2.sql application/octet-stream 501 bytes
test.sql application/octet-stream 529 bytes
v1-0001-Fix-gistkillitems-for-GiST-ROOT-page.patch application/octet-stream 1.6 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hayato Kuroda (Fujitsu) 2026-01-15 07:05:20 RE: Resetting recovery target parameters in pg_createsubscriber
Previous Message Tatsuro Yamada 2026-01-15 06:32:51 Re: [PATCH] psql: add \dcs to list all constraints