[
https://issues.apache.org/jira/browse/RATIS-244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16487847#comment-16487847
]
ASF GitHub Bot commented on RATIS-244:
--------------------------------------
Github user andy2git commented on a diff in the pull request:
https://github.com/apache/incubator-ratis/pull/2#discussion_r190361776
--- Diff:
ratis-server/src/main/java/org/apache/ratis/statemachine/impl/SimpleStateMachineStorage.java
---
@@ -104,7 +104,7 @@ public SingleFileSnapshotInfo findLatestSnapshot()
throws IOException {
Files.newDirectoryStream(smDir.toPath())) {
for (Path path : stream) {
Matcher matcher =
SNAPSHOT_REGEX.matcher(path.getFileName().toString());
- if (matcher.matches()) {
+ if (matcher.matches() &&
MD5FileUtil.existDigestFile(path.toFile())) {
--- End diff --
One concern I have is: do we need to delete the maybe corrupted snapshot
file? If we do not purge logs, we can always replay from the commit logs.
> 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)