Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: meta-service transfer_leader: add response and default value (#โฆ
โฆ16201) - The query `to=<next_leader_id>` can be absent in the transfer leadership request, such as: ``` curl -vqs '<admin_api_address>/v1/ctrl/trigger_transfer_leader' ``` In this case, the next node in the cluster will be used as the default value for query `to`. - Add 200 OK response indicating an accepted tranfer leadership request. The response is a json contains current node id `from`, the node id to transfer leadership to: `to`, and all of the voter ids in the cluster `voter_ids`, such as: ``` curl -vqs '127.0.0.1:28101/v1/ctrl/trigger_transfer_leader' < HTTP/1.1 200 OK < content-type: application/json; charset=utf-8 < content-length: 37 {"from":1,"to":2,"voter_ids":[1,2,3]} ``` - Add 404 NOT_FOUND response indicating an rejected transfer leadership request if the node is not the Leader. In such case it returns a string describing the state: ``` curl -vqs '127.0.0.1:28301/v1/ctrl/trigger_transfer_leader' < HTTP/1.1 404 Not Found < content-length: 85 This node is not leader, can not transfer leadership; id=1 current_leader=Some(2) voter_ids=[1, 2, 3] ```
- Loading branch information