[ 
https://issues.apache.org/jira/browse/RATIS-244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16488081#comment-16488081
 ] 

Tsz Wo Nicholas Sze commented on RATIS-244:
-------------------------------------------

[~andywu], thanks for working on this. I think it is a good idea to check if 
the md5 file exists.  How about we also verify if the md5 also matches the 
snapshot file?

Some other comments:
- MD5FileUtil.readStoredMd5ForFile(path.toFile()) returns null if the md5 file 
does not exist.  So, the new existDigestFile(..) method probably is not needed.
- It is better to have the unit tests testing SimpleStateMachineStorage.  We 
may change SimpleStateMachineStorage.findLatestSnapshot() to static (just pass 
smDir as a parameter).  Then, we can easily test it.

Please also post your patch on this JIRA so that we can summit it for Jenkins.

> MD5 file might not exist for snapshot file
> ------------------------------------------
>
>                 Key: RATIS-244
>                 URL: https://issues.apache.org/jira/browse/RATIS-244
>             Project: Ratis
>          Issue Type: Bug
>            Reporter: Andy Wu
>            Assignee: Andy Wu
>            Priority: Minor
>
> When we take snapshots, a copy of snapshot file and its MD5 file are 
> persisted on disk. But they are not atomic operation. In some condition, we 
> might have a partial snapshot file persisted on disk. While we need to 
> SimpleStateMachineStorage#findLatestSnapshot(), we should skip the snapshot 
> files without MD5.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to