Hi folks,

I'm not sure if I'm missing something incredibly simple or just going about
this the wrong way...

I've implemented a simple Ratis State Machine (extending BaseStateMachine
as per the examples) in order to write a primary-server selection.

My design is:

* Use Ratis as a high availability data store; I don't care which node is
actually the leader of the Ratis group - they can fight it out, and all my
state machines get messages - that's great
* For my application servers, maybe only 2 of 3 can ever be the primary
server and they share the availability and priority via Ratis messages
* The Ratis state machine picks algorithmically the machine to be my
application primary (based on the enabled, priority and ID fields shared)
* The state machine notifies the rest of my application when it is / is not
the primary server
* The machine should not be able to be primary server if it's not connected
to the Ratis group

I have most of this working, but cannot figure out where to get a
notification / event from Ratis that the peer is not part of the majority
group.

Implementing notifyFollowerSlowness(RoleInfoProto roleInfoProto) and
notifyExtendedNoLeader(RoleInfoProto roleInfoProto), and setting timeouts
in the config, doesn't seem to result in these being called if I start 3
Ratis nodes then shut 2 down. The state machine's reset method also isn't
called (I thought it might if it was no longer part of a quorum, and then
reinitialise might be called when it rejoined).

Should I be able to see the disconnection of my state machine somewhere so
I can trigger an event or is this just the wrong approach to take?  Is
there a leader election example anywhere to demonstrate this?

Thanks in advance,
Gordon

Reply via email to