adoroszlai commented on code in PR #9084:
URL: https://github.com/apache/ozone/pull/9084#discussion_r2395864230
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMDirectoriesPurgeRequestWithFSO.java:
##########
@@ -252,4 +253,21 @@ public OMClientResponse
validateAndUpdateCache(OzoneManager ozoneManager, Execut
omResponse.build(), purgeRequests,
getBucketLayout(), volBucketInfoMap, fromSnapshotInfo, openKeyInfoMap);
}
+
+ private List<String[]> getBucketLockKeySet(PurgeDirectoriesRequest
purgeDirsRequest) {
+ if (purgeDirsRequest.getBucketNameInfosList().isEmpty()) {
+ return purgeDirsRequest.getBucketNameInfosList().stream()
Review Comment:
Isn't this always an empty stream?
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java:
##########
@@ -544,6 +545,15 @@ public String getBucketKeyPrefixFSO(String volume, String
bucket) throws IOExcep
return getOzoneKeyFSO(volume, bucket, OM_KEY_PREFIX);
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Pair<Long, Long> getVolumeBucketIdPairFSO(String fsoKey) {
+ String[] keySplit = fsoKey.split(OM_KEY_PREFIX);
+ return Pair.of(Long.parseLong(keySplit[1]), Long.parseLong(keySplit[2]));
Review Comment:
Please handle exceptions related to array size and number parsing. Isn't
there some method for parsing FSO keys already?
##########
hadoop-ozone/interface-storage/src/main/java/org/apache/hadoop/ozone/om/OMMetadataManager.java:
##########
@@ -135,6 +136,15 @@ public interface OMMetadataManager extends
DBStoreHAManager, AutoCloseable {
*/
String getBucketKeyPrefixFSO(String volume, String bucket) throws
IOException;
+
+ /**
+ * Retrieves a pair of volume ID and bucket ID associated with the provided
FSO (File System Object) key.
+ *
+ * @param fsoKey the key representing the File System Object, used to
identify the corresponding volume and bucket.
+ * @return a Pair containing the volume ID as the first element and the
bucket ID as the second element.
+ */
+ Pair<Long, Long> getVolumeBucketIdPairFSO(String fsoKey);
Review Comment:
Please try to avoid using class from third-party library in interfaces,
because it may require breaking change to evolve later. Also, `Pair` objects
lose context when being passed around, `getLeft()` is very generic.
Please check if Ozone already has a domain class for volume+bucket ID pair,
and add one if it doesn't.
--
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]