You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by "Tsz Wo Nicholas Sze (JIRA)" <ji...@apache.org> on 2018/07/20 21:13:00 UTC

[jira] [Commented] (RATIS-243) Add log purge function after taking snapshot

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

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

See also the TODO in SegmentedRaftLog:
{code:java}
@Override
public void syncWithSnapshot(long lastSnapshotIndex) {
  fileLogWorker.syncWithSnapshot(lastSnapshotIndex);
  // TODO purge log files and normal/tmp/corrupt snapshot files
  // if the last index in snapshot is larger than the index of the last
  // log entry, we should delete all the log entries and their cache to avoid
  // gaps between log segments.
}
{code}

> Add log purge function after taking snapshot
> --------------------------------------------
>
>                 Key: RATIS-243
>                 URL: https://issues.apache.org/jira/browse/RATIS-243
>             Project: Ratis
>          Issue Type: Improvement
>          Components: server
>            Reporter: Andy Wu
>            Assignee: Andy Wu
>            Priority: Major
>
> After snapshotting the state machine, we can safely purge logs in the cache and disk.
> Based on the lastAppliedIndex, we can find out which segment the index lands, we can purge all previous segments if leader has no pending RPC on it. We will leave the segment where index lands alone, so we do not need to deal with partial file deletion logic. 
> Also if we only have snapshots, make sure we can install snapshots to the followers. 
>  



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