[
https://issues.apache.org/jira/browse/RATIS-559?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16846337#comment-16846337
]
Tsz Wo Nicholas Sze commented on RATIS-559:
-------------------------------------------
There are two steps: (1) read the entries from the log to the buffer and (2)
generate a list of protos from the buffers. The condition is for reserving
half of the time for (2). In the previous code, we may use all the time in (1)
and then use extra time in (2) so that heartbeat/appendEntries may be delayed.
In the worst case, the followers may timeout and start a leader election.
The code in (2) should be updated as below. Will upload a new patch.
{code}
final List<LogEntryProto> protos =
buffer.pollList(getHeartbeatRemainingTime(), EntryWithData::getEntry,
(entry, time, exception) -> LOG.warn("{}: Failed to get {} in {}: {}",
follower.getName(), entry, time, exception));
buffer.clear();
{code}
> LogAppender.getPrevious throws IllegalStateException
> ----------------------------------------------------
>
> Key: RATIS-559
> URL: https://issues.apache.org/jira/browse/RATIS-559
> Project: Ratis
> Issue Type: Bug
> Components: server
> Affects Versions: 0.2.0
> Reporter: Mukul Kumar Singh
> Assignee: Tsz Wo Nicholas Sze
> Priority: Major
> Attachments: r559_20190522.patch
>
>
> GrpcLogAppender#createRequest throws IllegalStateException
> {code}
> 2019-05-19 13:29:29,879 ERROR impl.LogAppender (LogAppender.java:run(90)) -
> org.apache.ratis.server.impl.LogAppender$AppenderDaemon@f7cf7bd unexpected
> exception
> java.lang.IllegalStateException:
> GrpcLogAppender(c04faabb-66d4-4cd0-85c2-412d28ae70e1->bd0ce7cf-56a1-44e8-bf84-3cf5d431c1cf):
> follower's nextIndex = 1 != logStartIndex = 9995
> at
> org.apache.ratis.util.Preconditions.assertTrue(Preconditions.java:63)
> at
> org.apache.ratis.server.impl.LogAppender.getPrevious(LogAppender.java:179)
> at
> org.apache.ratis.server.impl.LogAppender.createRequest(LogAppender.java:186)
> at
> org.apache.ratis.grpc.server.GrpcLogAppender.appendLog(GrpcLogAppender.java:169)
> at
> org.apache.ratis.grpc.server.GrpcLogAppender.runAppenderImpl(GrpcLogAppender.java:113)
> at
> org.apache.ratis.server.impl.LogAppender$AppenderDaemon.run(LogAppender.java:80)
> at java.lang.Thread.run(Thread.java:748)
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)