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

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

Let simply add a local variable raftLogIOException as below.
{code}
@@ -232,11 +234,16 @@ class SegmentedRaftLogWorker implements Runnable {
 
   @Override
   public void run() {
+    RaftLogIOException raftLogIOException = null;
     while (running) {
       try {
         Task task = queue.poll(ONE_SECOND);
         if (task != null) {
           try {
+            if (raftLogIOException != null) {
+              throw raftLogIOException;
+            }
+
             task.execute();
           } catch (IOException e) {
             if (task.getEndIndex() < lastWrittenIndex) {
@@ -244,8 +251,11 @@ class SegmentedRaftLogWorker implements Runnable {
                   + " which is smaller than the lastWrittenIndex."
                   + " There should be a snapshot installed.", e);
             } else {
-              task.getFuture().completeExceptionally(e);
-              throw e;
+              task.failed(e);
+              if (raftLogIOException == null) {
+                raftLogIOException = new RaftLogIOException("Log already 
failed at index " + task.getEndIndex()
+                    + " for " + task, e);
+              }
             }
           }
           task.done();
{code}


> Handle Raft Log Append Failure
> ------------------------------
>
>                 Key: RATIS-573
>                 URL: https://issues.apache.org/jira/browse/RATIS-573
>             Project: Ratis
>          Issue Type: Improvement
>          Components: server
>            Reporter: Supratim Deka
>            Assignee: Supratim Deka
>            Priority: Major
>         Attachments: RATIS-573.00.patch, RATIS-573.01.patch, 
> RATIS-573.02.patch, RATIS-573.03.patch, RATIS-573.04.patch
>
>
> As part of Handling IO Failures, HDDS-1595.
> The scope of this jira is to handle failure in RAFT log append by:
> 1. notify the error to the state machine for consumer specific handling
> 2. propagate the error to the initiator (to the client from leader, to the 
> leader from follower).



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

Reply via email to