Repository navigation
Fix flaky 03642_system_instrument_multiple_handlers test - #99672
Algunenano merged 4 commits into
Conversation
The test had two issues: 1. The ILIKE filter `%InstrumentationManager%Log%` on the `message` column relied on "InstrumentationManager" appearing in the stack trace text, which is fragile — stack trace symbol resolution varies across builds and the EXIT handler's stack frames may not resolve to include those symbol names. Replaced with `logger_name = 'InstrumentationManager' AND message LIKE 'Log%'` which uses the structured column. 2. Missing ORDER BY caused non-deterministic result ordering. https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=99630&sha=64d0cff0ab4cff3ac550098a39069ded208ab299&name_0=PR&name_1=Stateless%20tests%20%28amd_debug%2C%20distributed%20plan%2C%20s3%20storage%2C%20sequential%29 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
Workflow [PR], commit [19f353b] Summary: ✅ AI ReviewSummaryThis PR reduces flakiness in two stateless tests: one Missing context
ClickHouse Rules
Final Verdict
|
The test `04004_alter_modify_column_ttl_without_type` uses `today()` which makes the test non-deterministic and can cause failures around midnight or in different timezones. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR aims to reduce flakiness in the 03642_system_instrument_multiple_handlers stateless test by making log filtering less environment-dependent and ensuring deterministic result ordering.
Changes:
- Update
03642_system_instrument_multiple_handlers.shto filtersystem.text_logby structuredlogger_name+messageprefix instead of relying on stack-trace text, and add anORDER BY event_time_microseconds. - Adjust test data in
04004_alter_modify_column_ttl_without_type.sqlto use a fixed “valid” date instead oftoday().
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/queries/0_stateless/03642_system_instrument_multiple_handlers.sh | Makes the text_log query more robust (structured filtering) and deterministic (explicit ordering). |
| tests/queries/0_stateless/04004_alter_modify_column_ttl_without_type.sql | Changes inserted “valid” date value from dynamic today() to a fixed date literal. |
| ORDER BY uid; | ||
|
|
||
| INSERT INTO alter_modify_column_ttl_without_type VALUES (1, 'expired', '2000-01-01'), (2, 'valid', today()); | ||
| INSERT INTO alter_modify_column_ttl_without_type VALUES (1, 'expired', '2000-01-01'), (2, 'valid', '2099-01-01'); |
| SYSTEM INSTRUMENT REMOVE ALL; | ||
| SYSTEM FLUSH LOGS system.text_log; | ||
| SELECT extract(message, '.*\): (.+)\nStack trace.*') FROM system.text_log WHERE event_date >= yesterday() AND event_time >= now() - 600 AND query_id = '$query_id' AND message ILIKE '%InstrumentationManager%Log%'; | ||
| SELECT extract(message, '.*\): (.+)\nStack trace.*') FROM system.text_log WHERE event_date >= yesterday() AND event_time >= now() - 600 AND query_id = '$query_id' AND logger_name = 'InstrumentationManager' AND message LIKE 'Log%' ORDER BY event_time_microseconds; |
There was a problem hiding this comment.
👌
this is one of those times I wondered how it even worked before
There was a problem hiding this comment.
I think I was looking for a content of the stack trace that contained both InstrumentationManager and then the Log line to make sure it came from the InstrumentationManager. But it's true that filtering by the logger_name is just simpler.
Fix flaky
03642_system_instrument_multiple_handlerstest.The
message ILIKE '%InstrumentationManager%Log%'filter relied on "InstrumentationManager" appearing in the stack trace text of themessagecolumn. This is fragile because stack trace symbol resolution varies across environments — the EXIT handler's stack frames may not resolve to include those symbol names (e.g., XRay trampoline frames may show as hex addresses). Replaced withlogger_name = 'InstrumentationManager' AND message LIKE 'Log%'which uses the structuredlogger_namecolumn instead.Also added missing
ORDER BY event_time_microseconds— without it the result order was non-deterministic.CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=99630&sha=64d0cff0ab4cff3ac550098a39069ded208ab299&name_0=PR&name_1=Stateless%20tests%20%28amd_debug%2C%20distributed%20plan%2C%20s3%20storage%2C%20sequential%29
#99630
cc @pamarcos
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Documentation entry for user-facing changes
Version info
26.3.1.765