> I end up with two leaders. Is there a way can I force a new term/revote?

It seems that you have two groups instead of one so that there is a leader
per group.  You may check the log to see if they have the same group ID.

setConfiguration is to change the group configuration for an existing
group. Use groupAdd(..) to add a new group.  You may try the following:

1) start node1 with group1 and peers node1
2) use group1 to create client and call setConfiguration(node1, node2)

if (node2 is not yet started)
3) start node2 with group1 and peers node1 and node2

if (node2 is already started)
3) use groupAdd to add group1 and peers node1 and node2 to node2

If you want to start with two groups, you should remove one of them before
merging them.

BTW, please use an odd number of servers so that that vote won't tie.

Hope it helps.
Tsz-Wo


On Thu, Oct 1, 2020 at 8:48 AM Patrick Plenefisch <[email protected]>
wrote:

> Hi,
> I found ratis recently, and was exploring using it, but I can't figure out
> how to add a new peer to a group for some simple cases. Notably, the code
> typically hangs on RaftServer.setConfiguration().
> If instead, I use the async version thusly:
>
> start node1 with peers node1
> start node2 with peers node2
> node1.setConfigurationAsync(node1, node2)
> node2.setConfigurationAsync(node1, node2)
>
> I end up with two leaders. Is there a way can I force a new term/revote?
> While messing around with the Counter example, I tried to do the same
> setup, but instead I got constant exceptions about "n1@group-ABB3109A44C1
> is not in [RUNNING]: current state is STARTING" and yet if I query
> server.getLifeCycleState() it returns "RUNNING".
> If I change the setup to be:
>
> start node1 with peers node1
> start node2 with peers node1, node2
> node1.setConfigurationAsync(node1, node2)
>
> It works! However, when I attempted:
>
> start node1 with peers node1
> start node2 with peers node2, nodeDNE
> node1.setConfigurationAsync(node1, node2)
> node2.setConfigurationAsync(node1, node2)
>
> The configuration changes never make it in, and instead I get a constant
> cycle of trying to connect to nodeDNE and re-voting, which appears to block
> further configuration changes.
>
> It appears if I include too few nodes, I have too many leaders, and if I
> have too many nodes, I get an unrecoverable configuration. I assume I must
> be missing something, but am unsure what. Or, Is there a way can I force a
> new term and associated revote? Or, Is there a way to recover from a
> re-voting loop blocking reconfiguration of a node?
>
> Thanks,
> Patrick
>

Reply via email to