[
https://issues.apache.org/jira/browse/RATIS-1564?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tsz-wo Sze reopened RATIS-1564:
-------------------------------
> Bug: installSnapshot delete() failed
> -------------------------------------
>
> Key: RATIS-1564
> URL: https://issues.apache.org/jira/browse/RATIS-1564
> Project: Ratis
> Issue Type: Bug
> Components: server
> Reporter: Song Ziyang
> Priority: Major
> Attachments: image-2022-04-11-19-51-50-882.png
>
>
> I’ve discovered a bug in installSnapshot RPC handler, causing the follower to
> reply success where it actually failed.
>
> org.apache.ratis.server.storage.SnapshotManager.java, in installSnapshot
> (see attachment)
>
> After the follower receives the entire snapshot data, it will first store the
> file in a tmp dir, then renames to StateMachineDir. {*}However{*}, when the
> StateMachineDir is not empty, delete() will fail, and renamTo() will fail
> too. Under this scenario, the latest snapshot file will remain in tmp dir and
> the statemachine cannot fetch the this snapshot.
>
> The StateMachineDir can be non-empty since the old installed snapshots are
> stored in StateMachineDir and may not be cleaned up due to retention policy,
> next time when leader want to install snapshot again this circumstance will
> appear.
>
>
--
This message was sent by Atlassian Jira
(v8.20.7#820007)