sadanand48 commented on code in PR #5982:
URL: https://github.com/apache/ozone/pull/5982#discussion_r1577742439
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestListKeysWithFSO.java:
##########
@@ -624,27 +726,27 @@ private void checkKeyList(String keyPrefix, String
startKey,
}
LinkedList outputKeysList = new LinkedList(keyLists);
System.out.println("BEGIN:::keyPrefix---> " + keyPrefix + ":::---> " +
- startKey);
+ startKey);
for (String key : keys) {
System.out.println(" " + key);
}
System.out.println("END:::keyPrefix---> " + keyPrefix + ":::---> " +
- startKey);
+ startKey);
assertEquals(keys, outputKeysList);
}
- private void checkKeyList(String keyPrefix, String startKey,
- List<String> keys, OzoneBucket fsoBucket) throws Exception {
- checkKeyList(keyPrefix, startKey, keys, fsoBucket, false);
+ private void checkKeyDeepList(String keyPrefix, String startKey,
+ List<String> keys, OzoneBucket fsoBucket)
throws Exception {
+ checkKeyDeepList(keyPrefix, startKey, keys, fsoBucket, false);
Review Comment:
call the checkKeyList with shallow=false here
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestListKeysWithFSO.java:
##########
@@ -595,26 +697,26 @@ private static List<String> getExpectedKeyList(String
keyPrefix,
return keys;
}
- private static List<String> getExpectedKeyList(String keyPrefix,
- String startKey, OzoneBucket legacyBucket)
- throws Exception {
+ private static List<String> getExpectedKeyDeepList(String keyPrefix,
+ String startKey,
OzoneBucket legacyBucket)
+ throws Exception {
return getExpectedKeyList(keyPrefix, startKey, legacyBucket, false);
}
private static List<String> getExpectedKeyShallowList(String keyPrefix,
- String startKey, OzoneBucket legacyBucket) throws Exception {
+ String startKey,
OzoneBucket legacyBucket) throws Exception {
return getExpectedKeyList(keyPrefix, startKey, legacyBucket, true);
}
- private void checkKeyList(String keyPrefix, String startKey,
- List<String> keys, OzoneBucket fsoBucket, boolean shallow)
- throws Exception {
+ private void checkKeyDeepList(String keyPrefix, String startKey,
Review Comment:
Let's not rename this as it has an option - shallow
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestListKeysWithFSO.java:
##########
@@ -480,10 +488,99 @@ public void testShallowListKeys() throws Exception {
startKey = "a1/b1/c12/c3.tx";
// a1/b1/c1222.tx
expectedKeys =
- getExpectedKeyShallowList(keyPrefix, startKey, legacyOzoneBucket);
+ getExpectedKeyShallowList(keyPrefix, startKey, legacyOzoneBucket);
+ checkKeyShallowList(keyPrefix, startKey, expectedKeys, fsoOzoneBucket);
+
+ keyPrefix = "a1/b1/";
+ startKey = "";
+ // a1/b1/c1222.tx
+ expectedKeys =
+ getExpectedKeyShallowList(keyPrefix, startKey, legacyOzoneBucket);
+ checkKeyShallowList(keyPrefix, startKey, expectedKeys, fsoOzoneBucket);
+
+ keyPrefix = "a1/b1/";
+ startKey = "a1";
+ // a1/b1/c1222.tx
+ expectedKeys =
+ getExpectedKeyShallowList(keyPrefix, startKey, legacyOzoneBucket);
+ checkKeyShallowList(keyPrefix, startKey, expectedKeys, fsoOzoneBucket);
+
+ keyPrefix = "a1/b1/";
+ startKey = "a1/b1";
+ // a1/b1/c1222.tx
+ expectedKeys =
+ getExpectedKeyShallowList(keyPrefix, startKey, legacyOzoneBucket);
checkKeyShallowList(keyPrefix, startKey, expectedKeys, fsoOzoneBucket);
}
+ @Test
+ public void testDeepListKeysWithTrailingSlash() throws Exception {
+ List<String> expectedKeys;
+
+ // Case-1: StartKey is less than prefixKey, return emptyList.
+ String keyPrefix = "a1/b2/";
+ String startKey = "a1";
+ expectedKeys =
+ getExpectedKeyDeepList(keyPrefix, startKey, legacyOzoneBucket);
+ checkKeyDeepList(keyPrefix, startKey, expectedKeys, fsoOzoneBucket);
+
+ // Case-2: StartKey is empty, return all node.
+ keyPrefix = "a1/b2/";
+ startKey = "";
+ expectedKeys =
+ getExpectedKeyDeepList(keyPrefix, startKey, legacyOzoneBucket);
+ checkKeyDeepList(keyPrefix, startKey, expectedKeys, fsoOzoneBucket);
+
+ // Case-3: StartKey is same as prefixKey, return all nodes.
+ keyPrefix = "a1/b2/";
+ startKey = "a1/b2";
+ expectedKeys =
+ getExpectedKeyDeepList(keyPrefix, startKey, legacyOzoneBucket);
+ checkKeyDeepList(keyPrefix, startKey, expectedKeys, fsoOzoneBucket);
+
+ // Case-4: StartKey is greater than prefixKey
+ keyPrefix = "a1/b2/";
+ startKey = "a1/b2/d2/d21.tx";
+ expectedKeys =
+ getExpectedKeyDeepList(keyPrefix, startKey, legacyOzoneBucket);
+ checkKeyDeepList(keyPrefix, startKey, expectedKeys, fsoOzoneBucket);
+
+ // Case-5: StartKey reaches last element, return emptyList
+ keyPrefix = "a1/b2/";
+ startKey = "a1/b2/d3/d31.tx";
+ expectedKeys =
+ getExpectedKeyDeepList(keyPrefix, startKey, legacyOzoneBucket);
+ checkKeyDeepList(keyPrefix, startKey, expectedKeys, fsoOzoneBucket);
+
+// // Case-6: StartKey is invalid (less than last element)
Review Comment:
For legacy bucket - Is the value of ozone.om.fileystem.paths.enabled true?
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestListKeysWithFSO.java:
##########
@@ -654,10 +756,10 @@ private static void createKeys(OzoneBucket ozoneBucket,
List<String> keys)
}
private static void createKey(OzoneBucket ozoneBucket, String key, int
length,
- byte[] input) throws Exception {
+ byte[] input) throws Exception {
Review Comment:
can we maintain the older indentation . I see the patch has many indent
changes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]