HDDS-9700. Allow ozone admin container info to list multiple containers #5659
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Currently the command:
ozone admin container info 1234
Only accepts a single container ID. If you need to list the details from many containers, then the JVM startup overhead makes the command very slow.
This Jira changes the behavior so you can pass multiple containers at the same time, eg:
Additionally, you can pass the container list over stdin, with 1 containerID per line. To do that, you pass the container id as a dash character:
When passing multiple containers, if a container is not found or is an invalid ID, and error is printed to stdout and the command will continue with the next ID in the list.
If containers are being read from stdin, or multiple IDs are specified on the command list, the JSON output will be an array of objects rather than a series of standalone objects. For a single ID passed, the json output is not an array as it was before to ensure compatibility.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-9700
How was this patch tested?
New and changed unit tests. Also validated output in a docker compose cluster. Sample output:
Reading from stdin:
Similar output for the --json switch.