Skip to content

POST /api/v1/cluster/peer has no way to set a joining peer's priority #7523

Closed

Description

@robfrank

Summary

Found while fixing a review comment on #7401's connect cluster PR.

arcadedb.ha.serverList lets an operator give a peer a non-default election priority (e.g. 0 for a
witness that must never become leader, or a high value for a preferred leader):

host:raftPort:httpPort:priority
host:{raft:..,http:..,priority:..}

RaftHAServer.selectStepDownTargets and Ratis's own leader election both read the live
RaftPeer.getPriority(), so this is not cosmetic - it is how a witness stays out of the leader role.

POST /api/v1/cluster/peer (PostAddPeerHandler) has no equivalent. Its JSON payload is
{peerId, address, name} only:

final String peerId = payload.getString("peerId", "");
final String address = payload.getString("address", "");
final String name = payload.getString("name", "").trim();
...
raftHAServer.addPeer(peerId, address, name.isEmpty() ? null : name);

so a peer added at runtime through this route always gets Ratis's own default priority, with no way
to ask for anything else. The same was true of connect cluster <address> until #7401's review pass
added a 4-argument addPeer overload that carries a parsed priority through for that one caller -
RaftClusterManager.addPeer(peerId, address, name, priority) - but PostAddPeerHandler was left on
the 3-arg overload because extending an HTTP request contract is a different, larger change than
wiring one caller inside ha-raft.

Suggested scope

  1. Add an optional priority field to the POST /api/v1/cluster/peer request body.
  2. Have PostAddPeerHandler call the priority-carrying addPeer overload RaftHAServer already
    exposes package-privately (may need to widen its visibility, or add a matching public overload).
  3. Update PluginApiSpec's OpenAPI description for addClusterPeer and AddPeerRequest.
  4. A test: add a peer with an explicit low priority through this route, assert it is excluded by
    selectStepDownTargets/leader election the way a serverList-declared witness is.

Notes

No reported user impact - found during review of #7401, not by hitting it in use.

Related: #7401 (connect cluster, where the sibling gap was fixed for that one entry point).

Activity

  1. added
    server
    ha
    on Sep 12, 2026
  2. added
    enhancement
    on Sep 12, 2026
  3. added this to the 26.10.1 milestone on Sep 12, 2026
  4. added
    in progress
    on Sep 17, 2026
  5. self-assigned this
    on Sep 17, 2026
  6. added 3 commits that reference this issue on Sep 17, 2026
  7. removed
    in progress
    on Sep 17, 2026
  8. lvca commented on Sep 17, 2026

    @lvca
    Member

    Fixed in PR #7764 (merged).

    POST /api/v1/cluster/peer now accepts an optional priority field, so you can add a peer as a non-voting witness (priority: 0) or a preferred leader (a higher value) at the same time you add it - no need to pre-declare it in the startup configuration.

    ❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementhaserver

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions