Skip to content

Fix REINDEX cache accounting leak - #490

Draft
tjgreen42 wants to merge 2 commits into
mainfrom
fix/reindex-cache-accounting
Draft

tjgreen42 wants to merge 2 commits into
mainfrom
fix/reindex-cache-accounting

Conversation

@tjgreen42

Copy link
Copy Markdown
Collaborator

Summary

  • key shared index state by database and index OID
  • preserve shared cache state across REINDEX while clearing stale accounting and relfilenode-bound cursors
  • clean dropped-database state and reset transaction-local state across prepared transactions
  • add required serial, parallel, rollback, multi-backend, and cross-database regressions

Closes #464
Closes #470
Closes #486

Testing

  • PostgreSQL 17 and 18: 77/77 regression tests
  • make test-reindex
  • make test-cross-database-registry (52 assertions)

Qualify shared registry entries by database, keep runtime cache state stable across index rebuilds, and invalidate cached cursors when PostgreSQL changes the underlying relation file. Add regression coverage for accounting, rollback, prepared transactions, cross-database OID collisions, and database cleanup.
@codecov

codecov Bot commented Sep 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.21228% with 50 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/index/state.c 93.05% 15 Missing ⚠️
src/memtable/cache.c 75.80% 15 Missing ⚠️
src/mod.c 66.66% 11 Missing ⚠️
src/index/registry.c 87.69% 8 Missing ⚠️
src/memtable/stringtable.c 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Capture the database OID selected by PostgreSQL's DROP hook instead of resolving a potentially stale name before utility execution. Keep mutable hook and registry iterator state outside setjmp-sensitive stack storage.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant