[ISSUE #4791] Add elect master command for admin CLI
Make sure set the target branch to develop
What is the purpose of the change
close #4791
Brief changelog
- Add elect master command for admin CLI
Verifying this change
XXXX
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.
- [x] 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.
- [x] 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. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
- [x] 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.
- [x] Run
mvn -B clean apache-rat:check findbugs:findbugs checkstyle:checkstyleto make sure basic checks pass. Runmvn clean install -DskipITsto make sure unit-test pass. Runmvn clean test-compile failsafe:integration-testto make sure integration-test pass. - [ ] If this contribution is large, please file an Apache Individual Contributor License Agreement.
Coverage decreased (-0.02%) to 49.137% when pulling d1e93a388f7ebc8f4b1b0116c613b6407a0b230a on mxsm:rocketmq-4791 into 9b87205c6d44e1c08aa5ae9aee6f2b28a60bb586 on apache:develop.
Codecov Report
Merging #4798 (d1e93a3) into develop (9b87205) will decrease coverage by
0.10%. The diff coverage is22.52%.
@@ Coverage Diff @@
## develop #4798 +/- ##
=============================================
- Coverage 45.09% 44.99% -0.11%
+ Complexity 7645 7642 -3
=============================================
Files 977 978 +1
Lines 67965 68059 +94
Branches 8985 8999 +14
=============================================
- Hits 30646 30620 -26
- Misses 33552 33652 +100
- Partials 3767 3787 +20
| Impacted Files | Coverage Δ | |
|---|---|---|
| ...g/apache/rocketmq/client/impl/MQClientAPIImpl.java | 23.38% <0.00%> (-0.28%) |
:arrow_down: |
| ...r/namesrv/controller/ElectMasterRequestHeader.java | 0.00% <0.00%> (ø) |
|
| ...apache/rocketmq/tools/admin/DefaultMQAdminExt.java | 31.97% <0.00%> (-0.19%) |
:arrow_down: |
| ...he/rocketmq/tools/admin/DefaultMQAdminExtImpl.java | 25.67% <0.00%> (-0.03%) |
:arrow_down: |
| .../apache/rocketmq/tools/command/MQAdminStartup.java | 0.00% <0.00%> (ø) |
|
| ...ls/command/controller/ReElectMasterSubCommand.java | 0.00% <0.00%> (ø) |
|
| ...ntroller/processor/ControllerRequestProcessor.java | 24.17% <23.07%> (-2.02%) |
:arrow_down: |
| ...q/controller/impl/manager/ReplicasInfoManager.java | 65.58% <66.66%> (+2.03%) |
:arrow_up: |
| ...etmq/namesrv/routeinfo/BatchUnRegisterService.java | 94.73% <0.00%> (-5.27%) |
:arrow_down: |
| ...org/apache/rocketmq/common/stats/StatsItemSet.java | 46.26% <0.00%> (-4.48%) |
:arrow_down: |
| ... and 26 more |
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more
Thank you for your contribution. After modifying the above review suggestions, can you test your cli command and add a picture to prove the correctness? (The elect master command can correctly trigger the master election) @mxsm
Thank you for your contribution. After modifying the above review suggestions, can you test your cli command and add a picture to prove the correctness? (The elect master command can correctly trigger the master election) @mxsm
OK, I will
Correctness result proof。
environment:
two brokers are deployed in the WSL, Namesrv(Controller) is deployed in windows.
Thanks for your code review and advice @hzh0425 @RongtongJin