Skip to content

Fix flaky 01169_old_alter_partition_isolation_stress test - #99018

Merged
alexey-milovidov merged 6 commits into
masterfrom
fix-old-alter-partition-isolation-stress
Mar 11, 2026
Merged

alexey-milovidov merged 6 commits into
masterfrom
fix-old-alter-partition-isolation-stress

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Mar 9, 2026 •

Copy link
Copy Markdown
Member

Summary

  • The bare wait after kill -TERM returned non-zero (exit status 143 from killed background processes), causing set -e to abort the script before wait_for_queries_to_finish could run
  • This left orphan $CLICKHOUSE_CLIENT processes still executing queries when the test runner dropped the database, producing UNKNOWN_DATABASE exceptions in stderr
  • Changed wait to wait ||: to match the pattern used in the newer version of this test (01169_alter_partition_isolation_stress.sh)

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=0a82f6f26d88670d510d421f25d7bf878ccdf1f7&name_0=MasterCI&name_1=Stateless%20tests%20%28amd_tsan%2C%20parallel%2C%202%2F2%29

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

...

🤖 Generated with Claude Code


Note

Low Risk
Low risk test-only change: it relaxes error handling around wait after terminating background threads to avoid aborting under set -e. Main risk is masking unexpected non-zero exits from the killed background processes, but behavior matches the newer test variant.

Overview
Prevents 01169_old_alter_partition_isolation_stress.sh from failing early after kill -TERM by changing a bare wait to wait ||: under set -e.

This ensures cleanup (wait_for_queries_to_finish) runs even when wait returns a non-zero status due to the terminated background processes, reducing flakiness and avoiding leftover queries during test teardown.

Written by Cursor Bugbot for commit d13c736. This will update automatically on new commits. Configure here.

Version info

  • Merged into: 26.3.1.594

The bare `wait` after `kill -TERM` returned non-zero (exit status 143
from killed background processes), causing `set -e` to abort the script
before `wait_for_queries_to_finish` could run. This left orphan
`$CLICKHOUSE_CLIENT` processes still executing queries when the test
runner dropped the database, producing `UNKNOWN_DATABASE` exceptions
in stderr.

Change `wait` to `wait ||:` to match the pattern used in the newer
version of this test (`01169_alter_partition_isolation_stress.sh`).

https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=0a82f6f26d88670d510d421f25d7bf878ccdf1f7&name_0=MasterCI&name_1=Stateless%20tests%20%28amd_tsan%2C%20parallel%2C%202%2F2%29

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Mar 9, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [d13c736]

Summary: ✅


AI Review

1) Summary

This PR changes tests/queries/0_stateless/01169_old_alter_partition_isolation_stress.sh to replace wait with wait ||: after terminating background worker threads. The intent is to reduce flakiness from expected non-zero wait status after termination, but the current change also suppresses unexpected worker failures and therefore relaxes the test semantics. High-level verdict: Request changes.

2) Missing context (if any)

  • No CI report/log links were provided in the PR context during this review.
  • No explicit reproduction of the original flaky failure mode was provided.

3) Findings (by severity)

Blockers

  • None.

Majors

  • [tests/queries/0_stateless/01169_old_alter_partition_isolation_stress.sh:113] Replacing wait with wait ||: masks all non-zero exits from background jobs, not only expected termination after SIGTERM. This can hide real exceptions in thread_insert or thread_select, reducing test signal and potentially allowing regressions to pass.
    • Suggested fix: wait on PID_1 and PID_2 explicitly and ignore only expected termination codes (or verify they were running before termination and fail on unexpected statuses).

4) Tests & Evidence

  • Coverage assessment: only one long stress test was modified; no additional test coverage was added.
  • Negative/error-handling tests present: unchanged existing assertions are present, but the new wait ||: weakens failure detection for the two background loops.
  • Additional tests guidance: add a targeted shell test variant that forces an early failure in one worker loop and verifies the test fails (to ensure worker exceptions remain observable).

5) ClickHouse Compliance Checklist (Yes/No + short note)

  • Data deletions logged? Yes — not applicable to production code changes.
  • Serialization formats versioned? Yes — not applicable (no format changes).
  • Experimental setting gate present? Yes — not applicable (no feature change).
  • Settings exposed for constants/thresholds? Yes — not applicable.
  • Backward compatibility preserved? Yes — no user-facing behavior change.
  • SettingsHistory.cpp updated for new/changed settings? Yes — not applicable.
  • Existing tests untouched (only additions)? No — an existing test behavior was relaxed.
  • Docs/user-facing notes updated? Yes — not required for this test-only change.
  • Core-area change got extra scrutiny? Yes — transaction/merge stress test logic reviewed.

6) Performance & Safety Notes

  • No hot-path runtime impact in server code; this is test-only.
  • Safety concern is review-signal quality: broader error suppression may hide true concurrency exceptions in stress threads.
  • No benchmark requirement for this change.

7) User-Lens Review

  • The change is simple and intended to reduce flakiness, but currently it may make failures less actionable by suppressing important worker exceptions.
  • Prefer explicit handling of expected termination status to keep diagnostics reliable for operators and developers.

8) Final Verdict

  • Status: Request changes
  • Minimum required actions:
    1. Replace wait ||: with explicit wait on PID_1/PID_2 and only suppress expected termination outcomes.
    2. Preserve detection of unexpected background worker failures.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Mar 9, 2026
alexey-milovidov and others added 3 commits March 8, 2026 23:41
The job failed when a PR only changed non-source files (e.g. `.sh` test
scripts): `lcov --extract` produced empty output, `genhtml` failed on
the empty input, and then `llvm_coverage_job.py` crashed trying to
compress the non-existent `llvm_coverage_diff_html_report` directory.

Two fixes:
- In `generate_diff_coverage_report.sh`: after `lcov --extract`, check
  if the output contains any `SF:` records; exit 0 early if not.
- In `llvm_coverage_job.py`: guard compress and archive operations on
  the diff report directory actually existing.

https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=99018&sha=df6f0da97c5b87721cde0190e310431d826349d5&name_0=PR&name_1=LLVM%20Coverage

Co-Authored-By: Claude Opus 4.6 <[email protected]>
When changed files have no coverage data, the diff HTML report is never
created. Guard the diff URL in `coverage_comment.json` and in
`report_links` on the diff report actually existing, to avoid broken S3
links in the GitHub PR comment and job results.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

Merged the fix from #99032 into this branch to resolve the LLVM Coverage job failure. It was broken in #96738 when the diff coverage report was introduced — the job crashes when a PR has no C++ source code changes. cc @alexbakharew

@alexbakharew

Copy link
Copy Markdown
Contributor

The LLVM Coverage job is fixed in this PR: #99103
It is already in merge queue. Please update your PR

kill -TERM $PID_1
kill -TERM $PID_2
wait
wait ||:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait ||: masks any unexpected non-zero exits from background threads, not only the intentional termination after sending SIGTERM. This relaxes the test and can hide real exceptions in thread_insert/thread_select. Please wait on PID_1 and PID_2 explicitly and only ignore expected termination codes.

@alexey-milovidov
alexey-milovidov merged commit 8b20413 into master Mar 11, 2026
160 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix-old-alter-partition-isolation-stress branch March 11, 2026 23:31
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants