Skip to content

Fix flaky test 03100_lwu_41_bytes_limits - #123765

Merged
PedroTadim merged 2 commits into
ClickHouse:masterfrom
groeneai:fix-03100-lwu-41-bytes-limits-granularity
Oct 6, 2026
Merged

PedroTadim merged 2 commits into
ClickHouse:masterfrom
groeneai:fix-03100-lwu-41-bytes-limits-granularity

Conversation

@groeneai

@groeneai groeneai commented Oct 3, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #123693

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

Bound the randomized index_granularity and index_granularity_bytes in the test 03100_lwu_41_bytes_limits.

Description

03100_lwu_41_bytes_limits timed out (600 s) in Stateless tests (arm_binary, ParallelReplicas, s3 storage, parallel). The runner's own rerun reproduced it with the same draw and passed 56/56 without randomization.

The MergeTree randomizer drew index_granularity = 1, so the 1,000,000-row insert built a 1,000,000-mark compact part on S3. The final SELECT ... WHERE s = 'foo' then opened one S3 GET per granule (419,437 GETs for 419,428 rows read, 546 s in ReadBufferFromS3::initialize). With max_threads = 1 the parallel-replica followers got no task and died on the 300 s receive timeout.

The test checks max_uncompressed_bytes_in_patches, which does not depend on granularity. This adds -- Random settings limits: index_granularity=(100, None); index_granularity_bytes=(100000, None), in line with the lower bounds the runner already applies to long tests and slow builds (100 rows, 100 KiB; e185707). 18 other tests carry this exact line. Granularity stays randomized above the bounds.

Validation (debug build, local MinIO, the lane's parallel-replicas cluster):

  • The CI draw replayed with fixed settings: timeout at 900 s, 710,928 GETs for 710,905 rows read.
  • Same draw with index_granularity = 100: OK in 26 s (SELECT: 8,984 GETs for 1,000,000 rows).
  • The limits line is applied: with a runner patched to draw granularity 1..50, every CREATE in 20 runs got 100 / 100000. With the line corrupted, the raw draws (5..41) came through.
  • 50/50 randomized runs on S3 with parallel replicas, 50/50 on local disk.

Workflow [PR]
Sync PR [sync-upstream/pr/123765]

Version info

  • Merged into: 26.10.1.1692-master (included in 26.10 and later)

With `index_granularity = 1` the test's 1,000,000-row insert builds a
1,000,000-mark compact part. On S3 the final SELECT then opens one GET per
granule (419,437 GETs for 419,428 rows read in the failing
`Stateless tests (arm_binary, ParallelReplicas, s3 storage, parallel)` run),
and with `max_threads = 1` the parallel-replica followers die on the 300 s
receive timeout, so the test hits the 600 s limit.

The test checks `max_uncompressed_bytes_in_patches`, which does not depend
on granularity. Apply the lower bounds the runner already uses for `long`
tests and slow builds (e185707), keeping both settings randomized
above them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-ci-own-pr PR origin: CI on a groeneai PR exposed a separate defect labels Oct 3, 2026
@groeneai

groeneai commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex; 0 findings) plus my own cold review (2 nits).

# Sev Finding Verdict Evidence / action
1 💡 The description called the clamp "the same" bounds the runner uses for long tests and slow builds; the runner's index_granularity_bytes bound is 102,400, the line uses 100,000 AGREE Wording corrected in the description; the effect is identical in practice
2 💡 On S3, the PREWHERE read of a compact part with 1-row granules issues one GET per granule AGREE, not in scope Only costly at pathological granularity (about 123 granules for this read at the default 8192); not changed here

Severity: ❌ blocker / ⚠️ major / 💡 nit.

Session id: cron:clickhouse-review-slot-8:20261003-204800

@groeneai

groeneai commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. The CI draw replayed on an S3 server with the lane's parallel-replicas cluster times out at 900 s, with the CI signature of one GET per granule (710,928 GETs / 710,905 rows; CI: 419,437 / 419,428).
b Root cause explained? index_granularity = 1 makes a 1,000,000-mark compact part on S3; the final SELECT opens one S3 GET per granule, and with max_threads = 1 the parallel-replica followers die on the 300 s receive timeout.
c Fix matches root cause? Yes. It clamps exactly the two settings that produce the mark count (index_granularity >= 100, index_granularity_bytes >= 100000), in line with the runner's bounds for long tests and slow builds. No blanket no-random-* tag.
d Test intent preserved / new tests added? Yes. The assertions and .reference are unchanged, and both granularity settings stay randomized above the bounds. Test-only fix, so no new test is needed.
e Both directions demonstrated? Yes, same draw: granularity 1 times out, 100 passes in 25.9 s (8,984 GETs). Clamp live: all 40 CREATEs in 20 runs of a runner patched to draw 1..50 got 100 / 100000; a corrupted line let the raw draws through. 50/50 on S3 with parallel replicas, 50/50 on local disk.
f Fix is general across code paths? N/A (test-only). No other 03100_lwu_* test inserts 1M rows with randomized granularity.
g Fix generalizes across inputs (params/datatypes/wrappers)? N/A (test-only). The clamp reaches both the MergeTree and the ReplicatedMergeTree CREATE.
h Backward compatible? (maintainer-approved exception only) N/A: one comment line in a test.
i Invariants and contracts preserved? Under CI randomization, this test never builds a part with more than about 10,000 marks. Verified for both CREATEs.

Session id: cron:clickhouse-impl-slot-41:20261003-195700

@clickhouse-gh

clickhouse-gh Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [dd1088a]

Summary: ✅


AI Review

Summary

This PR makes 03100_lwu_41_bytes_limits robust against pathological random draws by bounding randomized index_granularity and index_granularity_bytes. The new comment is in the format that tests/clickhouse-test parses for .sql tests, so it applies to the whole file, including both CREATE TABLE variants. It also preserves the test's contract: max_uncompressed_bytes_in_patches is enforced on the total uncompressed bytes in patch parts, not on mark layout, so constraining granularity removes the S3/parallel-replica timeout mode without weakening the assertion the test is meant to cover. I did not find a correctness, metadata, or testing gap in the current diff, and the Praktika report for PR #123765 is all green.

Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Oct 3, 2026
@groeneai
groeneai requested a review from alesapin October 3, 2026 21:44
@clickhouse-gh clickhouse-gh Bot added the comp-testing Test content only (no production code). label Oct 3, 2026
@groeneai

groeneai commented Oct 4, 2026

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 0f2841c

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Build (amd_fuzzers) / Build ClickHouse not from this PR: the clickhouse_fuzzer link fails with relocation R_X86_64_PC32 out of range against the 2 GiB reach of the small code model; the same job is red on master and on 156 PRs in the last 24h #123738 (external, open)
Mergeable Check, PR rollups, red only because of the row above #123738 (external, open)

The diff is one test file. All checks completed; CIDB has no other FAIL or ERROR on this head.

Session id: cron:our-pr-ci-monitor:20261004-000624

@PedroTadim PedroTadim self-assigned this Oct 6, 2026
@PedroTadim
PedroTadim enabled auto-merge October 6, 2026 13:20
@PedroTadim
PedroTadim added this pull request to the merge queue Oct 6, 2026
Merged via the queue into ClickHouse:master with commit 3d41781 Oct 6, 2026
149 checks passed
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 6, 2026
@clickhouse-gh clickhouse-gh Bot added comp-mutations ALTER UPDATE/DELETE and mutation execution over parts (including lightweight updates/deletes). and removed comp-testing Test content only (no production code). labels Nov 22, 2026
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 comp-mutations ALTER UPDATE/DELETE and mutation execution over parts (including lightweight updates/deletes). groeneai-origin-ci-own-pr PR origin: CI on a groeneai PR exposed a separate defect 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.

3 participants