Skip to content

Fix flaky test 03469_json_read_subcolumns_combined_2_compact_merge_tree timeout - #101765

Merged
Avogar merged 3 commits into
ClickHouse:masterfrom
groeneai:fix/03469-json-subcolumns-compact-timeout
Apr 10, 2026
Merged

Avogar merged 3 commits into
ClickHouse:masterfrom
groeneai:fix/03469-json-subcolumns-compact-timeout

Conversation

@groeneai

@groeneai groeneai commented Apr 4, 2026 •

Copy link
Copy Markdown
Collaborator

Add Random settings limits for index_granularity and index_granularity_bytes
to prevent timeout on sanitizer builds.

When CI randomizes very small index_granularity or index_granularity_bytes
values, the compact MergeTree table produces a large number of granules. Reading
80+ JSON subcolumn queries over those granules exceeds the 600s test timeout on
TSAN and ASAN builds. All 3 CI failures (30-day CIDB window) hit exactly 600070ms.

The Random settings limits tag constrains index_granularity >= 100 and
index_granularity_bytes >= 100000, preventing the excessive granule count while
keeping max_threads and all other settings fully randomized — preserving
coverage for parallel reading bugs in JSON subcolumns.

Also normalizes set → SET casing for consistency.

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

...

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Version info

  • Merged into: 26.4.1.804

…ee timeout

Pin max_threads = 2 to prevent timeout on sanitizer builds. With
max_threads=1 (randomized), reading 80+ JSON subcolumn queries over
compact MergeTree exceeds the 600s test timeout on TSAN/ASAN builds
(which add 10-20x overhead). The test takes 200-457s normally and
hits exactly 600070ms with max_threads=1.

The test verifies JSON subcolumn read correctness on compact MergeTree,
not single-threaded performance.
@groeneai

groeneai commented Apr 4, 2026

Copy link
Copy Markdown
Collaborator Author

Pre-PR Validation Gate

Session: cron:clickhouse-ci-task-worker:20260404-141500

a) Deterministic repro?
Yes. All 3 CI failures have max_threads=1 (extracted from test_context_raw). On sanitizer builds where baseline is 200-457s, max_threads=1 pushes past the 600s timeout. All 3 hit exactly 600070ms.

b) Root cause explained?
The test runs 80+ JSON subcolumn queries on compact MergeTree (80K rows, 8 parts). On TSAN/ASAN builds (10-20x overhead), baseline is 200-457s. When max_threads is randomized to 1, all part reads become sequential. The additional overhead (~30-50%) pushes total time past the 600s timeout.

c) Fix matches root cause?
Yes. SET max_threads = 2 directly prevents single-threaded execution. The SET in the SQL file overrides the CLI --max_threads 1 injected by the test runner (verified: getSetting('max_threads') returns 2).

d) Test intent preserved?
Yes. The test checks JSON combined subcolumn read correctness on compact MergeTree (format Null — just correctness, no output comparison). All 80+ queries still run with all other randomized settings. Only max_threads is pinned.

e) Both directions demonstrated?

  • Without fix: 3/3 CI failures at 600070ms with max_threads=1
  • With fix: 20/20 manual runs pass with --max_threads 1 on CLI (SET overrides it), 5/5 via test runner with full randomization

@groeneai

groeneai commented Apr 4, 2026

Copy link
Copy Markdown
Collaborator Author

cc @Avogar — could you review this? It pins max_threads=2 in your 03469 JSON combined subcolumns test (compact MergeTree variant) to prevent timeout on TSAN/ASAN builds when max_threads is randomized to 1.

@Avogar Avogar self-assigned this Apr 7, 2026
@clickhouse-gh

clickhouse-gh Bot commented Apr 7, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [86ee9f6]

Summary: ❌

job_name test_name status info comment
Stateless tests (arm_asan_ubsan, azure, sequential) failure
04031_filelog_drop_mv_no_exception FAIL cidb, issue ISSUE CREATED
Stress test (arm_msan) failure
Server died FAIL cidb, issue ISSUE EXISTS
MemorySanitizer: use-of-uninitialized-value (STID: 1478-2063) FAIL cidb, issue ISSUE EXISTS

AI Review

Summary

This PR updates 03469_json_read_subcolumns_combined_2_compact_merge_tree.sql.j2 but does not actually implement the stated fix of pinning max_threads = 2. As written, the test can still run with randomized max_threads=1, so the 600s timeout risk described in the PR remains.

Findings

❌ Blockers

  • [tests/queries/0_stateless/03469_json_read_subcolumns_combined_2_compact_merge_tree.sql.j2:2] The new Random settings limits comment only constrains index_granularity/index_granularity_bytes, not max_threads. This makes the fix incomplete relative to PR motivation and allows the flaky timeout condition to persist.
    • Suggested fix: add max_threads=(2, 2) to the limits line or add SET max_threads = 2; in the test.
ClickHouse Rules
Item Status Notes
Deletion logging ➖
Serialization versioning ➖
Core-area scrutiny ✅
No test removal ✅
Experimental gate ➖
No magic constants ✅
Backward compatibility ✅
SettingsChangesHistory.cpp ➖
PR metadata quality ✅
Safe rollout ✅
Compilation time ✅
Final Verdict
  • Status: ⚠️ Request changes
  • Minimum required actions:
    • Apply the intended max_threads pinning (max_threads=(2, 2) or SET max_threads = 2;) so the timeout mitigation described by the PR is actually enforced.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Apr 7, 2026
Per @Avogar's review: the timeout is caused by tiny randomized
index_granularity, not by max_threads=1. Keep max_threads randomized
so it can find parallel reading bugs.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@Avogar Avogar added the can be tested Allows running workflows for external contributors label Apr 7, 2026
@Avogar

Avogar commented Apr 10, 2026

Copy link
Copy Markdown
Member

@groeneai update PR description with new changes

@Avogar
Avogar added this pull request to the merge queue Apr 10, 2026
Merged via the queue into ClickHouse:master with commit 121fdd7 Apr 10, 2026
160 of 164 checks passed
@groeneai

Copy link
Copy Markdown
Collaborator Author

Updated PR description to reflect the current approach (Random settings limits for index_granularity/index_granularity_bytes, no max_threads pin).

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.

3 participants