Skip to content

Fix flaky test_kafka_formats_with_broken_message integration test - #100286

Merged
alexey-milovidov merged 1 commit into
masterfrom
fix-kafka-broken-message-flaky-test
Mar 21, 2026
Merged

alexey-milovidov merged 1 commit into
masterfrom
fix-kafka-broken-message-flaky-test

Conversation

@alexey-milovidov

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

Copy link
Copy Markdown
Member

Fix flaky test_kafka_formats_with_broken_message by waiting for the error row to appear in the materialized view before querying it.

The test waited for data rows via query_with_retry, but then queried kafka_errors_*_mv directly without retry. If the error row hadn't been flushed yet, the query returned an empty string, causing json.loads("") to throw JSONDecodeError.

https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=100115&sha=bc88afbf7346646c37befae5ead1fe4c906f33e1&name_0=PR&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20db%20disk%2C%20old%20analyzer%2C%201%2F6%29
#100115

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.94

The test was failing with `JSONDecodeError` because it queried
the `kafka_errors_*_mv` materialized view without waiting for
the error row to be flushed. The data rows could already be present
while the error row was still pending.

Use `query_with_retry` to wait for the error row to appear before
parsing the JSON result.

https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=100115&sha=bc88afbf7346646c37befae5ead1fe4c906f33e1&name_0=PR&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20db%20disk%2C%20old%20analyzer%2C%201%2F6%29

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Mar 21, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [da2c394]

Summary: ✅


AI Review

Summary

This PR stabilizes test_kafka_formats_with_broken_message by waiting until the error materialized view returns a non-empty JSONEachRow result before parsing it as JSON. The change is focused, aligns with the flakiness root cause described in the PR, and does not introduce correctness or safety concerns in the modified path.

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: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Mar 21, 2026
@alexey-milovidov alexey-milovidov self-assigned this Mar 21, 2026

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That's reasonable.

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Mar 21, 2026
Merged via the queue into master with commit 383d3d6 Mar 21, 2026
148 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix-kafka-broken-message-flaky-test branch March 21, 2026 17:19
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Mar 21, 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.

2 participants