This is an automated email from the ASF dual-hosted git repository.

erose pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new e8ad7ad27a HDDS-11782. ozone debug ldb --with-keys defaults to false 
instead of true (#7521)
e8ad7ad27a is described below

commit e8ad7ad27ac563254951d0d15cb198e0816cc42e
Author: Tejaskriya <[email protected]>
AuthorDate: Thu Dec 5 04:03:06 2024 +0530

    HDDS-11782. ozone debug ldb --with-keys defaults to false instead of true 
(#7521)
---
 .../dist/src/main/smoketest/debug/ozone-debug-ldb.robot        | 10 ++++++++++
 .../main/java/org/apache/hadoop/ozone/debug/ldb/DBScanner.java |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/hadoop-ozone/dist/src/main/smoketest/debug/ozone-debug-ldb.robot 
b/hadoop-ozone/dist/src/main/smoketest/debug/ozone-debug-ldb.robot
index 7157c232d1..0fa43dee6c 100644
--- a/hadoop-ozone/dist/src/main/smoketest/debug/ozone-debug-ldb.robot
+++ b/hadoop-ozone/dist/src/main/smoketest/debug/ozone-debug-ldb.robot
@@ -55,6 +55,16 @@ Test ozone debug ldb scan
                         Should contain          ${output}       testfile1
                         Should contain          ${output}       testfile2
                         Should contain          ${output}       testfile3
+    # test key is included with --with-keys
+    ${output1} =        Execute                 ozone debug ldb 
--db=/data/metadata/om.db scan --cf=keyTable | jq 
'."\/cli-debug-volume\/cli-debug-bucket\/testfile1"'
+    ${output2} =        Execute                 ozone debug ldb 
--db=/data/metadata/om.db scan --cf=keyTable --with-keys | jq 
'."\/cli-debug-volume\/cli-debug-bucket\/testfile1"'
+    ${output3} =        Execute                 ozone debug ldb 
--db=/data/metadata/om.db scan --cf=keyTable --with-keys=true | jq 
'."\/cli-debug-volume\/cli-debug-bucket\/testfile1"'
+                        Should contain          ${output1}      testfile1
+                        Should Be Equal         ${output1}      ${output2}
+                        Should Be Equal         ${output1}      ${output3}
+    # test key is ommitted with --with-keys set to false
+    ${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"'
+                        Should contain          ${output}       Cannot index 
array with string
     # test startkey option
     ${output} =         Execute                 ozone debug ldb 
--db=/data/metadata/om.db scan --cf=keyTable 
--startkey="/cli-debug-volume/cli-debug-bucket/testfile2"
                         Should not contain      ${output}       testfile1
diff --git 
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/ldb/DBScanner.java
 
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/ldb/DBScanner.java
index a2c464194b..95ed0b8be7 100644
--- 
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/ldb/DBScanner.java
+++ 
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/ldb/DBScanner.java
@@ -109,7 +109,7 @@ public class DBScanner implements Callable<Void>, 
SubcommandWithParent {
   @CommandLine.Option(names = {"--with-keys"},
       description = "Print a JSON object of key->value pairs (default)"
           + " instead of a JSON array of only values.",
-      defaultValue = "true")
+      defaultValue = "true", fallbackValue = "true")
   private boolean withKey;
 
   @CommandLine.Option(names = {"--length", "--limit", "-l"},


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to