-
Notifications
You must be signed in to change notification settings - Fork 537
HDDS-11747. Add debug CLI to show full path of keys present in specific containers #7465
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
For the CLI I would propose something like this:
We should also support reading container IDs from stdin to support piping. This gives three ways to get container IDs into the command. IMO we should not make them exclusive and read from all sources to get the final set of container IDs to operate on. At least one container ID must be present from somewhere for the command to succeed.
|
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/KeyPathRetriever.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/KeyPathRetriever.java
Show resolved
Hide resolved
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/KeyPathRetriever.java
Show resolved
Hide resolved
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/KeyPathRetriever.java
Outdated
Show resolved
Hide resolved
...-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneDebugShell.java
Outdated
Show resolved
Hide resolved
@errose28, Would you like to take another look on this? |
Thanks, yes I would like to do another round of review, but have been busy with other tasks and was off for the holiday. I should get to it later this week. |
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/KeyPathRetriever.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/KeyPathRetriever.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/KeyPathRetriever.java
Show resolved
Hide resolved
StringBuilder sb = new StringBuilder(); | ||
key1.getOzoneKeyLocations().forEach(e -> sb.append(e.getContainerID())); | ||
key3.getOzoneKeyLocations().forEach(e -> sb.append(",").append(e.getContainerID())); |
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.
This does not produce the expected output if key1
has more than one location.
String containers = Stream.concat(key1.getOzoneKeyLocations().stream(), key3.getOzoneKeyLocations().stream())
.mapToLong(OzoneKeyLocation::getContainerID)
.mapToObj(String::valueOf)
.collect(Collectors.joining(","));
key1.getOzoneKeyLocations().forEach(e -> sb.append(e.getContainerID())); | ||
key3.getOzoneKeyLocations().forEach(e -> sb.append(",").append(e.getContainerID())); | ||
String dbFile = OMStorage.getOmDbDir(conf).getPath() + "/om.db"; | ||
cmd = new CommandLine(new OzoneDebug()).addSubcommand(new CommandLine(new KeyPathRetriever())).setOut(pstdout); |
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.
Do not add subcommand manually.
cmd = new CommandLine(new OzoneDebug()).addSubcommand(new CommandLine(new KeyPathRetriever())).setOut(pstdout); | |
cmd = new OzoneDebug().getCmd().setOut(pstdout); |
assertThat(stdout.toString()).contains(keyPrefix + "file1").contains(keyPrefix + "file2") | ||
.doesNotContain(keyPrefix + "file3"); |
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.
nit: please wrap.
assertThat(stdout.toString()).contains(keyPrefix + "file1").contains(keyPrefix + "file2") | |
.doesNotContain(keyPrefix + "file3"); | |
assertThat(stdout.toString()) | |
.contains(keyPrefix + "file1") | |
.contains(keyPrefix + "file2") | |
.doesNotContain(keyPrefix + "file3"); |
TestDataUtil.createKey(bucket, "dir1/file2", "test"); | ||
TestDataUtil.createKey(bucket, "dir1/file3", "test"); | ||
OzoneKeyDetails key1 = bucket.getKey("dir1/file1"); | ||
OzoneKeyDetails key3 = bucket.getKey("dir1/file2"); |
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.
nit: key3
vs. file2
is confusing, especially in final assertion, where we expect file2
, but not file3
.
/pending conflicts, review comments |
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.
Marking this issue as un-mergeable as requested.
Please use /ready
comment when it's resolved.
Please note that the PR will be closed after 21 days of inactivity from now. (But can be re-opened anytime later...)
conflicts, review comments
Thank you very much for the patch. I am closing this PR temporarily as there was no activity recently and it is waiting for response from its author. It doesn't mean that this PR is not important or ignored: feel free to reopen the PR at any time. It only means that attention of committers is not required. We prefer to keep the review queue clean. This ensures PRs in need of review are more visible, which results in faster feedback for all PRs. If you need ANY help to finish this PR, please contact the community on the mailing list or the slack channel." |
@errose28 please check and review, after that will handle conflicts and fix other test case review comments. |
@sumitagrawl please reopen if you update the patch, not to ping reviewers |
What changes were proposed in this pull request?
This provide a CLI option to get key full path in FSO case for matching criteria like container. DB will be opened in read-only mode.
ozone debug retrieve-key-fullpath --db=<db path with db name> --containers=<container separated by comma>
ozone debug retrieve-key-fullpath --db=<db path with db name> --container-file=<file having list of container separated by new line>
example:
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-11747
How was this patch tested?