Skip to content

Backport the recursive snapshot summary tool - #151

Open
arkmish wants to merge 3 commits into
branch-3.6from
armishra/zk-snapshot-summary
Open

arkmish wants to merge 3 commits into
branch-3.6from
armishra/zk-snapshot-summary

Conversation

@arkmish

@arkmish arkmish commented Sep 28, 2026 •

Copy link
Copy Markdown

Description

Add an offline subtree summary to help operators locate where a saved ZooKeeper snapshot's znodes and payload bytes are concentrated, without dumping node values or scanning a live ensemble.

This adapts Apache ZooKeeper's ZOOKEEPER-4566 implementation, reusing the native snapshot loader and existing CLI conventions.

bin/zkSnapshotRecursiveSummaryToolkit.sh snapshot.1 /app 1
  • Accepts a snapshot file, an existing absolute starting path, and a nonnegative display depth.
  • Reports total descendant count and subtree payload bytes for non-leaf nodes. Payload bytes include the starting node's own data; descendant count excludes the starting node.
  • Uses depth 0 for unlimited output. Depth limits only what is displayed: totals still cover the full subtree.
  • Includes leaf and ephemeral data in the totals, while omitting individual leaf entries from the output.
  • Supports uncompressed, gzip, and snappy snapshots, with explicit errors for invalid paths or corrupt input and both Unix/Windows launchers.

The tool loads the snapshot into memory and reads it without modification. Its output describes the saved snapshot, not a transaction-consistent reconstruction or current live state.

Tests

Validated SnapshotRecursiveSummaryTest, SnapshotComparerTest, and SnapStreamTest using Maven on JDK 11 with Java 8 API targeting:

Tests run: 33, Failures: 0, Errors: 0, Skipped: 0
BUILD SUCCESS

Coverage includes root and subtree selection, leaf behavior, exact byte/count totals, display-depth boundaries, null data, ephemerals, compression, invalid arguments, corruption, and shell launcher execution.

Actual Java 8 VM and Windows launcher execution were not available.

  • Local code review completed

Changes that Break Backward Compatibility (Optional)

None to existing server or client behavior. This adds a read-only command and does not alter snapshot formats or replay transaction logs.

Documentation (Optional)

Updated zookeeper-docs/src/main/resources/markdown/zookeeperTools.md with usage, sample output, depth/counting semantics, and operational limitations.

🤖 Generated with GitHub Copilot CLI

arkmish and others added 2 commits September 28, 2026 12:20
Adapt Apache ZooKeeper ZOOKEEPER-3427 by Michael Han (f90060b) to the existing Java 8 and CLI dependencies. Keep checksummed read-only snapshot loading, native launchers, operator documentation and synthetic CLI tests together.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adapt Apache ZooKeeper ZOOKEEPER-4566 by Szabolcs Bukros (05b2159). Reuse the comparer snapshot loader and fixtures, retaining subtree totals, depth behavior, launchers and CLI regression tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@arkmish arkmish added backport Functionality or fixes backported from a newer upstream version snapshot tooling Offline ZooKeeper snapshot inspection and comparison tools labels Sep 30, 2026
@arkmish
arkmish marked this pull request as ready for review October 7, 2026 16:14
Base automatically changed from armishra/zk-snapshot-comparer to branch-3.6 October 8, 2026 04:23
Preserve the merged comparer and retain the recursive-summary documentation at the overlapping tools section.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Functionality or fixes backported from a newer upstream version snapshot tooling Offline ZooKeeper snapshot inspection and comparison tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant