Skip to content

Shrink 03291_json_big_structure_deserialization fixture to fix tsan/s3 timeout - #110100

Merged
alexey-milovidov merged 2 commits into
ClickHouse:masterfrom
groeneai:flaky-03291-json-big-structure-deser
Aug 1, 2026
Merged

alexey-milovidov merged 2 commits into
ClickHouse:masterfrom
groeneai:flaky-03291-json-big-structure-deser

Conversation

@groeneai

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

03291_json_big_structure_deserialization times out on Stateless tests (amd_tsan, s3 storage, parallel). Latest master FAIL: 2026-07-09, rc=160 TIMEOUT (600s), report https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=8a863a7cc54952795148dcd2eba58fdcd5480ec5&name_0=MasterCI&name_1=Stateless%20tests%20%28amd_tsan%2C%20s3%20storage%2C%20parallel%2C%201%2F2%29

The long/no-flaky-check tags + LZ4 codec pin from #108093 stopped the flaky-check and OOM modes but did not fix the non-flaky-check tsan/s3 600s process timeout: the long tag exempts the 180s TOO_LONG limit, not the 600s process timeout.

Root cause: the 10000-row x 5000-char-key fixture produces a 146 MiB Wide part whose Object structure stream is too slow to deserialize under tsan (~20x) on s3.

Fix: shrink the fixture to 20 rows x 100-char keys. The test is a regression guard for reading a Wide part whose JSON(max_dynamic_paths=0) Object structure stream is read via the MergeTreeReaderStream::getRightOffset is_metadata path (right_mark < marks_count). That coverage comes from max_compress_block_size=128 (which forces the structure stream to have multiple marks), not from the row count. Verified locally: the shrunk fixture is still a Wide part with a 2-mark JSON column (multi-mark structure stream), part is 11 KiB (was 146 MiB), and the test runs in 0.2s (30/30 runs pass with randomization). The heaviness workarounds (long, no-flaky-check) are removed since the fixture is now tiny; the LZ4 codec pin is kept for determinism under server-side codec randomization.

…3 timeout

The 10000-row x 5000-char-key fixture produced a 146 MiB Wide part whose
Object structure stream took 600s to deserialize under tsan/s3, timing out
(FAIL on master 2026-07-09, amd_tsan s3). Shrink to 20 rows x 100-char keys:
still a Wide part with a multi-mark Object structure stream (marks=2, read via
the MergeTreeReaderStream getRightOffset is_metadata path), so the regression
guard is preserved, but the part is 11 KiB and the test runs in 0.2s. The
multi-mark structure stream comes from max_compress_block_size=128, not row
count, so it is unaffected by the shrink. Removes the long/no-flaky-check
heaviness workarounds (obsolete now the fixture is tiny).

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

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Check Result
a Deterministic repro? Yes. Stateless tests (amd_tsan, s3 storage, parallel) FAIL on master 2026-07-09, rc=160 TIMEOUT (600s). Locally the 146 MiB fixture's structure-stream deserialize is the dominant cost.
b Root cause explained? The 10000-row x 5000-char-key fixture builds a 146 MiB Wide part; deserializing its Object structure stream under tsan (~20x) on s3 exceeds the 600s process timeout. long exempts only the 180s TOO_LONG limit, not the 600s process timeout, so #108093 did not cover this mode.
c Fix matches root cause? Yes. Shrinks the oversized fixture (root cause of the timeout) to 20 rows x 100-char keys: part 11 KiB, test 0.2s.
d Test intent preserved? Yes. The regression-guard coverage (Wide part + JSON(max_dynamic_paths=0) Object structure stream read via MergeTreeReaderStream::getRightOffset is_metadata path, right_mark < marks_count) is driven by max_compress_block_size=128, not row count. Verified: shrunk fixture is Wide with a 2-mark JSON column (multi-mark structure stream).
e Demonstrated in both directions? The original 2024 deserialization bug is no longer reproducible on current master (read-pipeline redesign #103234 restructured the structure-stream read); the test is now a structural regression guard. Confirmed the shrunk fixture preserves the same code-path (Wide + multi-mark structure stream) and passes 30/30 with randomization; large fixture times out under tsan/s3.
f Fix is general, not a narrow patch? N/A (test fixture fix, not a code bug).
g Fix generalizes across inputs? N/A (test fixture fix, not a code bug).
h Backward compatible? N/A (test-only change).
i Invariants and contracts preserved? N/A (test-only change).

Session id: cron:clickhouse-worker-slot-5:20260711-161300

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @Avogar — could you review this? It shrinks the 03291_json_big_structure_deserialization fixture (10000x5000-char keys, 146 MiB Wide part) to 20x100-char keys to fix the 600s tsan/s3 timeout, while keeping the regression-guard coverage (Wide part + multi-mark JSON Object structure stream, driven by max_compress_block_size=128, not row count).

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

clickhouse-gh Bot commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [798d229]

Summary: ✅


AI Review

Summary

This PR shrinks 03291_json_big_structure_deserialization from a timeout-prone oversized JSON fixture to a tiny one so it can run in the sanitizer/S3 matrix without the long / no-flaky-check workarounds. I did not find a correctness or coverage regression in the current diff: the test still forces a Wide part, and in the current reader code a tiny part can still reach the JSON metadata-stream getRightOffset path because marks_count includes the final mark. The current Praktika report is fully green, including the amd_tsan, s3 storage shards that motivated the change.

Missing context / blind spots
  • ⚠️ I could not execute the stateless test or inspect the produced marks locally because this checkout has no built clickhouse binary or build_* directory. A local run that confirms the tiny fixture still produces the intended JSON metadata-stream read path would fully close that gap.
Final Verdict

✅ No blocking issues found.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jul 11, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger — 7258551

Every failure below has an owner: a fixing PR (ours 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
Stateless tests (amd_debug, flaky check) infra (port-collision setup transient) #109707 (ours, open)
Mergeable Check / PR rollup of the above owned via #109707

Notes: the amd_debug flaky-check job failed in SETUP, not in the test — a leftover clickhouse-server/keeper from a prior iteration held all ports (Code 1000 e.code()=98 Address already in use, RaftInstance error 125), so wait_ready timed out and the job exited before 03291_json_big_structure_deserialization ever ran. On every config where the changed test actually executed it PASSED (Fast test 140ms; amd_asan_ubsan distributed 1790ms; amd_asan_ubsan / amd_msan / amd_tsan flaky checks all OK), and the target Stateless tests (amd_tsan, s3 storage, parallel) job the shrink fixes is green. The port-collision setup transient is exactly what PR #109707 (free leftover server ports before start) addresses; a rerun of the infra-failed job clears it.

Session id: cron:our-pr-ci-monitor:20260712-010000

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger — 798d229

Every failure below has an owner: a fixing PR (ours 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.

All 174 checks completed with no failures.

Check / test Reason Owner / fixing PR
- no failures -

Session id: cron:our-pr-ci-monitor:20260729-053000

@alexey-milovidov alexey-milovidov self-assigned this Aug 1, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Aug 1, 2026
Merged via the queue into ClickHouse:master with commit e64cd85 Aug 1, 2026
179 checks passed
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 1, 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 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