Review: Add vacuum_delay_point() to GiST empty-page deletion pass (CF61, patch 7038)

code-review · generated from canonical Markdown

Type
code-review
Source
postgresql-master
Slug
commitfest-7038-review
Tags
code-reviewcommitfest-61gistpatch-7038patch-reviewpostgresqlvacuum
Updated
2026-08-04T12:32:49.157204+00:00
Verdict / SummarySingle-line fix adding vacuum_delay_point(false) to gistvacuum_delete_empty_pages() outer loop, matching the established convention. Zero findings. Coverage measured: 1/1 changed executable line covered. ready-for-committer.
Front matter
schema: review-report-v2
target: CommitFest 61, Patch 7038 — Add vacuum_delay_point() to GiST empty-page deletion pass
head: 7cb9060dcde08ca63df1f0d701b0674e0e8ae811
diff_sha: b0b91611e2e892d4e0e69b20aed9041fababbe4b69274cb8136396dd249371cc
verdict: ready-for-committer
blocker_counts:
  verified: 0
  unverified: 0
model: glm-5.2:cloud

Review — Add vacuum_delay_point() to GiST empty-page deletion pass

Patch summary

The patch adds a single vacuum_delay_point(false) call at the top of the outer while-loop in gistvacuum_delete_empty_pages(), before ReadBufferExtended and before any buffer lock is acquired. This matches the established convention in the same file:

The function gistvacuum_delete_empty_pages() (introduced by commit 7df159a620b, 2019) is the only GiST vacuum loop that lacked this call. The bool is_analyze parameter was added by e5b0b0ce150 (PG 18+); false is correct for a VACUUM path.

Findings

Zero findings. Both the patch-reviewer and security-reviewer seats found no blockers, no changes-requested, no majors, no minors, and no nits.

Patch-reviewer seat

Security-reviewer seat

Verification Summary

Both specialist seats (patch-reviewer and security-reviewer) independently verified the patch as clean. No findings were produced, so no finding-level verification (pg-finding-verifier) was required. The zero-finding set was confirmed by merging and de-duplicating the two seats' outputs by file:line + mechanism — the merged set is empty.

Mailing-list thread reconciliation

Thread 652229 (pgsql-hackers) — reconciled with 5 messages:

  1. Paul Kim (v1 patch, 2026-07-21): Identified the oversight by cross-AM comparison of vacuum loops. Correct diagnosis.
  2. Andrey Borodin (x4mmm, 2026-07-21): Confirmed "Yup, this looks like an oversight." Independent GiST maintainer agreement.
  3. Michael Paquier (2026-07-21): CC'd Heikki Linnakangas (original committer). Argued backpatch not strictly required (7 years to notice).
  4. Paul Kim (2026-07-22): Clarified GiST differs from the related GIN thread — GIN was a regression (call was dropped), GiST never had the call. Master-only fix is natural.
  5. Solai (solai.cdac, 2026-07-27): Reviewed and tested v1 — reproduced the execution path with a large GiST index, confirmed vacuum_delay_point(false) is invoked, no functional issues. "The patch looks good to me."

Thread consensus: No unresolved objections, no rejection, no prior counter-argument. Reviewer sign-off received. Backpatch question resolved as master-only (Paul Kim's reasoning accepted by the thread).

Ledger report: commitfest-7038-review-handoff-thread-ledger (source postgresql-master).

Changed-Code Coverage

Coverage requirement

Execution

Test commands

make -C src/backend/access/gist clean && make -C src/backend/access/gist CFLAGS='-O0 -g --coverage -fprofile-arcs -ftest-coverage'
make -j4 CFLAGS='-O0 -g --coverage -fprofile-arcs -ftest-coverage' LDFLAGS='--coverage'
initdb -D <pgdata> --no-locale -E UTF8
pg_ctl -D <pgdata> start -o '-p 54979'
psql -p 54979 -d postgres  # functional GiST vacuum tests
pg_regress --inputdir=src/test/regress --host=localhost --port=54979 gist vacuum
gcov -b -f -o src/backend/access/gist/ src/backend/access/gist/gistvacuum.c

Metrics

MetricValue
Changed executable lines1
Covered changed lines1
Compiler uncovered changed lines0
Uncovered changed lines (semantic)0
Structural uncovered changed lines0
Changed lines without coverage coordinates0
Changed branches0
Covered changed branches0
Integrity errors[] (empty)
Counter epochfresh

Changed line evidence

The single changed executable line is line 528: vacuum_delay_point(false);

gcov evidence: 8: 528: vacuum_delay_point(false) — executed 8 times during the test run. The call returned 100% (call 0 returned 100%).

The comment on line 527 (/* call vacuum_delay_point while not holding any buffer lock */) is structural-only text and is not an executable line — no gcov coordinate is generated for it.

Touched functions

FunctionPathLinesEnteredLines coveredBranches covered
gistvacuum_delete_empty_pagessrc/backend/access/gist/gistvacuum.c504–616yes38/40 (95%)22/22 (100%)

The 2 uncovered lines (542–543: Assert(false) + UnlockReleaseBuffer) are the "shouldn't happen" panic path for a page that was an internal page earlier but is now something else. This is an Assert(false) guard — infeasible to execute in a production build (compiled out when NDEBUG is set) and deliberately unreachable by design. Not a coverage gap requiring a test.

Uncovered regions

None. All changed executable lines are covered.

Uncovered branches

None. The changed line has no branches (it's a straight function call).

Non-instrumented changes

None. The only changed file is src/backend/access/gist/gistvacuum.c, which is fully instrumentable C source.

Residual limitations

Repair Validation Summary

No findings were produced by either review seat, so no candidate repairs were generated, validated, or tested. The finding+repair verification seat (pg-finding-verifier) was not invoked because there were zero findings to verify. The patch as submitted is correct and requires no modifications.

Aggregated Test Plan

No test patches are required. The existing regress suite (gist, vacuum, index_including_gist) exercises the changed code path. The thread records that Solai independently reproduced the execution path with a large GiST index and confirmed the call fires.

Vacuum-delay timing is not deterministically regress-testable (it depends on vacuum_cost_delay/vacuum_cost_limit GUCs and system load), which is consistent with how all prior vacuum_delay_point additions across the codebase were merged — no dedicated regress test exists for any of the 20+ call sites.

Deterministic verdict

Model routes

Provenance

Maintainer CC

Top authors of src/backend/access/gist/gistvacuum.c (3-year window): Bruce Momjian, Melanie Plageman, Peter Geoghegan. Original function introduced by Heikki Linnakangas (commit 7df159a620b, 2019) — already CC'd by Michael Paquier on the thread.

Residual risk

Minimal. The patch adds a single function call that is already used in 20+ sites across the codebase. The call is placed where no buffer lock is held. No new behavior is introduced — the cost-based vacuum delay and interrupt checking are now applied to a pass that should have had them since 2019. The change is master-only with no backpatch (per thread consensus).