Skip to content

ZOOKEEPER-5097: Make DataTree snapshot serialization iterative - #2476

Open
anmolnar wants to merge 1 commit into
apache:masterfrom
anmolnar:ZOOKEEPER-5097
Open

anmolnar wants to merge 1 commit into
apache:masterfrom
anmolnar:ZOOKEEPER-5097

Conversation

@anmolnar

Copy link
Copy Markdown
Contributor

DataTree.serializeNode walked the tree recursively, one frame per znode
level, which does not scale to very deep trees. Rewrite it as an iterative
pre-order traversal over an explicit heap stack, removing the dependency on
tree depth. Traversal order, per-node locking and emitted records are
unchanged, so the on-disk snapshot format is identical. Adds a regression
test that serializes a very deep chain on a small-stack thread and checks it
round-trips.

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

@PDavid PDavid left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks. 👍

Special thanks for adding the test for it.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants