swamirishi commented on code in PR #8690:
URL: https://github.com/apache/ozone/pull/8690#discussion_r2164942038
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmSnapshotManager.java:
##########
@@ -518,19 +518,19 @@ private static void
deleteKeysFromDelDirTableInSnapshotScope(
String bucketName, BatchOperation batchOperation) throws IOException {
// Range delete start key (inclusive)
- final String keyPrefix =
omMetadataManager.getBucketKeyPrefixFSO(volumeName, bucketName);
-
- try (TableIterator<String, ? extends Table.KeyValue<String, OmKeyInfo>>
- iter = omMetadataManager.getDeletedDirTable().iterator(keyPrefix)) {
- performOperationOnKeys(iter,
- entry -> {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Removing key {} from DeletedDirTable",
entry.getKey());
- }
-
omMetadataManager.getDeletedDirTable().deleteWithBatch(batchOperation,
entry.getKey());
- return null;
- });
+ final String startKey =
omMetadataManager.getBucketKeyPrefixFSO(volumeName, bucketName);
+
+ // Range delete end key (exclusive) - we use the next possible ASCII char
after bucket name
+ // Creates the smallest key that is lexicographically larger than the
startKey.
+ final String endKey = startKey + Character.MAX_VALUE;
Review Comment:
This is wrong. Next biggest lexicographically largest value would be
We need to do startKey.subString(0, startKey.length()-1) +
startKey[lastIndexCharacter] + 1
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmSnapshotManager.java:
##########
@@ -518,19 +518,19 @@ private static void
deleteKeysFromDelDirTableInSnapshotScope(
String bucketName, BatchOperation batchOperation) throws IOException {
// Range delete start key (inclusive)
- final String keyPrefix =
omMetadataManager.getBucketKeyPrefixFSO(volumeName, bucketName);
-
- try (TableIterator<String, ? extends Table.KeyValue<String, OmKeyInfo>>
- iter = omMetadataManager.getDeletedDirTable().iterator(keyPrefix)) {
- performOperationOnKeys(iter,
- entry -> {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Removing key {} from DeletedDirTable",
entry.getKey());
- }
-
omMetadataManager.getDeletedDirTable().deleteWithBatch(batchOperation,
entry.getKey());
- return null;
- });
+ final String startKey =
omMetadataManager.getBucketKeyPrefixFSO(volumeName, bucketName);
+
+ // Range delete end key (exclusive) - we use the next possible ASCII char
after bucket name
+ // Creates the smallest key that is lexicographically larger than the
startKey.
+ final String endKey = startKey + Character.MAX_VALUE;
Review Comment:
Please add a test case for the same.
Any deleted key starting with startKey + Character.MAX_VALUE should also be
deleted
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmSnapshotManager.java:
##########
@@ -583,24 +583,23 @@ private static void
deleteKeysFromDelKeyTableInSnapshotScope(
String bucketName, BatchOperation batchOperation) throws IOException {
// Range delete start key (inclusive)
- final String keyPrefix =
+ final String startKey =
omMetadataManager.getBucketKeyPrefix(volumeName, bucketName);
- try (TableIterator<String,
- ? extends Table.KeyValue<String, RepeatedOmKeyInfo>>
- iter = omMetadataManager.getDeletedTable().iterator(keyPrefix)) {
- performOperationOnKeys(iter, entry -> {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Removing key {} from DeletedTable", entry.getKey());
- }
- omMetadataManager.getDeletedTable().deleteWithBatch(batchOperation,
entry.getKey());
- return null;
- });
+ // Range delete end key (exclusive) - we use the next possible ASCII char
after bucket name
+ // Creates the smallest key that is lexicographically larger than the
startKey.
+ final String endKey = startKey + Character.MAX_VALUE;
Review Comment:
same comment as above
--
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]