Uploaded image for project: 'Ratis'
  1. Ratis
  2. RATIS-1194

SegmentedRaftLog syncWithSnapshot should not create a new open segment.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 1.1.0
    • 1.1.0
    • None
    • None

    Description

      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.

          @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(),
      

      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.

      Attachments

        Issue Links

          Activity

            People

              avijayan Aravindan Vijayan
              avijayan Aravindan Vijayan
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m