Skip to content

fix(retrieval): support PostgreSQL 17+ checkpoint stats in capacity probe - #496

Open
Ayush7614 wants to merge 1 commit into
Ontos-AI:mainfrom
Ayush7614:fix/ayush7614/postgres-17-checkpoints-compat
Open

Ayush7614 wants to merge 1 commit into
Ontos-AI:mainfrom
Ayush7614:fix/ayush7614/postgres-17-checkpoints-compat

Conversation

@Ayush7614

Copy link
Copy Markdown

Problem

The publication-capacity resource probe read checkpoint stats from
pg_stat_bgwriter.checkpoints_timed + checkpoints_req, but PostgreSQL 17
moved those columns out of pg_stat_bgwriter (into
pg_stat_checkpointer as num_timed/num_requested). On PostgreSQL 17+ the
probe raised UndefinedColumn: checkpoints_timed, failing the
test_publication_capacity_batch_contract CI test on main.

Fix

Detect the server version via SHOW server_version_num and read checkpoint
counts from the view that exposes them on that version:

  • PG >= 17: pg_stat_checkpointer (num_timed + num_requested)
  • PG < 17: pg_stat_bgwriter (checkpoints_timed + checkpoints_req)

Verification

  • make lint passes
  • test_publication_capacity_batch_contract (sync + async) passes on
    PostgreSQL 18
  • This is original work on a new branch, not taken from any open/closed issue
    or existing PR.

Base: upstream/main. Head: Ayush7614/knowhere fix/ayush7614/postgres-17-checkpoints-compat

…robe

pg_stat_bgwriter lost checkpoints_timed/checkpoints_req in PostgreSQL 17
(moved to pg_stat_checkpointer as num_timed/num_requested), so the
publication-capacity resource probe raised UndefinedColumn on modern
PostgreSQL and the capacity-batch contract test failed on main.

Detect the server version and read checkpoint counts from the view that
actually exposes them on each version.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant