From e8ad7ad27ac563254951d0d15cb198e0816cc42e Mon Sep 17 00:00:00 2001 From: Tejaskriya <87555809+Tejaskriya@users.noreply.github.com> Date: Thu, 5 Dec 2024 04:03:06 +0530 Subject: [PATCH] HDDS-11782. ozone debug ldb --with-keys defaults to false instead of true (#7521) --- .../src/main/smoketest/debug/ozone-debug-ldb.robot | 10 ++++++++++ .../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 7157c232d1a..0fa43dee6c0 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 a2c464194b0..95ed0b8be77 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, 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"},