Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Summer of Code] Support switch role for broker #4272

Merged

Conversation

hzh0425
Copy link
Member

@hzh0425 hzh0425 commented May 10, 2022

What is the purpose of the change

tracking issue: #4330

We want unified log replication, using rocketmq's original HaService instead of dledger mode.
Previously, I have done the following job with @RongtongJin

This pr is the last pr: connecting the interface of Dledger-controller at the Broker level, so that the Broker has the ability of master-slave switching

Noted that this Pr is still in development and not fully completed.

Brief changelog

The architecture is shown in the figure below. The pr is a link between the 'DledgerController' and 'AutoSwitchHASerivce' through a new component - ReplicasManager, it connects to the api of the controller and notifies the lower AutoSwitchHASerivce.

image

Verifying this change

Follow this checklist to help us incorporate your contribution quickly and easily. Notice, it would be helpful if you could finish the following 5 checklist(the last one is not necessary)before request the community to review your PR.

  • Make sure there is a Github issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Format the pull request title like [ISSUE #123] Fix UnknownException when host config not exist. Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test(over 80% coverage) to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in test module.
  • Run mvn -B clean apache-rat:check findbugs:findbugs checkstyle:checkstyle to make sure basic checks pass. Run mvn clean install -DskipITs to make sure unit-test pass. Run mvn clean test-compile failsafe:integration-test to make sure integration-test pass.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

hzh0425 added 10 commits May 7, 2022 17:38
1.add replicasManager and controllerProxy
1.add brokerHaAddress in controller.
1.add replicasManager
1.add brokerController to replicasManager.
2.change brokerController when change role.
@RongtongJin RongtongJin added soc Summer of Code, hosted by Google, Alibaba, Chinese Academy of Sciences and so on module/ha high availably related labels May 11, 2022
@hzh0425 hzh0425 requested a review from RongtongJin May 13, 2022 10:30
@codecov-commenter
Copy link

codecov-commenter commented May 16, 2022

Codecov Report

Merging #4272 (c41aefc) into 5.0.0-beta-dledger-controller (ce534ee) will decrease coverage by 0.16%.
The diff coverage is 23.34%.

@@                         Coverage Diff                         @@
##             5.0.0-beta-dledger-controller    #4272      +/-   ##
===================================================================
- Coverage                            43.73%   43.56%   -0.17%     
- Complexity                            6272     6288      +16     
===================================================================
  Files                                  827      829       +2     
  Lines                                58610    58937     +327     
  Branches                              8003     8046      +43     
===================================================================
+ Hits                                 25634    25678      +44     
- Misses                               29670    29942     +272     
- Partials                              3306     3317      +11     
Impacted Files Coverage Δ
...a/org/apache/rocketmq/broker/BrokerController.java 48.57% <0.00%> (-0.56%) ⬇️
.../rocketmq/broker/hacontroller/ReplicasManager.java 0.00% <0.00%> (ø)
...org/apache/rocketmq/broker/out/BrokerOuterAPI.java 19.86% <0.00%> (-1.71%) ⬇️
...he/rocketmq/common/protocol/body/SyncStateSet.java 0.00% <0.00%> (ø)
...srv/controller/AlterSyncStateSetRequestHeader.java 0.00% <0.00%> (ø)
...rv/controller/AlterSyncStateSetResponseHeader.java 0.00% <ø> (ø)
...amesrv/controller/BrokerRegisterRequestHeader.java 0.00% <0.00%> (ø)
...mesrv/controller/BrokerRegisterResponseHeader.java 0.00% <0.00%> (ø)
...r/namesrv/controller/ElectMasterRequestHeader.java 0.00% <0.00%> (ø)
.../namesrv/controller/GetMetaDataResponseHeader.java 0.00% <0.00%> (ø)
... and 31 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ce534ee...c41aefc. Read the comment docs.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 47.653% when pulling c41aefc on hzh0425:feature/role-switch into ce534ee on apache:5.0.0-beta-dledger-controller.

@RongtongJin RongtongJin merged commit ad8851b into apache:5.0.0-beta-dledger-controller May 16, 2022
@hzh0425 hzh0425 mentioned this pull request May 16, 2022
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/ha high availably related soc Summer of Code, hosted by Google, Alibaba, Chinese Academy of Sciences and so on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants