Skip to content

Commit e8ad7ad

Browse files
authored
HDDS-11782. ozone debug ldb --with-keys defaults to false instead of true (apache#7521)
1 parent cb0a402 commit e8ad7ad

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

hadoop-ozone/dist/src/main/smoketest/debug/ozone-debug-ldb.robot

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,16 @@ Test ozone debug ldb scan
5555
Should contain ${output} testfile1
5656
Should contain ${output} testfile2
5757
Should contain ${output} testfile3
58+
# test key is included with --with-keys
59+
${output1} = Execute ozone debug ldb --db=/data/metadata/om.db scan --cf=keyTable | jq '."\/cli-debug-volume\/cli-debug-bucket\/testfile1"'
60+
${output2} = Execute ozone debug ldb --db=/data/metadata/om.db scan --cf=keyTable --with-keys | jq '."\/cli-debug-volume\/cli-debug-bucket\/testfile1"'
61+
${output3} = Execute ozone debug ldb --db=/data/metadata/om.db scan --cf=keyTable --with-keys=true | jq '."\/cli-debug-volume\/cli-debug-bucket\/testfile1"'
62+
Should contain ${output1} testfile1
63+
Should Be Equal ${output1} ${output2}
64+
Should Be Equal ${output1} ${output3}
65+
# test key is ommitted with --with-keys set to false
66+
${output} = Execute and Ignore Error ozone debug ldb --db=/data/metadata/om.db scan --cf=keyTable --with-keys=false | jq '."\/cli-debug-volume\/cli-debug-bucket\/testfile1"'
67+
Should contain ${output} Cannot index array with string
5868
# test startkey option
5969
${output} = Execute ozone debug ldb --db=/data/metadata/om.db scan --cf=keyTable --startkey="/cli-debug-volume/cli-debug-bucket/testfile2"
6070
Should not contain ${output} testfile1

hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/ldb/DBScanner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public class DBScanner implements Callable<Void>, SubcommandWithParent {
109109
@CommandLine.Option(names = {"--with-keys"},
110110
description = "Print a JSON object of key->value pairs (default)"
111111
+ " instead of a JSON array of only values.",
112-
defaultValue = "true")
112+
defaultValue = "true", fallbackValue = "true")
113113
private boolean withKey;
114114

115115
@CommandLine.Option(names = {"--length", "--limit", "-l"},

0 commit comments

Comments
 (0)