GeorgeJahad commented on code in PR #3729:
URL: https://github.com/apache/ozone/pull/3729#discussion_r975899544
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/OmUtils.java:
##########
@@ -812,4 +813,9 @@ public static String
getOMAddressListPrintString(List<OMNodeDetails> omList) {
printString.append("]");
return printString.toString();
}
+
+ // Key points to entire bucket's snapshot
+ public static boolean isBucketSnapshotIndicator(String key) {
+ return key.startsWith(OM_SNAPSHOT_INDICATOR) && key.split("/").length == 2;
Review Comment:
The OzoneBucket.listKeys() method has a keyPrefix parameter. The parameter
can be null/empty, and invoked like so:
```
bucket.listKeys("");
```
If that paramter is null or empty, it is not supposed to be included in the
listKeys result. [This is how the code looked prior to me adding snapshot
reads](https://github.com/apache/ozone/blob/master/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneBucket.java#L1370-L1375)
The isBucketSnapshotIndicator() method tests to see if we have the snapshot
equivalent of an empty keyPrefix. The indicator looks like so:
".snapshot/snapshot1", so the empty listKeys() invocation for snapshots would
look like:
```
bucket.listKeys(".snapshot/snapshot1");
```
WRT "sanitizing", I was not concerned about extra "/"'s at the end of the
string, because the code doesn't sanitize the empty string "". Is that a
reasonable assumption?
--
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]