[
https://issues.apache.org/jira/browse/RATIS-1909?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tsz-wo Sze resolved RATIS-1909.
-------------------------------
Fix Version/s: 3.0.0
Resolution: Fixed
The pull request is now merged. Thanks, [~anpulu]!
> Fix Decreasing Next Index When GrpcLogAppender Reset Client
> -----------------------------------------------------------
>
> Key: RATIS-1909
> URL: https://issues.apache.org/jira/browse/RATIS-1909
> Project: Ratis
> Issue Type: Bug
> Components: gRPC
> Reporter: Anpu Lu
> Assignee: Anpu Lu
> Priority: Major
> Fix For: 3.0.0
>
> Attachments: 939_review.patch
>
> Time Spent: 1h
> Remaining Estimate: 0h
>
> GrpcLogAppender call `resetClient` when error accors in appending entries.
> In `resetClient`, the new next index `nextIndex` may be match index + 1 when
> `request` is null.
> This will make `getFollower().decreaseNextIndex(nextIndex);` have chance to
> decrease next index to the value of match index, which is against that
> {*}Next index should be larger than match index{*}.
>
> {code:java}
> // GrpcLogAppender.java:resetClient() line 134
> final long nextIndex = 1 + Optional.ofNullable(request)
> .map(AppendEntriesRequest::getPreviousLog)
> .map(TermIndex::getIndex)
> .orElseGet(f::getMatchIndex);
> if (onError && request == null) {
> LOG.warn("{}: Follower failed and request == null, " +
> " keep nextIndex ({}) unchanged and retry.", this, f.getNextIndex());
> return;
> }
> if (request != null && request.isHeartbeat()) {
> return;
> }
> // new next index will be min(old-1, nextIndex)
> getFollower().decreaseNextIndex(nextIndex);{code}
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)