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

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

> It might be useful to keep the assert in SegmentedRaftLog.Task.done() on line 
> 85, ...

{code}
      Preconditions.assertTrue(completed,
          () -> this + " is already " + 
StringUtils.completableFuture2String(future, false));
{code}
[~sdeka], thanks for the comment.  The assertion above is better.

In the original code below, the future may not done at line 85 below so that it 
can pass the assertion.  But then the future can be completed by another thread 
right between line 85 and line 86.
{code}
85      Preconditions.assertTrue(!future.isDone());
86      future.complete(getEndIndex());
{code}


> appendEntry future should be completed only after the entry is flushed
> ----------------------------------------------------------------------
>
>                 Key: RATIS-595
>                 URL: https://issues.apache.org/jira/browse/RATIS-595
>             Project: Ratis
>          Issue Type: Bug
>          Components: server
>            Reporter: Tsz Wo Nicholas Sze
>            Assignee: Tsz Wo Nicholas Sze
>            Priority: Major
>         Attachments: r595_20190618.patch, r595_20190624.patch
>
>
> This was discovered by [~msingh].  Currently, the appendEntry future complete 
> after the WriteLog task is executed.  However, the entry may not be flushed.



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

Reply via email to