SuperCache.Cluster.Raft.Group.Reconciler (SuperCache v1.7.0)

Copy Markdown View Source

Serializes Raft membership changes and limits them to the partition's primary node, so concurrent cluster events cannot issue overlapping join/leave operations for the same Raft group.

Membership is reconciled in two ways:

  • when the group has a leader, missing members are started and joined and stale members are removed;
  • when the group has no leader (first formation or a lost quorum), the primary stops the desired members' servers and forms the cluster again from the current partition map.

Starting a member that still runs a stale server (for example a self-only group formed before the rest of the cluster was visible) first stops that server, so the new member always starts from the current membership.

Summary

Functions

Returns a specification to start this module under a supervisor.

Reconcile one partition's Raft group with the current partition map.

Start the reconciler (owned by the application supervision tree).

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

reconcile(partition_idx)

@spec reconcile(non_neg_integer()) :: :ok | {:error, term()}

Reconcile one partition's Raft group with the current partition map.

start_link(opts \\ [])

@spec start_link(keyword()) :: {:ok, pid()} | {:error, term()}

Start the reconciler (owned by the application supervision tree).