Malachi.Cluster.LeaseReconciler (malachi v0.22.7)

View Source

Periodically reconciles this node into the lease cluster (R3-b-iii hardening). On start and every :interval ms it calls the injected :reconcile seam, wired to LeaseServer.reconcile/2 - which bootstraps the lease cluster if unformed and starts the local server so a node that was down when the cluster first formed rejoins. Level-triggered and idempotent (a joined node's reconcile is a no-op), so it just keeps ticking. Keeps the LeaseHolder free of ra/membership concerns. Every replicated store (lease, ring, users, lockouts, ACLs) runs one of these.

With :version_check it also asks Malachi.Cluster.MachineVersion.check/3 on each tick whether the local member stopped applying its log because the group moved to a machine version this node does not support. The last answer is this process's own state, so a member that stays stuck is logged once, when it gets stuck, and again only when it recovers.

Seams:

  • :reconcile - (-> any), one reconcile pass;
  • :version_check - optional {machine, server_id}, the local member to watch;
  • :interval - reconcile period in ms (default 30_000);
  • :name - optional registered name.

Summary

Functions

Returns a specification to start this module under a supervisor.

Runs one reconcile pass synchronously (a manual trigger, e.g. for tests).

The last machine version status seen for the watched member (:ok when nothing is watched).

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

reconcile_now(server)

@spec reconcile_now(GenServer.server()) :: :ok

Runs one reconcile pass synchronously (a manual trigger, e.g. for tests).

start_link(opts)

@spec start_link(keyword()) :: GenServer.on_start()

version_status(server)

The last machine version status seen for the watched member (:ok when nothing is watched).