Skip to content

ZOOKEEPER-5037: Add export and import commands to the CLI#2375

Open
ckrumbein wants to merge 3 commits intoapache:masterfrom
ckrumbein:ZOOKEEPER-5037
Open

ZOOKEEPER-5037: Add export and import commands to the CLI#2375
ckrumbein wants to merge 3 commits intoapache:masterfrom
ckrumbein:ZOOKEEPER-5037

Conversation

@ckrumbein
Copy link
Copy Markdown

@ckrumbein ckrumbein commented Apr 21, 2026

This PR adds two commands to the ZooKeeper CLI, export and import:

  • "export <path> <filepath>" downloads the contents of a znode to an external file.
  • "import <path> <filepath>" uploads the contents of an external file to a znode, replacing the znode's previous contents.

My team has been using both of these commands for some time. We are confident they are solid.

Copy link
Copy Markdown
Contributor

@PDavid PDavid left a comment

Choose a reason for hiding this comment

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

Many thanks for this contribution. These commands work really nicely. 👍

Added some minor comments / ideas.

Comment thread zookeeper-server/src/main/java/org/apache/zookeeper/cli/ExportCommand.java Outdated
Comment thread zookeeper-server/src/main/java/org/apache/zookeeper/cli/ExportCommand.java Outdated
Comment thread zookeeper-server/src/main/java/org/apache/zookeeper/cli/ImportCommand.java Outdated
Comment thread zookeeper-docs/src/main/resources/markdown/zookeeperCLI.md Outdated
Comment thread zookeeper-docs/src/main/resources/markdown/zookeeperCLI.md Outdated
Comment thread zookeeper-docs/src/main/resources/markdown/zookeeperCLI.md
@PDavid
Copy link
Copy Markdown
Contributor

PDavid commented Apr 24, 2026

Checkstyle identified some formatting problems in the build:

02:52:13  [INFO] There are 8 errors reported by Checkstyle 8.39 with checkstyle-strict.xml ruleset.
02:52:13  [ERROR] src/main/java/org/apache/zookeeper/cli/ExportCommand.java:[28,1] (imports) ImportOrder: Extra separation in import group before 'java.io.IOException'
02:52:13  [ERROR] src/main/java/org/apache/zookeeper/cli/ExportCommand.java:[28,1] (imports) ImportOrder: Import java.io.IOException appears after other imports that it should precede
02:52:13  [ERROR] src/main/java/org/apache/zookeeper/cli/ExportCommand.java:[79,33] (whitespace) WhitespaceAround: '|' is not followed by whitespace.
02:52:13  [ERROR] src/main/java/org/apache/zookeeper/cli/ExportCommand.java:[79,33] (whitespace) WhitespaceAround: '|' is not preceded with whitespace.
02:52:13  [ERROR] src/main/java/org/apache/zookeeper/cli/ImportCommand.java:[28,1] (imports) ImportOrder: Extra separation in import group before 'java.io.IOException'
02:52:13  [ERROR] src/main/java/org/apache/zookeeper/cli/ImportCommand.java:[28,1] (imports) ImportOrder: Import java.io.IOException appears after other imports that it should precede
02:52:13  [ERROR] src/main/java/org/apache/zookeeper/cli/ImportCommand.java:[90,33] (whitespace) WhitespaceAround: '|' is not followed by whitespace.
02:52:13  [ERROR] src/main/java/org/apache/zookeeper/cli/ImportCommand.java:[90,33] (whitespace) WhitespaceAround: '|' is not preceded with whitespace.

https://ci-hadoop.apache.org/job/zookeeper-precommit-github-pr/job/PR-2375/1/console

@ckrumbein
Copy link
Copy Markdown
Author

PDavid, thanks for your comments. I just incorporated your feedback.

Copy link
Copy Markdown
Contributor

@PDavid PDavid left a comment

Choose a reason for hiding this comment

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

Many thanks for these improvements. Looks good to me. 👍

@ckrumbein
Copy link
Copy Markdown
Author

Sorry, I need some help. This is my first Apache PR, and my changes have been approved. I want to merge this change, but I don't see any merge button. Is it because there are 3 workflows awaiting approval? If so, it says this workflow requires approval from a maintainer.

Copy link
Copy Markdown
Contributor

@anmolnar anmolnar left a comment

Choose a reason for hiding this comment

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

So, basically these commands export and import the data of a single znode to and from a file. Why don't you just add this functionality to get and set commands?

@ckrumbein
Copy link
Copy Markdown
Author

So, basically these commands export and import the data of a single znode to and from a file. Why don't you just add this functionality to get and set commands?

I could have done it that way; after all, I created the export and import commands by copying the get and set commands. However, I was trying to follow the lead of the ZKUI app, which has separate commands for viewing a znode and downloading a znode to a file. It's really just a matter of preference.

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.

3 participants