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

Attila Doroszlai updated RATIS-1194:
------------------------------------
    Fix Version/s: 2.0.0
                       (was: 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: 1.1.0
>            Reporter: Aravindan Vijayan
>            Assignee: Aravindan Vijayan
>            Priority: Critical
>             Fix For: 2.0.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.20.7#820007)

Reply via email to