You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/09/10 15:29:27 UTC
[GitHub] [rocketmq] TheR1sing3un opened a new issue, #5045: Refactor the register and elect master process in controller mode
TheR1sing3un opened a new issue, #5045:
URL: https://github.com/apache/rocketmq/issues/5045
# Refactor the register and elect master process in controller mode
## 背景 BackGround
现在的注册逻辑也就是在RegisterBrokerToController中包含了分配brokerId以及判断当前是否有master存在,如果没有master存在则也在本次register中添加一个ElectMasterEvent。
为了之后的持久化brokerId的逻辑,现在需要先将这个register语意拆分,保证register只用于brokerId的获取,而不涉及选举。
The current registration logic includes the allocation in the brokerId and determines whether a master exists, If no master exists, a ElectMasterEvent is added to this register. For the subsequent persistence brokerId logic, we need to split the register process first to ensure that the register is only used to obtain brokerId and does not involve elections.
> ReplicasInfoManager#registerBroker

并且在broker侧拉取replicasInfo时,当检测到当前没有master,也会使用register去触发controller选举。
When pulling replicasInfo on the broker side, when no master is detected, register is also used to trigger controller election.
> ReplicasManager#schedulingSyncBrokerMetadata

---
## 改造方案 Improvements plan
在register逻辑中取消触发选举的点,register仅用于brokerId的获取,而broker侧触发controller选举则通过tryElectMaster来实现。
1. 删除controller侧register流程中的选举相关逻辑。
1. 增加broker侧在register成功之后发送一个tryElectMaster请求到controller,用于触发选举。
1. 在获取replicasInfo时,感知到此时没有master,则发送tryElectMaster命令尝试选举。
In the register logic, the point that triggers the election is canceled. register is only used to obtain the brokerId, while the broker side triggers the controller election through the tryElectMaster.
1. Delete the election-related logic in the controller-side register process.
1. Add a request in the broker side to send a tryElectMaster request to the controller after the registering is successful to trigger the election.
1. When obtaining the replicasInfo, the system detects that there is no master at this time, and then sends the tryElectMaster command to try the election.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [rocketmq] lizhimins commented on issue #5045: Refactor the register and elect-master process in controller mode
Posted by GitBox <gi...@apache.org>.
lizhimins commented on issue #5045:
URL: https://github.com/apache/rocketmq/issues/5045#issuecomment-1260343255
It is really strange that register semantically couples elect behavior, and it should be split.
The behavior of tryElect looks like a distributed election algorithm. The previous election behavior was decided by the controller, which should be considered.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [rocketmq] TheR1sing3un closed issue #5045: Refactor the register and elect-master process in controller mode
Posted by "TheR1sing3un (via GitHub)" <gi...@apache.org>.
TheR1sing3un closed issue #5045: Refactor the register and elect-master process in controller mode
URL: https://github.com/apache/rocketmq/issues/5045
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org