Skip to content

Add startup warning when mdraid is being resynchronized - #100941

Merged
alexey-milovidov merged 24 commits into
masterfrom
mdraid-resync-warning
Apr 29, 2026
Merged

alexey-milovidov merged 24 commits into
masterfrom
mdraid-resync-warning

Conversation

@alexey-milovidov

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

Copy link
Copy Markdown
Member

Add a startup sanity check that warns when any Linux mdraid array is currently being checked, repaired, or resynchronized, or has a degraded array_state. This can significantly degrade disk I/O performance, or indicate that one or more disks in the array are missing or faulty. It is useful to know about when diagnosing slow queries or merges.

The check iterates over /sys/block/md*/md/sync_action and /sys/block/md*/md/array_state, and warns if the sync action is anything other than idle, or if the array state is not one of active, active-idle, clean, write-pending, readonly, read-auto. The corresponding warnings are exposed in system.warnings as LINUX_MDRAID_IS_BEING_RESYNCHRONIZED and LINUX_MDRAID_IS_DEGRADED, and are cleared automatically when the condition is no longer present.

Changelog category (leave one):

  • Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Add startup warnings (visible in system.warnings) when a Linux mdraid array is being resynchronized or is in a degraded state, as both can affect disk I/O performance or indicate disk failures.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Version info

  • Merged into: 26.5.1.167

@clickhouse-gh

clickhouse-gh Bot commented Mar 27, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [adfe3ef]

Summary: ✅


AI Review

Summary

This PR adds startup detection for Linux mdraid resynchronization activity and non-normal array_state, then surfaces/removes corresponding warnings via system.warnings using new Context::WarningType entries and an overload that accepts optional warning messages. I did not find a new correctness, safety, performance, or compatibility issue in the current patch.

Missing context
  • ⚠️ No CI logs or test-run artifacts were provided in the review input.
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 ✅
No large/binary files ✅
Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label Mar 27, 2026
Comment thread programs/server/Server.cpp Resolved
Comment thread programs/server/Server.cpp Resolved
@azat azat self-assigned this Mar 27, 2026
alexey-milovidov and others added 2 commits March 28, 2026 02:14
…load for `addOrUpdateWarningMessage`

- Check `/sys/block/mdX/md/array_state` in addition to `sync_action` to warn
  when an mdraid array is in a non-normal state (degraded, inactive, etc.)
- Add `addOrUpdateWarningMessage` overload accepting `std::optional<PreformattedMessage>`:
  passing `nullopt` removes the warning, enabling future periodic checks to
  automatically clear stale warnings when conditions resolve.
- New warning type `LINUX_MDRAID_IS_DEGRADED`.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Comment thread programs/server/Server.cpp Resolved
@alexey-milovidov

Copy link
Copy Markdown
Member Author

The Stress test (arm_msan) failure is fixed by #101239, which should be merged first. After it is merged, please update the branch to include the fix.

@alexey-milovidov

Copy link
Copy Markdown
Member Author

The failures of "Flaky check" in "functions_bad_arguments" will be fixed by #101994.

@alexey-milovidov

Copy link
Copy Markdown
Member Author

The flaky test failures in this PR (01605_drop_settings_profile_while_assigned, 01418_custom_settings, 02015_async_inserts_4) are caused by non-unique access entity names and will be resolved by #102131.

fm4v added a commit that referenced this pull request Apr 14, 2026
Split flaky check and targeted check into separate roles:

Flaky check — runs only new/modified tests from the PR with thread
fuzzer enabled. Tests run in parallel with themselves (shared queue)
to ensure new tests are parallel-safe under randomized thread ordering.

Targeted check — runs previously failed and coverage-relevant tests
with per-worker partitioning (--no-self-parallel) so the same test
never runs concurrently on multiple workers, avoiding conflicts on
shared resources (hardcoded users, roles, settings profiles, etc.).
Both use --test-runs 50.

Changes:
- Add --no-self-parallel flag to clickhouse-test: partitions tests
  by name hash so all copies go to the same worker
- Flaky check: only changed tests, thread fuzzer, shared queue
- Targeted check: relevant tests, no thread fuzzer, per-worker queues,
  50 runs, single clickhouse-test invocation
- Restore original thread fuzzer parameters (reverts reductions from
  06c945a and 9790435)
- Add amd_binary to flaky check, use AMD_LARGE for targeted debug
- Targeted check uses --flaky-check --no-self-parallel

PRs affected by tests running in parallel with themselves:
#102015 #101093 #99653 #101503 #101108 #101884 #100746
#101447 #100941 #101099 #100203 #96130

#102038
fm4v added a commit that referenced this pull request Apr 14, 2026
Split flaky check and targeted check into separate roles:

Flaky check — runs only new/modified tests from the PR with thread
fuzzer enabled. Tests can run in parallel with themselves (shared
queue) to ensure new tests are parallel-safe.

Targeted check — runs previously failed and coverage-relevant tests
with per-worker partitioning (--no-self-parallel) so the same test
never runs concurrently on multiple workers, avoiding conflicts on
shared resources (hardcoded users, roles, settings profiles, etc.).
Both use --test-runs 50.

Changes:
- Add --no-self-parallel flag to clickhouse-test: partitions tests
  by name hash so all copies go to the same worker
- Flaky check: only changed tests, thread fuzzer, shared queue
- Targeted check: relevant tests, no thread fuzzer, per-worker
  partitioning, 50 runs, single clickhouse-test invocation
- Restore original thread fuzzer parameters
- Change targeted check to arm_asan_ubsan on ARM_LARGE

PRs affected by tests running in parallel with themselves:
#102015 #101093 #99653 #101503 #101108 #101884 #100746
#101447 #100941 #101099 #100203 #96130
Comment thread src/Interpreters/Context.h Resolved
@alexey-milovidov

Copy link
Copy Markdown
Member Author

@groeneai, fix this BuzzHouse finding and send a separate PR.

@alexey-milovidov

Copy link
Copy Markdown
Member Author

@groeneai, fix test_keeper_zookeeper_converter/test.py::test_acls[True] and send a separate PR.

@alexey-milovidov

Copy link
Copy Markdown
Member Author

@groeneai, investigate the deadlock found in the Stress test, fix it and send a separate PR.

@groeneai

Copy link
Copy Markdown
Collaborator

@alexey-milovidov Investigation summary on the stress-test deadlock:

Specific PR #100941 hits. Two old hung-check failures appeared in CIDB on this PR's CI runs back on March 29-30 (Stress test (amd_debug) at sha 9b5c05a and Stress test (arm_asan_ubsan) at sha ab2a4bb). The latest commit (64267075...) ran clean on every stress-test variant (15+ subjobs OK on April 25). So those two specific entries don't reproduce on the current branch — they were transient hits of the chronic umbrella.

Chronic umbrella. "Hung check failed, possible deadlock found" has 473 entries / 30d (98 master, 256 distinct PRs, 26 distinct check variants). It is an umbrella of multiple independent deadlock paths (the hung check itself only reports the failure mode, not which root cause triggered it).

Why we cannot identify the root cause from CIDB. ci/jobs/scripts/stress/stress.py writes the captured processlist and thread stacktraces from clickhouse-test --hung-check --capture-client-stacktrace into hung_check.log, then deletes that file on the failure path:

if res != 0 and have_long_running_queries:
    ...
    with open(args.output_folder / "test_results.tsv", "w+") as results:
        results.write(hung_check_status)
        hung_check_log.unlink()  # ← evidence destroyed

So every "Hung check failed" row in CIDB has an empty test_context_raw, and the artifact upload picks up nothing useful — investigators can see the symptom but not the stuck threads, mutexes, or processors.

Fix PR. I opened #103551 to (1) keep the log on disk so it survives into the artifact upload, and (2) embed the last 32 KiB (processlist + stacktraces are at the end) into the 4th column of test_results.tsv so CIDB queries on test_context_raw will start returning the diagnostic content. Self-review against the validation gate and round-trip encode/decode test are posted on that PR.

Once #103551 is merged, the next "Hung check failed" master/PR hit will give us the actual stack traces, and we'll be able to file targeted fix PRs per deadlock pattern. Tracking task: 2026-04-01-ci-hung-check-deadlock-chronic-trunk-issue on our side already documents the existing investigation barrier.

github-merge-queue Bot pushed a commit that referenced this pull request Apr 27, 2026
When the stress-test hung check detects long-running queries after the
test run, `clickhouse-test --hung-check --capture-client-stacktrace`
collects the processlist and gdb backtraces from every server process
into `hung_check.log`. This is the primary diagnostic evidence for any
deadlock.

`stress.py` was deleting that log on the failure path
(`hung_check_log.unlink()`), leaving only the bare row
`Hung check failed, possible deadlock found\tFAIL\t\\N\t` in
`test_results.tsv`. As a result, every "Hung check failed" entry in
CIDB has an empty `test_context_raw`, and the artifact upload picks
up nothing useful — investigators have no way to tell which
mutex/condvar/processor was stuck.

This change keeps the log on disk so the artifact upload includes it,
and additionally embeds the last 32 KiB of the captured output as the
4th column of `test_results.tsv`. The tail is the relevant region
(processlist + thread stacktraces print at the end). Encoding mirrors
the decoder in `read_test_results` (tabs and newlines escaped). The
behavior on the success branch is unchanged.

Requested by @alexey-milovidov on
#100941

Session: cron:clickhouse-ci-task-worker:20260426-121500

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

Copy link
Copy Markdown
Collaborator

@alexey-milovidov done — opened #103600 for the test_keeper_zookeeper_converter::test_acls[True] directive.

Note that since #102492 merged on 2026-04-19 the test has been clean (~27,000 runs, 0 failures over 8 days). The pre-#102492 chronic mode was zkServer.sh stop not waiting for the JVM and the broken pgrep regex; both are addressed there. #103600 is a proactive SIGKILL fallback after the 60s SIGTERM wait, since zkServer.sh upstream itself has no fallback and sanitizer load can push JVM shutdown over the line. Happy to investigate a different mode if you have a recent failing run in mind.

@clickhouse-gh

clickhouse-gh Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.00% 84.00% +0.00%
Functions 91.10% 91.10% +0.00%
Branches 76.60% 76.50% -0.10%

Changed lines: 48.78% (20/41) | lost baseline coverage: 3 line(s) · Uncovered code

Full report · Diff report

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Apr 29, 2026
Merged via the queue into master with commit 04379f3 Apr 29, 2026
325 of 326 checks passed
@alexey-milovidov
alexey-milovidov deleted the mdraid-resync-warning branch April 29, 2026 13:06
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Apr 29, 2026
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
Split flaky check and targeted check into separate roles:

Flaky check — runs only new/modified tests from the PR with thread
fuzzer enabled. Tests run in parallel with themselves (shared queue)
to ensure new tests are parallel-safe under randomized thread ordering.

Targeted check — runs previously failed and coverage-relevant tests
with per-worker partitioning (--no-self-parallel) so the same test
never runs concurrently on multiple workers, avoiding conflicts on
shared resources (hardcoded users, roles, settings profiles, etc.).
Both use --test-runs 50.

Changes:
- Add --no-self-parallel flag to clickhouse-test: partitions tests
  by name hash so all copies go to the same worker
- Flaky check: only changed tests, thread fuzzer, shared queue
- Targeted check: relevant tests, no thread fuzzer, per-worker queues,
  50 runs, single clickhouse-test invocation
- Restore original thread fuzzer parameters (reverts reductions from
  06c945a and 9790435)
- Add amd_binary to flaky check, use AMD_LARGE for targeted debug
- Targeted check uses --flaky-check --no-self-parallel

PRs affected by tests running in parallel with themselves:
ClickHouse#102015 ClickHouse#101093 ClickHouse#99653 ClickHouse#101503 ClickHouse#101108 ClickHouse#101884 ClickHouse#100746
ClickHouse#101447 ClickHouse#100941 ClickHouse#101099 ClickHouse#100203 ClickHouse#96130

ClickHouse#102038
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-improvement Pull request with some product improvements 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.

4 participants