-
Notifications
You must be signed in to change notification settings - Fork 590
HDDS-6064. ozone debug ldb should print proper JSON with --with-keys=true
#2917
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@errose28 Please take a look. |
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/DBScanner.java
Outdated
Show resolved
Hide resolved
errose28
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this command @sky76093016. I've often felt the existing implementation had some issues so hopefully we can get it fixed up here. I think the exit criteria here should be that the command always prints valid json to stdout.
Here's some items I think we can cover:
-
Modify TestOmDBCli to send all stdout to a different stream, and read this into gson to test that it is valid json.
- See
TestOzoneShellHAfor an example of a test that does this kind of redirection. - The test data is not large, so having it all in memory in gson at once for the test should be ok.
- See
-
Send all DBScanner scanner output that isn't json (like the 'added definition ...' output) to stderr.
- TBH I'm not sure why this was added in HDDS-4595 but it looks pretty deliberate so I think separating it from the json to stderr is a good compromise.
- I think if we log this instead of directly printing it, it will go to stderr by default, but try it out to see.
Of note, although making json by mixing library code like gson with manual string concatenation is usually bad, it's used here because the json size could be huge in a real DB, and we don't want that in memory. I think having a test for valid json output from the command will let us do this without errors.
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/DBScanner.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/DBScanner.java
Outdated
Show resolved
Hide resolved
|
Hi @adoroszlai thanks for picking this back up. I think this patch needs some more work. Changing Some additional fixes are still outstanding as well:
|
|
@errose28 Can you please take a look at the updated patch? |
|
Need to rebase this one. Not working on a recent OM DB: while the ldb tool compiled from latest master works: |
|
With the container V3 support in |
What changes were proposed in this pull request?
Use
--with-keys=trueto print the proper JSON.What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-6064
How was this patch tested?
docker-composetest