Skip to content

The restore deadline test waits for the blocked query - #2181

Open
zlareb1 wants to merge 2 commits into
mainfrom
maintenance/cell-restore-arm-test-deadline
Open

zlareb1 wants to merge 2 commits into
mainfrom
maintenance/cell-restore-arm-test-deadline

Conversation

@zlareb1

@zlareb1 zlareb1 commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Related: #2100

Changelog category

  • CI Fix or Improvement

Changelog entry

None.

Why

The restore cleanup test can spend its entire deadline opening a Postgres connection. The wait for initialization then expires before the test sees a blocked backend. A 280 ms connection delay reproduces the failure on the tested base and on clean main. Failed Postgres job

Scope and risk

Pause the test budget until pg_stat_activity confirms the initialization query is blocked. The wait uses the timeout computed by the production budget. The test checks the cleanup deadline, the public close, and removal of the backend and its lock.

Compatibility, rollout and rollback

  • The repair affects the test fixture. Revert the commit to undo it.

Tests

  • All 40 tests in tests/integration/test_cell_restore.py passed on private Postgres 18 and ClickHouse, with the same 280 ms delay applied to the deadline case.
  • make format, make lint, and make typecheck.

AI assistance in the code

  • AI-generated. Compared the hosted failure with the targeted reproduction and ran the integration file with the delay enabled.

Checklist

  • Local format, lint, type checks and focused tests pass.
  • This change affects one test and needs no generated files, migration or operator steps.
  • The commit is signed off.

Note

Low Risk
Low risk as changes are strictly limited to timing synchronization within an integration test fixture.

Overview
Updates test_restore_owns_raw_backend_before_initialization to exclude connection and fixture setup time from the restore deadline budget.

In the deadline scenario, asyncio.wait is monkeypatched to wait until Postgres confirms the query is sleeping before advancing the budget deadline, preventing flaky timeouts caused by slow connection establishment.

Reviewed by Cursor Bugbot for commit 4ce374c. Bugbot is set up for automated code reviews on this repo. Configure here.

Opening a Postgres connection can consume the deadline before initialization starts. Arm the test deadline after observing the blocked query so the test measures cleanup of the owned backend.

Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
@vercel

vercel Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
loom-docs Ready Ready Preview Dec 4, 2026 10:50pm UTC
loom-telemetry Ready Ready Preview Dec 4, 2026 10:50pm UTC

Request Review

Extend the test budget by the time spent waiting for the observer. The first wait still uses the timeout computed by the restore budget.

Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>

This branch has not been deployed

No deployments
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