Skip to content

Fix flaky test 02813_starting_in_text_log under TSan - #100566

Closed
alexey-milovidov wants to merge 7 commits into
masterfrom
fix-02813-text-log-tsan
Closed

alexey-milovidov wants to merge 7 commits into
masterfrom
fix-02813-text-log-tsan

Conversation

@alexey-milovidov

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

Copy link
Copy Markdown
Member

The test scans system.text_log which can be very large. Under TSan with randomized max_threads 1, the query is estimated to exceed the default max_execution_time of 600 seconds, causing a TOO_SLOW exception. Disable the execution time limit for this query.

Fixes #100525

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=100410&sha=a0736de7dab173981f7d5bb43db1e8d909b50d13&name_0=PR&name_1=Stateless%20tests%20%28amd_tsan%2C%20s3%20storage%2C%20parallel%2C%202%2F2%29
#100410

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)

The test scans `system.text_log` which can be very large. Under TSan
with randomized `max_threads 1`, the query is estimated to exceed the
default `max_execution_time` of 600 seconds, causing a `TOO_SLOW`
exception. Disable the execution time limit for this query.

https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=100410&sha=a0736de7dab173981f7d5bb43db1e8d909b50d13&name_0=PR&name_1=Stateless%20tests%20%28amd_tsan%2C%20s3%20storage%2C%20parallel%2C%202%2F2%29

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

clickhouse-gh Bot commented Mar 24, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [784b876]

Summary: ❌

job_name test_name status info comment
Integration tests (amd_llvm_coverage, 2/5) failure
test_overcommit_tracker/test.py::test_user_overcommit FAIL cidb
Stress test (arm_tsan) failure
Logical error: Shard number is greater than shard count: shard_num=A shard_count=B cluster=C (STID: 5066-457d) FAIL cidb
Stress test (arm_msan) failure
MemorySanitizer: use-of-uninitialized-value (STID: 1003-358c) FAIL cidb

AI Review

Summary

This PR narrows system.text_log scanning in tests/queries/0_stateless/02813_starting_in_text_log.sql and disables the query time limit for this specific test query to avoid TOO_SLOW under TSan. I did not find correctness, safety, or maintainability issues in the change; the scope is minimal and aligned with the stated flaky-test fix.

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 24, 2026
@Algunenano Algunenano self-assigned this Mar 24, 2026

@Algunenano Algunenano left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The query looks really suboptimal and it's not doing what's supposed to be doing:

  • The filter matches itself, so if you execute the query once it will find itself and pass the test.
  • It reads a huge amount of rows, but it only needs to find the single entry at the startup; LIMIT 1 would be enough.
  • We could even narrow it down using uptime +- 10 minutes.

@Algunenano

Copy link
Copy Markdown
Member

Fixing it in #100724

alexey-milovidov and others added 6 commits March 28, 2026 16:33
Use `LIMIT 1` instead of `count()` to avoid scanning the entire table.
Narrow the time range using `uptime` to find the startup message near
the actual server start, avoiding false matches from the query itself.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Use a ±10 minute window around startup time instead of an open-ended
lower bound, and filter by `logger_name = 'Application'` to avoid
matching unrelated log entries. This makes the query much more
efficient and precise.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky test: 02813_starting_in_text_log

2 participants