Skip to content

Fix flaky test_keeper_dynamic_log_level: poll for the log level change - #113938

Merged
alexey-milovidov merged 2 commits into
masterfrom
fix/test-keeper-dynamic-log-level-flaky
Aug 9, 2026
Merged

alexey-milovidov merged 2 commits into
masterfrom
fix/test-keeper-dynamic-log-level-flaky

Conversation

@alexey-milovidov

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • CI Fix or improvement (changelog entry is not required)

test_keeper_dynamic_log_level::test_adjust_log_level wrote a new logger config, slept a fixed 3 seconds, and expected the asynchronous config reloader to have already applied the trace level. On slow runs (e.g. MSan) the reload had not happened yet, so the final assertion saw zero <Trace> lines in the log:

https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=91062&sha=5bd33a1f41d843f69d93cb75e2192bb668e61368&name_0=PR&name_1=Integration%20tests%20%28amd_msan%2C%204%2F8%29

The fix polls for up to a minute (re-running the Keeper query each second) until trace logging becomes active, instead of relying on the fixed sleep.

Related: #91062

The test wrote a new logger config, slept a fixed 3 seconds and expected
the asynchronous config reloader to have already applied the `trace`
level, so on slow runs (e.g. MSan) the final assertion saw zero
`<Trace>` lines: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=91062&sha=5bd33a1f41d843f69d93cb75e2192bb668e61368&name_0=PR&name_1=Integration%20tests%20%28amd_msan%2C%204%2F8%29
Related: #91062

Poll for up to a minute until trace logging becomes active instead.
@clickhouse-gh

clickhouse-gh Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [a3d2e56]

Summary: ✅


AI Review

Summary

This PR replaces the fixed time.sleep(3) in test_keeper_dynamic_log_level::test_adjust_log_level with a bounded polling loop that keeps exercising system.zookeeper until the asynchronously reloaded logger.xml takes effect. I did not find a correctness, safety, or coverage issue in the current diff, and the available PR CI is all green.

Final Verdict

✅ No review findings.

@clickhouse-gh

clickhouse-gh Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing a3d2e566b with master fd2595cd4 (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of d134c6da3; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes
Binary Master PR Δ
programs/clickhouse-stripped 690.64 MiB 687.62 MiB -3.02 MiB (-0.44%)

Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction.

Compile time of recompiled translation units

358 translation units recompiled, 362 s compile time in total, 6 of them have a recent master baseline.

Translation units without a recent master baseline:

  • contrib/ai-sdk-cpp-cmake/__/ai-sdk-cpp/src/http/http_request_handler.cpp: 7.6 s
  • contrib/wasmedge-cmake/__/wasmedge/lib/executor/engine/proxy.cpp: 5.9 s
  • contrib/llvm-project-cmake/__/llvm-project/llvm/lib/Analysis/ValueTracking.cpp: 5.8 s
  • contrib/rocksdb-cmake/__/rocksdb/utilities/transactions/lock/point/point_lock_manager.cc: 5.7 s
  • contrib/wasmedge-cmake/__/wasmedge/lib/executor/instantiate/function.cpp: 5.5 s
  • contrib/llvm-project-cmake/__/llvm-project/llvm/lib/Transforms/IPO/FunctionAttrs.cpp: 5.5 s
  • contrib/llvm-project-cmake/__/llvm-project/llvm/utils/TableGen/RegisterInfoEmitter.cpp: 5.3 s
  • contrib/s2geometry-cmake/__/s2geometry/src/s2/s2polygon.cc: 5.3 s
  • contrib/wasmedge-cmake/__/wasmedge/lib/executor/instantiate/tag.cpp: 5.2 s
  • contrib/rocksdb-cmake/__/rocksdb/db/flush_job.cc: 5.2 s

Job report

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

Thanks! The test was laughably bad.

@alexey-milovidov alexey-milovidov self-assigned this Aug 9, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Aug 9, 2026
Merged via the queue into master with commit e5631f9 Aug 9, 2026
180 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix/test-keeper-dynamic-log-level-flaky branch August 9, 2026 19:57
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 9, 2026
alexey-milovidov added a commit that referenced this pull request Aug 10, 2026
…er-dynamic-log-level

Conflict in `tests/integration/test_keeper_dynamic_log_level/test.py`:
master landed an equivalent fix for the same flakiness in
#113938 (commit
`0b51ec04cb06`), which replaces the fixed `time.sleep(3)` with a
hand-rolled 60-attempt polling loop.

Resolved in favour of this branch's version, which keeps the same
polling semantics but is the cleaner form: it reuses the existing
`wait_condition` helper instead of an open-coded loop, extracts
`count_trace_messages` and `query_and_count_trace_messages`, and drops
the host-wide `sync` call (flagged as a Major by the AI review - the
poll and the `grep` run in the same container, so the page cache already
makes the written log lines visible).

So after this merge the branch no longer changes the test's behaviour
relative to master; it only simplifies it.
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