You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by "Attila Doroszlai (Jira)" <ji...@apache.org> on 2023/04/27 18:15:00 UTC

[jira] [Updated] (RATIS-1838) Compare commit index with last included index when installSnapshot

     [ https://issues.apache.org/jira/browse/RATIS-1838?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Attila Doroszlai updated RATIS-1838:
------------------------------------
    Fix Version/s: 2.5.1

> Compare commit index with last included index when installSnapshot
> ------------------------------------------------------------------
>
>                 Key: RATIS-1838
>                 URL: https://issues.apache.org/jira/browse/RATIS-1838
>             Project: Ratis
>          Issue Type: Bug
>          Components: snapshot
>    Affects Versions: 2.5.0
>            Reporter: Song Ziyang
>            Assignee: Song Ziyang
>            Priority: Major
>             Fix For: 3.0.0, 2.5.1
>
>         Attachments: image-2023-04-25-22-10-01-209.png
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> Original summary: java.lang.IllegalStateException thrown when nextIndex in follower is inconsistent with leader's snapshot
> h3. 1. Error Stack
> !image-2023-04-25-22-10-01-209.png!
>  
> The reason: The leader sets follower's nextIndex to 0 in [https://github.com/apache/ratis/blob/60587b63a4401cc6160907d33fb5cd89dbbdc724/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcLogAppender.java#L134] and then sends a snapshot to the follower.
> The SnapshotInstallationHandler in follower asserts it's a stale snapshot and throws a unrecoverable IllegalStatementException.
>  
> h3. ISSUE 1
> The assertions should compare snapshot last included with *commit index* rather that next index. [https://github.com/apache/ratis/blob/60587b63a4401cc6160907d33fb5cd89dbbdc724/ratis-server/src/main/java/org/apache/ratis/server/impl/SnapshotInstallationHandler.java#L177-L179] 
>  
> h3. ISSUE 2
> When a follower receives a stale snapshot from leader, rather than throwing a IlleaglStatementException in assert, can we just simply reply ALREADY_INSTALLED?
>  
> h3. ISSUE 3
> When appendEntriesHandler onError is called, shall we remain the nextIndex unchanged? [https://github.com/apache/ratis/blob/60587b63a4401cc6160907d33fb5cd89dbbdc724/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcLogAppender.java#L420] 
> onError only happens when grpc connections has something wrong (channel disconnected, timeout, etc) and the leader receives no reply. I think we can keep nextIndex unchanged and retry. When the communications are restored, let onNext decide what is the correct nextIndex (may experience INCONSISTENCY). 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)