Skip to content

HA: optional human-readable peer names in HA_SERVER_LIST #3974

@lvca

Description

@lvca

Background

The Apache Ratis HA module currently identifies peers positionally:

  • HA_SERVER_LIST is a comma-separated list of host:raftPort:httpPort:priority entries
  • Each node's slot is derived from the numeric suffix of HA_SERVER_NAME (e.g. ArcadeDB_0 -> peer index 0)
  • Display names shown in logs and Studio are synthesized as <localPrefix><sep><index> using the local node's name prefix

This works well for K8s StatefulSet deployments (arcadedb-0, arcadedb-1, ...) but is confusing in two cases:

  1. Operators who deploy with heterogeneous names (e.g. frankfurt, london, nyc) must still embed a numeric suffix, and the displayed peer names get rebuilt from the local prefix and don't reflect the configured names.
  2. The mapping between HA_SERVER_NAME and the position in HA_SERVER_LIST is implicit. If they get out of sync, a node claims the wrong slot.

Proposal

Add an optional name@ prefix to each entry in HA_SERVER_LIST. Fully backward compatible: entries without @ keep their current behavior; mixed clusters work; @ does not appear in any current valid format so detection is unambiguous.

HA_SERVER_LIST=frankfurt@10.0.0.1:2424:2480,london@10.0.0.2:2424:2480,nyc@10.0.0.3:2424:2480

Resolution rules:

  • If a peer entry has name@, the local node identifies its slot by matching HA_SERVER_NAME against the peer name first.
  • If no name match is found, fall back to the existing prefix_N / prefix-N suffix resolution.
  • Display names use the configured peer name when present; otherwise the existing positional synthesis is used.
  • Names must be unique within the cluster (validated at parse time).

Affected components

  • HA_SERVER_LIST parser (RaftPeerAddressResolver.parsePeerList)
  • Local peer resolution (RaftPeerAddressResolver.findLocalPeerId)
  • Display-name building (RaftHAServer constructor + getPeerDisplayName)
  • Dynamic membership: optional name parameter on addPeer admin command (POST payload field) so peers added at runtime also get a friendly name in logs/Studio
  • HAServerPlugin interface: optional 3-arg addPeer(peerId, address, name) default that delegates to the 2-arg version, so non-Raft implementations keep working

Out of scope

  • No wire-level name exchange between nodes is needed: HA_SERVER_LIST is already a cluster-wide setting, so each node already knows the configured names.
  • HA_SERVER_NAME itself does not need to change. With named peers, its numeric suffix simply becomes optional.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions