You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by "runzhiwang (Jira)" <ji...@apache.org> on 2021/02/02 05:59:00 UTC

[jira] [Updated] (RATIS-1194) SegmentedRaftLog syncWithSnapshot should not create a new open segment.

     [ https://issues.apache.org/jira/browse/RATIS-1194?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

runzhiwang updated RATIS-1194:
------------------------------
    Fix Version/s:     (was: 2.0.0)
                   1.1.0

> SegmentedRaftLog syncWithSnapshot should not create a new open segment.
> -----------------------------------------------------------------------
>
>                 Key: RATIS-1194
>                 URL: https://issues.apache.org/jira/browse/RATIS-1194
>             Project: Ratis
>          Issue Type: Bug
>    Affects Versions: 2.0.0
>            Reporter: Aravindan Vijayan
>            Assignee: Aravindan Vijayan
>            Priority: Critical
>             Fix For: 1.1.0
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> In SegmentedRaftLog#syncWithSnapshot, if the snapshot index is the last open segment index, then the open segment is finalized and closed (which releases the SegmentedRaftLogOutputStream). In the next step, while rolling the open segment in the cache, a new open segment is created. However, the output stream has already been closed. This causes the peer to terminate when a transaction comes in after the syncWithSnapshot call.
> {code}
>     @Override
>     public void execute() throws IOException {
>       if (stateMachineDataPolicy.isSync() && stateMachineFuture != null) {
>         stateMachineDataPolicy.getFromFuture(stateMachineFuture, () -> this + "-writeStateMachineData");
>       }
>       raftLogMetrics.onRaftLogAppendEntry();
>       Preconditions.assertTrue(out != null);
>       Preconditions.assertTrue(lastWrittenIndex + 1 == entry.getIndex(),
> {code}
> Instead of creating a new open segment here, we should let any new transaction coming in to the system create a new open segment through the StartOpenSegment call which re-initializes the output stream.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)