Skip to content
This repository was archived by the owner on Dec 19, 2017. It is now read-only.
This repository was archived by the owner on Dec 19, 2017. It is now read-only.

Leader election sends LEADER state change event twice #305

@benji

Description

@benji

https://gist.github.com/benji/ea93ac90697f5503f515583be4c7475e

15:25:09.472 [copycat-server-/127.0.0.1:5001-copycat] DEBUG i.a.c.server.state.CandidateState - /127.0.0.1:5001 - Single member cluster. Transitioning directly to leader.
15:25:09.473 [copycat-server-/127.0.0.1:5001-copycat] INFO  i.a.c.server.state.ServerContext - /127.0.0.1:5001 - Transitioning to LEADER
15:25:09.473 [copycat-server-/127.0.0.1:5001-copycat] DEBUG i.a.c.server.state.CandidateState - /127.0.0.1:5001 - Cancelling election
15:25:09.477 [copycat-server-/127.0.0.1:5001-copycat] INFO  i.a.c.server.state.ServerContext - /127.0.0.1:5001 - Found leader /127.0.0.1:5001
15:25:09.478 [copycat-server-/127.0.0.1:5001-copycat] DEBUG i.a.c.s.storage.system.MetaStore - Store vote 0
15:25:09.480 [copycat-server-/127.0.0.1:5001-copycat] DEBUG i.a.copycat.server.state.LeaderState - /127.0.0.1:5001 - Appended InitializeEntry[index=1, term=1, timestamp=1489789509477]
15:25:09.481 [copycat-server-/127.0.0.1:5001-copycat] DEBUG i.a.copycat.server.state.LeaderState - /127.0.0.1:5001 - Appended ConfigurationEntry[index=2, term=1, timestamp=1489789509480, members=[ServerMember[type=ACTIVE, status=AVAILABLE, serverAddress=/127.0.0.1:5001, clientAddress=/127.0.0.1:5001]]]
15:25:09.482 [copycat-server-/127.0.0.1:5001-copycat] DEBUG i.a.c.s.storage.system.MetaStore - Store configuration Configuration[index=2, time=1489789509480, members=[ServerMember[type=ACTIVE, status=AVAILABLE, serverAddress=/127.0.0.1:5001, clientAddress=/127.0.0.1:5001]]]
15:25:09.484 [copycat-server-/127.0.0.1:5001-copycat] DEBUG i.a.c.s.state.ServerStateMachine - /127.0.0.1:5001 - Applying InitializeEntry[index=1, term=1, timestamp=1489789509477]
15:25:09.487 [copycat-server-/127.0.0.1:5001-copycat] DEBUG i.a.copycat.server.state.LeaderState - /127.0.0.1:5001 - Starting append timer
State changed to LEADER
State changed to LEADER
15:25:09.488 [copycat-server-/127.0.0.1:5001-copycat] INFO  i.a.copycat.server.CopycatServer - Server started successfully!

First time callback is invoked through:

at TwoLeaderEvents.lambda$0(TwoLeaderEvents.java:29)
at io.atomix.catalyst.concurrent.Listeners$ListenerHolder.accept(Listeners.java:104)
at io.atomix.copycat.server.state.ServerContext.lambda$23(ServerContext.java:612)
at java.lang.Iterable.forEach(Iterable.java:75)
at io.atomix.copycat.server.state.ServerContext.transition(ServerContext.java:612)
at io.atomix.copycat.server.state.CandidateState.sendVoteRequests(CandidateState.java:106)
at io.atomix.copycat.server.state.CandidateState.startElection(CandidateState.java:65)
at java.util.concurrent.CompletableFuture.uniRun(CompletableFuture.java:705)
at java.util.concurrent.CompletableFuture.uniRunStage(CompletableFuture.java:717)
at java.util.concurrent.CompletableFuture.thenRun(CompletableFuture.java:2010)
at io.atomix.copycat.server.state.CandidateState.open(CandidateState.java:57)
at io.atomix.copycat.server.state.ServerContext.transition(ServerContext.java:607)
at io.atomix.copycat.server.state.FollowerState.sendPollRequests(FollowerState.java:107)
at io.atomix.copycat.server.state.FollowerState.lambda$1(FollowerState.java:86)
at io.atomix.catalyst.concurrent.Runnables.lambda$logFailure$2(Runnables.java:20)

Second time invoked through:

at TwoLeaderEvents.lambda$0(TwoLeaderEvents.java:29)
at io.atomix.catalyst.concurrent.Listeners$ListenerHolder.accept(Listeners.java:104)
at io.atomix.copycat.server.state.ServerContext.lambda$23(ServerContext.java:612)
at java.lang.Iterable.forEach(Iterable.java:75)
at io.atomix.copycat.server.state.ServerContext.transition(ServerContext.java:612)
at io.atomix.copycat.server.state.FollowerState.sendPollRequests(FollowerState.java:107)
at io.atomix.copycat.server.state.FollowerState.lambda$1(FollowerState.java:86)
at io.atomix.catalyst.concurrent.Runnables.lambda$logFailure$2(Runnables.java:20)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions