Repository navigation
Improvements to keeper-utils analyze-snapshot - #106270
Conversation
|
Workflow [PR], commit [a5a3411] Summary: ✅
AI ReviewSummaryThe PR streams Keeper snapshots to report richer node statistics, samples, subtree sizes, and memory estimates. The current code addresses the six earlier review findings. No new actionable code findings remain. Missing context / blind spots
Final VerdictStatus: ✅ Approve based on code review and the supplied regression coverage. Integration execution remains subject to CI completion. |
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered by tests: 0/323 (0.00%) | Lost baseline coverage: none · Uncovered code |
Pull request was converted to draft
|
📊 Cloud Performance Report ✅ AI verdict: This PR only rewrites the standalone clickhouse-keeper-utils snapshot-analyzer command (a new SnapshotAnalyzer source plus its CLI options and docs); it does not touch any code the server runs to execute SELECT queries. The two flagged ClickBench improvements (Q4 -15.7%, Q15 -12.3%) therefore cannot be caused by this change and are run-to-run variance, so both have been downgraded to not-sure. No genuine performance impact is expected from this PR. clickbenchFlagged queries (2 of 43)
q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on. tpch_adapted_1_official🟢 No significant changes Debug info
|
1de6a5a to
a3fa217
Compare
…ndling and ordering The previous commit added `TopChildrenTracker` and the `--top-children` option but did not wire them into `analyzeSnapshot`, so the build failed with `-Wmissing-prototypes` (the definition did not match the declaration) and clang-tidy reported the tracker as unused: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=106270&sha=d74d5b7fedcbac408f79a2a316b08d673d2406f7&name_0=PR&name_1=Fast%20test https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=106270&sha=d74d5b7fedcbac408f79a2a316b08d673d2406f7&name_0=PR&name_1=Build%20%28arm_tidy%29 PR: #106270 Also address review comments: - A failure to analyze a single snapshot file now propagates, so the command exits with a non-zero code instead of just printing to stderr. In directory mode the remaining snapshots are still analyzed, but an exception is thrown at the end if any of them failed. - Snapshots in a directory are sorted by the log index parsed from the file name (`getLogIdxFromSnapshotPath`) instead of lexicographically, so `snapshot_10.bin` really comes before `snapshot_9.bin`. - Whether `--snapshot-path` is a file or a directory is decided by `is_directory` instead of the file extension. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Runs `clickhouse keeper-utils snapshot-analyzer` on snapshots written by Keeper in both zstd and `CompressedWriteBuffer` formats, with and without the nodes digest, and checks the printed statistics, the directory mode ordering and the exit code on a broken snapshot. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes3 object files changed (+188.84 KiB total), 1 added.
719 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 units9 translation units recompiled, 22 s compile time in total, 8 of them have a recent master baseline. Translation units without a recent master baseline:
|
|
Dear @antonio2368, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
Changelog category (leave one):
A straightforward mostly-vibecoded (but I have reviewed the code) tool that prints lots of stats about Keeper snapshot contents. Replaces
clickhouse keeper-utils analyze-snapshot, which printed much fewer stats and was picky about input filename format. Existing features are preserved (with-node-statsand the few stats that were previously printed).Switched from using SnapshotManager to custom deserialization code (duplicating SnapshotManager, so it'll need to be kept in sync) to avoid building a whole KeeperStorage in memory. It's simple enough and stable enough that the duplication seems ok.
(The last number 41093.3 MiB is ~20% underestimated, the actual clickhouse RSS was 50 GiB. My guess is that around half of the difference is jemalloc bin rounding, half is non-KeeperStorage memory.)
Some of the prompts:
Please make a minimal tool that reads a Keeper snapshot file and prints stats: number of znodes, number of ephemeral znodes, total znode data size, max znode data size, number of znodes with nonempty data, sum of path lengths, sum of lengths of last components of paths, max number of children, number of znodes with [0, 1, 2, 3, 4, >4] children, acl map size (only if serialization version is new enough that the map is stored separately), number of znodes with nonempty acl list, number of sessions, snapshot uncompressed size, paths and data sizes of 20 znodes chosen uniformly at random. Stream the data in, use O(1) memory, go reasonably fast. Decide whether it's better to reuse the existing deserialization code or duplicate it. Maybe make the tool a keeper-bench mode, maybe find a more appropriate place for it.
Please also print avgs next to totals: path len, path last component len, data len.
Print progress to stderr every 1M nodes.
Don't print number of znodes twice (in "Number of paths" and in stats), don't indent "Stats" an extra level.
Look at KeeperStorage code and make a formula for predicting memory usage (for memory storage, no rocksdb) based on the stats above. Make sure to include e.g. overhead from all the containers (std::list and HashMap in SnapshotableHashTable, CompactChildrenSet's flat_hash_set if >1 child, etc). Print the result and breakdown (e.g. this many bytes of NodeStats, this many bytes of std::list links, this many bytes of flat_hash_set-s, etc) in the tool's output.
Workflow [PR]
Sync PR [sync-upstream/pr/106270]
Version info
26.11.1.343-master(included in26.11and later)