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

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

> ... Would it be simpler to either force only one thread can call it, or just 
> use a dedicated lock instead of using RaftServerImpl lock?

This patch is to enforce that only one thread can call it - runSequentially 
does nothing but only an assertion (asserting only at most one thread at a 
time.)  runSequentially is to prove that moving RaftLog.append(entries) outside 
the RaftServerImpl is correct (otherwise, we will get IllegalStateException.)

Using a lock does not work since if two threads are waiting, the order is not 
guaranteed.

Do you see another way to enforce it?

> In RaftServerImpl, the RaftLog.append(entries) call should not hold the 
> RaftServerImpl lock
> -------------------------------------------------------------------------------------------
>
>                 Key: RATIS-406
>                 URL: https://issues.apache.org/jira/browse/RATIS-406
>             Project: Ratis
>          Issue Type: Improvement
>          Components: server
>            Reporter: Tsz Wo Nicholas Sze
>            Assignee: Tsz Wo Nicholas Sze
>            Priority: Major
>         Attachments: r406_20181109.patch, r406_20181113.patch
>
>
> In RaftServerImpl, the appendEntriesAsync(..) calls must be sequential 
> (although the actual log I/O is async).  Otherwise, the entries appended may 
> be out of order.
> As a result, RaftLog.append(entries) needs not to hold the RaftServerImpl 
> lock.



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

Reply via email to