hemantk-12 commented on code in PR #6443:
URL: https://github.com/apache/ozone/pull/6443#discussion_r1539942632


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/response/snapshot/OMSnapshotPurgeResponse.java:
##########
@@ -96,8 +97,9 @@ protected void addToDBBatch(OMMetadataManager 
omMetadataManager,
 
       // Delete Snapshot checkpoint directory.
       deleteCheckpointDirectory(omMetadataManager, snapshotInfo);
-      omMetadataManager.getSnapshotInfoTable().deleteWithBatch(batchOperation,
-          dbKey);
+      omMetadataManager.getSnapshotInfoTable().deleteWithBatch(batchOperation, 
dbKey);
+      ((OmMetadataManagerImpl) omMetadataManager).getSnapshotChainManager()
+          
.deleteSnapshotFromSnapshotIdToTableKey(snapshotInfo.getSnapshotId());

Review Comment:
   First, this is not removing from the chain, it is just removing from the 
reverse mapping of `snapshotId` to `snapshotTableKey` we maintain. 
   Second, you are not completely wrong and it was like this before. But I saw 
some unnecessary error logs and  BackGoundService failures because till the 
double buffer gets flushed BackGoundService which iterates over the table can 
see the purged snapshot (not flushed snapshot) but when the service tries to 
load it, it falls because reverse mapping is not present.
   Hence I extracted out the delete from the `snapshotIdToTableKey` map as a 
separate function.



-- 
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]

Reply via email to