swamirishi commented on code in PR #7200:
URL: https://github.com/apache/ozone/pull/7200#discussion_r1765848280
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/SnapshotDeletingService.java:
##########
@@ -136,316 +134,108 @@ public BackgroundTaskResult call() throws
InterruptedException {
getRunCount().incrementAndGet();
- ReferenceCounted<OmSnapshot> rcOmSnapshot = null;
- ReferenceCounted<OmSnapshot> rcOmPreviousSnapshot = null;
-
- Table<String, SnapshotInfo> snapshotInfoTable =
- ozoneManager.getMetadataManager().getSnapshotInfoTable();
- List<String> purgeSnapshotKeys = new ArrayList<>();
- try (TableIterator<String, ? extends Table.KeyValue
- <String, SnapshotInfo>> iterator = snapshotInfoTable.iterator()) {
-
+ try {
+ int remaining = keyLimitPerTask;
+ Iterator<UUID> iterator = snapshotChainManager.iterator(true);
+ List<SnapshotInfo> snapshotsToBePurged = new ArrayList<>();
long snapshotLimit = snapshotDeletionPerTask;
-
while (iterator.hasNext() && snapshotLimit > 0) {
- SnapshotInfo snapInfo = iterator.next().getValue();
-
- // Only Iterate in deleted snapshot
+ SnapshotInfo snapInfo = SnapshotUtils.getSnapshotInfo(ozoneManager,
snapshotChainManager, iterator.next());
+ // Only Iterate in deleted snapshot & only if all the changes have
been flushed into disk.
Review Comment:
done
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/SnapshotDeletingService.java:
##########
@@ -463,92 +253,36 @@ private void submitSnapshotPurgeRequest(List<String>
purgeSnapshotKeys) {
}
}
- @SuppressWarnings("checkstyle:ParameterNumber")
- private void splitRepeatedOmKeyInfo(SnapshotMoveKeyInfos.Builder toReclaim,
- SnapshotMoveKeyInfos.Builder toNextDb,
- HddsProtos.KeyValue.Builder renamedKey, OmKeyInfo keyInfo,
- Table<String, OmKeyInfo> previousKeyTable,
- Table<String, String> renamedTable,
- OmBucketInfo bucketInfo, long volumeId) throws IOException {
-
- if (isKeyReclaimable(previousKeyTable, renamedTable,
- keyInfo, bucketInfo, volumeId, renamedKey)) {
- // Update in current db's deletedKeyTable
- toReclaim.addKeyInfos(keyInfo
- .getProtobuf(ClientVersion.CURRENT_VERSION));
- } else {
- // Move to next non deleted snapshot's deleted table
- toNextDb.addKeyInfos(keyInfo.getProtobuf(
- ClientVersion.CURRENT_VERSION));
- }
- }
-
- private boolean isDirReclaimable(
- Table.KeyValue<String, OmKeyInfo> deletedDir,
- Table<String, OmDirectoryInfo> previousDirTable,
- Table<String, String> renamedTable,
- List<HddsProtos.KeyValue> renamedList) throws IOException {
-
- if (previousDirTable == null) {
- return true;
- }
-
- String deletedDirDbKey = deletedDir.getKey();
- OmKeyInfo deletedDirInfo = deletedDir.getValue();
- String dbRenameKey = ozoneManager.getMetadataManager().getRenameKey(
- deletedDirInfo.getVolumeName(), deletedDirInfo.getBucketName(),
- deletedDirInfo.getObjectID());
-
- /*
- snapshotRenamedTable: /volumeName/bucketName/objectID ->
- /volumeId/bucketId/parentId/dirName
- */
- String dbKeyBeforeRename = renamedTable.getIfExist(dbRenameKey);
- String prevDbKey = null;
-
- if (dbKeyBeforeRename != null) {
- prevDbKey = dbKeyBeforeRename;
- HddsProtos.KeyValue renamedDir = HddsProtos.KeyValue
- .newBuilder()
- .setKey(dbRenameKey)
- .setValue(dbKeyBeforeRename)
- .build();
- renamedList.add(renamedDir);
- } else {
- // In OMKeyDeleteResponseWithFSO OzonePathKey is converted to
- // OzoneDeletePathKey. Changing it back to check the previous DirTable.
- prevDbKey = ozoneManager.getMetadataManager()
- .getOzoneDeletePathDirKey(deletedDirDbKey);
- }
-
- OmDirectoryInfo prevDirectoryInfo = previousDirTable.get(prevDbKey);
- if (prevDirectoryInfo == null) {
- return true;
- }
-
- return prevDirectoryInfo.getObjectID() != deletedDirInfo.getObjectID();
- }
-
- public void submitSnapshotMoveDeletedKeys(SnapshotInfo snapInfo,
- List<SnapshotMoveKeyInfos> toReclaimList,
- List<SnapshotMoveKeyInfos> toNextDBList,
- List<HddsProtos.KeyValue> renamedList,
- List<String> dirsToMove) throws InterruptedException {
+ private void submitSnapshotMoveDeletedKeys(SnapshotInfo snapInfo,
+ List<SnapshotMoveKeyInfos>
deletedKeys,
+ List<HddsProtos.KeyValue>
renamedList,
+ List<SnapshotMoveKeyInfos>
dirsToMove) {
Review Comment:
done
--
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]