[ https://issues.apache.org/jira/browse/KAFKA-12958?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17370679#comment-17370679 ]
Jose Armando Garcia Sancio commented on KAFKA-12958: ---------------------------------------------------- Thanks [~zhaohaidao] . I'll try to take a look at your PR today. Not sure if this is what is happening but the `KafkaRaftClient` may have multiple registered `RaftClient.Listener`. If some of them have not been notify of their leadership through `handleLeaderChange` it is okay for them to see calls to `handleSnapshot`. > Add simulation invariant for leadership and snapshot > ---------------------------------------------------- > > Key: KAFKA-12958 > URL: https://issues.apache.org/jira/browse/KAFKA-12958 > Project: Kafka > Issue Type: Sub-task > Reporter: Jose Armando Garcia Sancio > Assignee: HaiyuanZhao > Priority: Major > Attachments: image-2021-06-27-02-09-25-296.png, > image-2021-06-27-02-15-23-760.png, image-2021-06-27-02-26-48-368.png, > image-2021-06-27-02-27-41-966.png > > > During the simulation we should add an invariant that notified leaders are > never asked to load snapshots. The state machine always sees the following > sequence of callback calls: > Leaders see: > ... > handleLeaderChange state machine is notify of leadership > handleSnapshot is never called > Non-leader see: > ... > handleLeaderChange state machine is notify that is not leader > handleSnapshot is called 0 or more times -- This message was sent by Atlassian Jira (v8.3.4#803005)