Repository navigation
Add more OS sanity checks on server startup - #115725
valerypetrov wants to merge 55 commits into
Conversation
New startup warnings, continuing ClickHouse#18794: CPU scaling governor not set to performance; Linux kernel versions with known bugs (pre-3.2 IPv6 drops, 4.16.0-4.16.3 ext4 corruption, 5.5.0-5.6.12 broken nested epoll_wait); system-wide fs.file-max too low; mdraid RAID 4/5/6 arrays with insufficient stripe cache size. Co-Authored-By: Claude Fable 5 <[email protected]>
Covers corrected ECC errors, CPU thermal throttling, disabled turbo boost, data directory on an overlay filesystem, data directory not on the largest mounted filesystem, missing renameat2 support, and a new check that warns when swap is enabled on the host. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01PcH1uX3QLcLes3XfidQqsC
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01PcH1uX3QLcLes3XfidQqsC
|
Workflow [PR], commit [ee94028] Summary: ✅
AI ReviewSummaryThe PR adds advisory OS checks reported through Missing context / blind spots
Final VerdictStatus: ✅ Approve |
supportsAtomicRename() reads the kernel version only; RENAME_EXCHANGE can still fail with EINVAL/ENOSYS on filesystems this check never looks at.
One unreadable cpufreq/EDAC/thermal leaf suppressed the whole warning class; each read is now caught on its own. Overlay is not always a container's writable layer, so the data-loss sentence is conditional.
One unreadable /sys/block/md*/md/ leaf still aborted the whole block, hiding the resync, degraded and stripe-cache warnings for every later array.
clang-tidy readability-container-contains rejects find() != npos as a membership test.
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes100 object files changed (+153.16 KiB total), 1 added.
716 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units1409 translation units recompiled, 6848 s compile time in total, 1408 of them have a recent master baseline. |
The overlay and largest-filesystem checks probe the server's <path> setting, which is not where table data lives when storage_configuration puts disks elsewhere. Name that directory in both warnings instead of calling it "the data directory", and say that other configured disks are not checked. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01PcH1uX3QLcLes3XfidQqsC
*slow_governors.begin() on an unordered_set picks a hash-order element, so the warning could name an arbitrary slow governor; a plain first_slow_governor string is deterministic and simpler for a single-example value. Also narrow the new per-array try/catch to just the new stripe-cache read: the pre-existing sync_action/array_state reads were unguarded before this PR, and wrapping them too silently changed their behavior (a throw there no longer aborts the whole mdraid scan). Co-Authored-By: Claude Opus 5 <[email protected]>
A throw from the sync_action or array_state read escapes to the outer catch, so one unreadable /sys leaf on md0 suppresses the resync, degraded and stripe-cache warnings for every later array. Widen the per-array try/catch to cover the whole loop body, matching the CPU governor, EDAC and thermal throttle scans. Co-Authored-By: Claude Opus 5 <[email protected]>
The 4.16.0-4.16.3 kernel check raised a global system.warnings alarm from the kernel version alone, so a host running 4.16.2 with ClickHouse on xfs or zfs was told its filesystem might be corrupting data even though ext4 was not in use. Tell the filesystem type of the <path> directory from /proc/self/mounts - picking the longest matching mount point, like the overlay and largest-filesystem scans below do - and keep the warning only when that filesystem actually is ext4. When the type cannot be determined, warn as before rather than going quiet.
|
Update: the 4.16.0–4.16.3 ext4 warning is now gated on a ClickHouse path actually residing on ext4, determined per-path from /proc/self/mounts. When the filesystem type cannot be determined, it warns as before (bd898f8). |
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01PcH1uX3QLcLes3XfidQqsC
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01PcH1uX3QLcLes3XfidQqsC
… disk objects getDisksMap() is lazy and getPath() is ambiguous, but the configured strings are not: every path/metadata_path declared under storage_configuration.disks that exists as a local directory joins <path> in the probe. Defaulted metadata paths live under <path> and share its filesystem, so config-declared paths plus <path> cover the local roots. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01PcH1uX3QLcLes3XfidQqsC
The bit was set when a hit was committed, before `warning_supress_regexp` was evaluated at publish time, so a suppressed ext4 message kept blocking the "filesystem could not be determined" warning although no ext4 warning existed. Tag each recorded message with whether it is an ext4 hit, let `Context::addOrUpdateWarningMessage` report whether it published, and set the bit from a hit that survived suppression - clearing it when a flush suppressed every ext4 hit it carried. Also publish right after the disk selector swap in `Context::updateStorageConfiguration`: those disks are active from there on, so a throw in a later step of the same reload (S3/Azure settings, storage policies) must not delay their warnings. A throw inside `updateFromConfig` itself still discards the staged batch. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01ScfL2iRpXjAYmAMoDLCmqY
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Master now makes `DiskObjectStorage::isRemote` depend on the backend, so a disk over local blob storage with local metadata reports false. The encrypted-disk probe then took the local-disk branch and never checked the blob key prefix, where the encrypted data actually lands. Branch on `DataSourceType::Local` instead, so every object storage delegate reaches the metadata-root and key-prefix probes again. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The old pattern matched both the swap-time and the end-of-reload log lines, so the test still passed if the end-of-reload publish went away. Match the end-of-reload line by its own prefix. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The "ext4 hit beats undetermined" rule was kept in a `published_ext4` flag that could drift from what `system.warnings` actually holds. A flush whose ext4 hits were all suppressed cleared it while an earlier ext4 warning was still stored, and `TRUNCATE system.warnings` never cleared it. A flush also emptied the queue before the flag reflected its ext4 hit, so a concurrent undetermined probe could queue a message that the next flush used to overwrite the real warning. Flushes now run one at a time and read the stored warning first: an undetermined message is skipped while the stored warning, or one published earlier in the same flush, is an ext4 hit. The record-time flag and its bookkeeping are gone. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@groeneai , can you please check the CI logs & prepare fix if necessary? |
|
I checked the CI on c933f2e. The only red is
Merging master into the branch picks up the fix. A plain re-run does not, since it reuses the original merge commit. |
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Master moved FileCache.cpp from base/hex.h to Common/Hex.h; keep that and the branch's warnIfExt4CorruptionKernelBug.h include. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…the ext4 probe of a reused filesystem cache Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ueues The default cache policy is SLRU, and master now rejects a cache whose max_file_segment_size (32 MiB by default) is larger than an SLRU queue. With max_size 1Mi the cache disk failed to load, so both reload tests failed. Use a 100 KiB segment and a 4 KiB boundary alignment. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Context::getOrCreateDisk ran the disk creator without a probe batch, so a disk that recorded the ext4 warning and then failed (for example on an unknown key) left that warning to be published for a disk that never existed. Stage the probe and commit it only after the disk is registered. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The reload integration test only sees probes on a 4.16.0-4.16.3 kernel, so on CI it never recorded anything and could not catch a broken batch, commit, suppression or precedence. The recording part of the probe now takes the filesystem type as input, and a unit test drives it: a committed batch is published, an uncommitted one is dropped, and a later undetermined or suppressed probe keeps an earlier ext4 warning. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Bring the branch up to date with master. Co-Authored-By: Claude Opus 5.5 <[email protected]>
….cpp Master added the same include a few lines below, so after the last merge the file included it twice and clang-tidy (readability-duplicate-include) failed the arm_tidy build. Co-Authored-By: Claude Opus 5.5 <[email protected]>
clang-tidy's modernize-use-nodiscard is an error on master now, and it flags the const getter `stored` of the test fixture. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Part of #18794 (the issue tracks a long list; this implements the remaining feasible items rather than closing it).
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
More OS sanity checks at server startup, reported in
system.warnings: CPU scaling governor not set toperformance, Linux kernel versions with known bugs, low system-widefs.file-max, insufficient mdraid RAID 4/5/6 stripe cache, high corrected ECC error count, CPU thermal throttling events, disabled CPU turbo boost, NUMA zone reclaim, uncorrected ECC errors, THP defragmentation set toalways, data directory on an overlay filesystem, data directory not on the largest mounted filesystem, missingrenameat2support, and enabled swap.Documentation entry for user-facing changes
All checks are advisory warnings in
system.warnings, each read from/proc//sysinside its owntryblock so an unreadable file never affects startup. Added on top of the checks that already existed insanityChecks():performance(from/sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; hosts without cpufreq are skipped).epoll_wait— warned even thoughSettingsQuirksworks around it, as requested in the issue). The blanket "< 5.4 THP" range is deliberately omitted: it would fire for every older-LTS user and overlaps the existing THP check.fs.file-maxbelow 500000.stripe_cache_sizebelow 1024, inside the existing mdraid scan./sys/devices/system/edac/mc/mc*/ce_count(a failing DIMM signal).thermal_throttle/core_throttle_count; the counter is absent on some platforms and then skipped).intel_pstate/no_turboorcpufreq/boost.renameat2unavailable — atomicEXCHANGE TABLESwill not work.vm.zone_reclaim_mode!= 0) — causes severe latency spikes on multi-socket machines; the default and recommended value is 0.edac/mc*/ue_count) — memory contents were corrupted; strictly more serious than the corrected-errors warning.always— causes allocation stalls even when THP itself is only enabled formadvise; skipped when THP is fully disabled./proc/swaps) — new check not on the original list: swap causes severe latency degradation under memory pressure and disabling it is long-standing ClickHouse production guidance.Remaining list items and why they are not here: the ELF code-segment checksum was implemented long ago (#18811); ulimits for files/threads, free memory, overcommit, clock source, THP, readahead, low disk space,
pid_max/threads-maxand mdraid resync/degraded checks already existed; the write-then-read disk self-test proposed in the comments is a refuse-to-start behavior change and does not fit this advisory-warnings PR.test_reload_config_new_disksadds a local, alocal_blob_storageand a cache disk throughSYSTEM RELOAD CONFIGand through the background config reloader, and checks that the reload does not deadlock and runs the step that publishes the new disks' ext4 warnings; the warnings themselves depend on the host's/proc//sysstate, so no test asserts their content.Workflow [PR]
Sync PR [sync-upstream/pr/115725]