-
Notifications
You must be signed in to change notification settings - Fork 12k
[ISSUE #4813] Add elect policy for controller #4809
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
Conversation
1. add epoch and maxOffset in heartbeat. 2. refactor elect logic, now we elect a new master by elect policy(can expand). 3. add some unit tests
|
@RongtongJin Hi~ Please check! Thks!🤣 |
|
Hi @TheR1sing3un It would be better to open another issue to record this pull request. |
...in/java/org/apache/rocketmq/common/protocol/header/namesrv/BrokerHeartbeatRequestHeader.java
Outdated
Show resolved
Hide resolved
...in/java/org/apache/rocketmq/common/protocol/header/namesrv/BrokerHeartbeatRequestHeader.java
Outdated
Show resolved
Hide resolved
controller/src/main/java/org/apache/rocketmq/controller/impl/manager/ReplicasInfoManager.java
Outdated
Show resolved
Hide resolved
controller/src/main/java/org/apache/rocketmq/controller/pojo/BrokerLiveInfo.java
Outdated
Show resolved
Hide resolved
controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java
Outdated
Show resolved
Hide resolved
|
Is there an issue related? Fix the title following the template guideline |
OK, I will open an issue to record this pr soon. |
broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java
Outdated
Show resolved
Hide resolved
...in/java/org/apache/rocketmq/common/protocol/header/namesrv/BrokerHeartbeatRequestHeader.java
Outdated
Show resolved
Hide resolved
controller/src/main/java/org/apache/rocketmq/controller/elect/impl/DefaultElectPolicy.java
Outdated
Show resolved
Hide resolved
controller/src/main/java/org/apache/rocketmq/controller/elect/ElectPolicy.java
Outdated
Show resolved
Hide resolved
|
wow, cool |
1. refactor some code and format some code
|
Pls fix the misspell and ci |
1. fix typo in ReplicasInfoManager
1.fix wrong method call in ReplicasManagerTest#before
1. fix wrong call in ReplicasManagerTest#before
RongtongJin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[ERROR] /home/travis/build/apache/rocketmq/controller/src/main/java/org/apache/rocketmq/controller/impl/manager/ReplicasInfoManager.java:20:8: Unused import - java.util.Collections. [UnusedImports]
[ERROR] /home/travis/build/apache/rocketmq/controller/src/main/java/org/apache/rocketmq/controller/impl/manager/ReplicasInfoManager.java:27:8: Unused import - java.util.function.Predicate. [UnusedImports]
[ERROR] /home/travis/build/apache/rocketmq/controller/src/main/java/org/apache/rocketmq/controller/impl/manager/ReplicasInfoManager.java:46:8: Unused import - org.apache.rocketmq.controller.elect.impl.DefaultElectPolicy. [UnusedImports]
[ERROR] /home/travis/build/apache/rocketmq/controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java:38:8: Unused import - java.util.function.BiFunction. [UnusedImports]
[ERROR] /home/travis/build/apache/rocketmq/controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java:60:8: Unused import - org.apache.rocketmq.controller.BrokerLiveInfo. [UnusedImports]
[ERROR] /home/travis/build/apache/rocketmq/controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java:161: 'lambda arguments' has incorrect indentation level 16, expected level should be 12. [Indentation]
[ERROR] /home/travis/build/apache/rocketmq/controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java:167: 'lambda arguments' has incorrect indentation level 16, expected level should be 12. [Indentation]
[ERROR] /home/travis/build/apache/rocketmq/controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java:173: 'lambda arguments' has incorrect indentation level 16, expected level should be 12. [Indentation]
[ERROR] /home/travis/build/apache/rocketmq/controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java:179: 'lambda arguments' has incorrect indentation level 16, expected level should be 12. [Indentation]
[ERROR] /home/travis/build/apache/rocketmq/controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java:186: 'lambda arguments' has incorrect indentation level 16, expected level should be 12. [Indentation]
[ERROR] /home/travis/build/apache/rocketmq/controller/src/main/java/org/apache/rocketmq/controller/impl/DefaultBrokerHeartbeatManager.java:139:13: '}' is not followed by whitespace. [WhitespaceAround]
[ERROR] /home/travis/build/apache/rocketmq/controller/src/main/java/org/apache/rocketmq/controller/impl/DefaultBrokerHeartbeatManager.java:139:14: 'else' is not preceded with whitespace. [WhitespaceAround]
[ERROR] /home/travis/build/apache/rocketmq/controller/src/main/java/org/apache/rocketmq/controller/BrokerLiveInfo.java:22:8: Unused import - java.util.Objects. [UnusedImports]
Audit done.
Hi @TheR1sing3un you can refer to this page to format your code.
controller/src/main/java/org/apache/rocketmq/controller/impl/manager/ReplicasInfoManager.java
Show resolved
Hide resolved
1. fix the bug about ReElectMaster 2. fix some typo
1. fix typo by checkstyle
…before 1. fix invalid usage of "any()" in DLedegerControllerTest#before
|
Failed tests: |
1. fix some wrong usage in test 2. refactor some field type to avoid NPE
Codecov Report
@@ Coverage Diff @@
## develop #4809 +/- ##
=============================================
+ Coverage 44.94% 44.96% +0.02%
- Complexity 7640 7661 +21
=============================================
Files 980 982 +2
Lines 68135 68222 +87
Branches 9014 9022 +8
=============================================
+ Hits 30622 30678 +56
- Misses 33729 33749 +20
- Partials 3784 3795 +11
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
1 similar comment
hzh0425
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
elect a new master by elect policy(can expand).
Make sure set the target branch to
developWhat is the purpose of the change
issue link: #4813
Brief changelog
XX
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.[ISSUE #123] Fix UnknownException when host config not exist. Each commit in the pull request should have a meaningful subject line and body.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.