Skip to content

CI: refresh integration-test duration table for shard balancing - #108555

Merged
maxknv merged 1 commit into
ClickHouse:masterfrom
groeneai:ci-refresh-integration-test-durations
Jun 27, 2026
Merged

maxknv merged 1 commit into
ClickHouse:masterfrom
groeneai:ci-refresh-integration-test-durations

Conversation

@groeneai

@groeneai groeneai commented Jun 25, 2026 •

Copy link
Copy Markdown
Collaborator

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):

...

Description

get_optimal_test_batch (ci/jobs/scripts/integration_tests_configs.py) packs integration-test shards with a deterministic LPT bin-packer keyed on the static RAW_TEST_DURATIONS table. Suites absent from the table get weight 0 and are only round-robin distributed, so the more wall-clock mass the table covers, the better the packer can balance.

The table was last refreshed ~5 months ago (300000ms floor, 129 entries) and had drifted: it covered only 43.5% of integration wall-clock mass, leaving 56% packed duration-blind. That is the source of the chronic batch-level Timeout failures on the heavier Integration tests (... db disk ...) shards (the last split is consistently the heaviest), and it affects every integration config.

This is a pure data refresh, no logic change:

  • Regenerated RAW_TEST_DURATIONS from 14-day amd_asan_ubsan master medians with a 60000ms floor -> 302 entries, 79.8% mass coverage (up from 43.5%).
  • Added a match(test_suite, '^test_[^/]+/.*\.py$') filter to the documented regeneration query so functional-test rows that leak into the Integration tests check_name (e.g. 00024_unused_array_join_in_subquery) are dropped instead of polluting the table.
  • Tightened the comment to explain the regeneration procedure and why broad coverage matters.

Validation (simulated against ground-truth 14-day medians, packer fed only the floored table it actually sees):

table entries mass coverage 4-way db-disk imbalance wall-clock spread
current (300s floor, ~5mo old) 129 43.5% 15.1% 683s
this PR (60s floor) 302 79.8% 5.1% 225s

Output stays deterministic (verified: two runs identical; all real test files assigned exactly once, no loss/duplication). Helps every integration config on every branch; weakens no assertion and touches no release branch.

Version info

  • Merged into: 26.7.1.153 (included in 26.7 and later)

get_optimal_test_batch packs integration shards with an LPT bin-packer
keyed on the static RAW_TEST_DURATIONS table; suites absent from it get
weight 0 and are only round-robin distributed. The table was last
refreshed ~5 months ago (300000ms floor, 129 entries) and had drifted:
it covered only 43.5% of integration wall-clock mass, so 56% was packed
duration-blind.

Regenerate from 14-day master medians with a 60000ms floor (302 entries,
79.8% mass coverage) and add a path filter to drop functional-test rows
that leak into the integration check_name. Measured against ground-truth
durations the 4-way db-disk split imbalance drops from 15.1% to 5.1%
(683s -> 225s wall-clock spread). Pure data refresh, no logic change;
output stays deterministic. Helps every integration config on every branch.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. The regeneration query is reproducible on play.clickhouse.com (re-ran it; output byte-identical, query cache makes medians stable). The imbalance is reproduced deterministically by simulating get_optimal_test_batch against ground-truth 14-day medians: current table = 15.1% imbalance, this PR = 5.1%.
b Root cause explained? Yes. get_optimal_test_batch is an LPT bin-packer keyed on RAW_TEST_DURATIONS; suites absent from the table get weight 0 and are round-robin distributed (duration-blind). The table was last refreshed ~5 months ago at a 300000ms floor (129 entries) and covered only 43.5% of integration wall-clock mass, so 56% of the mass was packed blind, letting heavy suites co-locate and overflow the per-shard budget -> chronic batch Timeout.
c Fix matches root cause? Yes. The defect is the stale/sparse weight table, not the packer logic (the LPT algorithm balances known groups to ~0% imbalance regardless of weights). The fix is exactly a data refresh: lower the floor to 60000ms (302 entries, 79.8% coverage) so the packer can balance the previously-blind mass. No logic change.
d Test intent preserved / new tests added? N/A — this is CI batching infrastructure, no assertion is touched and no test is weakened. The change only affects how test files are distributed across shards; every test still runs.
e Both directions demonstrated? Yes. Same simulation harness, ground-truth measurement: WITHOUT the refresh (current 129-entry table) the 4-way db-disk split imbalance is 15.1% (683s spread); WITH the refresh (302 entries) it is 5.1% (225s spread). Also verified the output is deterministic (two runs identical) and lossless (all 971 real test files assigned exactly once, 0 dups, 0 missing).
f Fix is general across code paths? Yes. TEST_DURATIONS feeds the packer for ALL integration configs (every sanitizer, every analyzer, db-disk and non-db-disk) on all branches — not just the db-disk shard that surfaced the symptom. The added path filter also generalizes the regeneration query so future refreshes stay clean.
g Fix generalizes across inputs? N/A — CI data-table refresh, not a code bug with datatype/wrapper/parameter surface.
h Backward compatible? Yes / N/A — no setting, format, or behavior change. Pure data; deterministic output preserved.
i Invariants and contracts preserved? Yes. The packer's contract (deterministic, same input -> same output across machines; every test assigned to exactly one batch) is preserved — verified explicitly (two identical runs, 971 files, no loss/duplication). Table format (tab-separated test_path\tduration_ms, parsed by _parse_raw_durations) is unchanged; all 302 keys match test_*/...py and parse to positive ints.

Session id: cron:clickhouse-worker-slot-1:20260625-213800

@groeneai

Copy link
Copy Markdown
Collaborator Author

@maxknv could you review? You last refreshed RAW_TEST_DURATIONS (commit 4245209); it had drifted to 43.5% wall-clock coverage. This re-regenerates it at a 60000ms floor (302 entries, 79.8% coverage) plus a path filter to drop functional-test rows leaking into the integration check_name. Pure data, no logic change; simulated 4-way db-disk imbalance drops 15.1% -> 5.1%.

@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Jun 25, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [3d4bfec]

Summary: ✅


AI Review

Summary

This PR refreshes the static integration-test duration table and its documented regeneration query so get_optimal_test_batch has broader weights for shard balancing. I found no actionable correctness, safety, or CI reliability issues in the current change; the local batching check still assigns every current tests/integration/test_*/test*.py file exactly once.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jun 25, 2026
@maxknv
maxknv self-requested a review June 26, 2026 11:16
@maxknv
maxknv added this pull request to the merge queue Jun 27, 2026
Merged via the queue into ClickHouse:master with commit 723d34c Jun 27, 2026
167 checks passed
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jun 27, 2026
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…tion-test-durations

CI: refresh integration-test duration table for shard balancing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors 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