Skip to content

Conversation

@KyrinCode
Copy link

Description

This PR exposes the DemoteVoter method via the conductor RPC API, allowing operators to demote a voting member to a non-voting member without removing and re-adding the node.

Problem

The consensus layer already has a DemoteVoter method implemented, but it was not exposed through the RPC API. Without this RPC endpoint, operators who wanted to demote a voter to nonvoter had to:

  1. Remove the server via conductor_removeServer
  2. Re-add it via conductor_addServerAsNonvoter
    This workaround has a significant drawback: when a node is removed, Raft's default behavior causes it to shut down, requiring a process restart before re-adding.

Solution

Expose the existing DemoteVoter consensus method through the RPC API as conductor_demoteVoter. This allows:

  • Direct demotion of a voter to nonvoter in a single RPC call
  • No Raft shutdown or process restart required
  • Seamless role transitions within the cluster

Changes

  • Added DemoteVoter method to rpc/api.go interface
  • Added DemoteVoter implementation in rpc/backend.go
  • Added DemoteVoter client method in rpc/client.go
  • Added DemoteVoter handler in conductor/service.go

Usage

curl -X POST http://<conductor>:8547 \
  -d '{"jsonrpc":"2.0","method":"conductor_demoteVoter","params":["<server-id>", 0],"id":1}'

Tests

Manual testing was performed:

  1. Started a 3-node conductor cluster with all nodes as voters
  2. Called conductor_demoteVoter on one node
  3. Verified the node transitioned from voter to nonvoter
  4. Verified cluster membership reflected the change
  5. Verified the demoted node continued to receive log replication
    This is a straightforward RPC exposure of an existing consensus method. The underlying DemoteVoter functionality is already tested as part of HashiCorp Raft.

Additional context

Note: If the leader is demoted, it will trigger a new leader election. This is expected Raft behavior.

Metadata

Complements existing cluster management APIs (addServerAsVoter, addServerAsNonvoter, removeServer)

@KyrinCode KyrinCode requested review from a team as code owners December 29, 2025 12:48
@KyrinCode KyrinCode requested a review from zhwrd December 29, 2025 12:48
@KyrinCode KyrinCode changed the title add demote-voter to conductor rpc feat(conductor): add demote-voter to conductor rpc Dec 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant