amaliujia commented on code in PR #11032:
URL: https://github.com/apache/ozone/pull/11032#discussion_r3877562011


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/ContainerStateMachine.java:
##########
@@ -434,6 +437,9 @@ public long takeSnapshot() throws IOException {
             snapshotFile);
         throw ioe;
       }
+      final MD5Hash md5 = MD5FileUtil.computeAndSaveMd5ForFile(snapshotFile);
+      final FileInfo fileInfo = new FileInfo(snapshotFile.toPath(), md5);
+      storage.updateLatestSnapshot(new SingleFileSnapshotInfo(fileInfo, ti));

Review Comment:
   @peterxcli by my understanding to this problem so far:
   
   1. SCM side has never created MD5 files when taking Ratis snapshots.
   2. After Ratis 3.3.0, Ratis will treat snapshots without MD5 as "corrupted" 
and can be ignored. Though in your code link, if there is no snapshot with MD5 
files, then the last "corrupted" snapshot is returned anyway.
   
   From the `SimpleStateMachineStorage.findLatestSnapshot` behavior, it still 
seems to be backward compatible.
   
   Just because I am lack of context over the Ratis snapshot feature, I am not 
sure about the following scenario:
   
   If a Ozone cluster upgrades to the next version with Ratis 3.3.0+, before 
this cluster takes next snapshot with MD5 files (with the fix in this PR), we 
should expect old snapshots of this cluster works functionality, meaning for 
all the SimpleStateMachineStorage operations, they always need to have a 
fallback to deal with one snapshot without MD5 files, if there is no snapshot 
with MD5 files discovered.
   
   I do not know if the above is true or now. Probably need to go over the 
Ratis side's APIs to verify it.
   



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