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/08/29 06:16:00 UTC
[GitHub] [rocketmq] TheR1sing3un opened a new pull request, #4918: [ISSUE#4917] Optimize the retry logic in appending a no-op request when controller change to leader
TheR1sing3un opened a new pull request, #4918:
URL: https://github.com/apache/rocketmq/pull/4918
…t to dledger when the controller change to leader
1. optimize the retry logic in appending a empty request to dledger when
the controller change to leader
link issue: https://github.com/apache/rocketmq/issues/4917
**Make sure set the target branch to `develop`**
## What is the purpose of the change
XXXXX
## 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`.
- [x] Make sure there is a [Github issue](https://github.com/apache/rocketmq/issues) 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](https://github.com/apache/rocketmq/tree/master/test).
- [x] 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](http://www.apache.org/licenses/#clas).
--
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] RongtongJin merged pull request #4918: [ISSUE#4917] Optimize the retry logic in appending a no-op request when controller change to leader
Posted by GitBox <gi...@apache.org>.
RongtongJin merged PR #4918:
URL: https://github.com/apache/rocketmq/pull/4918
--
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 commented on a diff in pull request #4918: [ISSUE#4917] Optimize the retry logic in appending a no-op request when controller change to leader
Posted by GitBox <gi...@apache.org>.
TheR1sing3un commented on code in PR #4918:
URL: https://github.com/apache/rocketmq/pull/4918#discussion_r957284534
##########
controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java:
##########
@@ -432,6 +432,16 @@ public void handle(long term, MemberState.Role role) {
DLedgerController.this.startScheduling();
break;
}
+ if (!DLedgerController.this.getMemberState().isLeader()) {
+ // now is not a leader
+ log.error("Append a initial log failed because current state is not leader");
+ break;
+ }
+ log.error("Controller leader append initial log failed, try again");
+ tryTimes++;
+ if (tryTimes % 3 == 0) {
+ log.warn("Controller leader append initial log failed too many times, please wait a while");
+ }
} catch (final Throwable e) {
log.error("Error happen when controller leader append initial request to dledger", e);
tryTimes++;
Review Comment:
Yep~ Maybe we can check the state once the appending is failed(appendToDLedfer return false or appendToDLedger AndWait throws an exception)
--
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 commented on a diff in pull request #4918: [ISSUE#4917] Optimize the retry logic in appending a no-op request when controller change to leader
Posted by GitBox <gi...@apache.org>.
TheR1sing3un commented on code in PR #4918:
URL: https://github.com/apache/rocketmq/pull/4918#discussion_r957294882
##########
controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java:
##########
@@ -432,6 +432,16 @@ public void handle(long term, MemberState.Role role) {
DLedgerController.this.startScheduling();
break;
}
+ if (!DLedgerController.this.getMemberState().isLeader()) {
+ // now is not a leader
+ log.error("Append a initial log failed because current state is not leader");
+ break;
+ }
+ log.error("Controller leader append initial log failed, try again");
+ tryTimes++;
+ if (tryTimes % 3 == 0) {
+ log.warn("Controller leader append initial log failed too many times, please wait a while");
+ }
} catch (final Throwable e) {
log.error("Error happen when controller leader append initial request to dledger", e);
tryTimes++;
Review Comment:
> > Yep~ Maybe we can check the state once the appending is failed(appendToDLedfer return false or appendToDLedger AndWait throws an exception)
>
> How about creating a function to deal with it?
got it!
--
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] RongtongJin commented on a diff in pull request #4918: [ISSUE#4917] Optimize the retry logic in appending a no-op request when controller change to leader
Posted by GitBox <gi...@apache.org>.
RongtongJin commented on code in PR #4918:
URL: https://github.com/apache/rocketmq/pull/4918#discussion_r957291783
##########
controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java:
##########
@@ -432,6 +432,16 @@ public void handle(long term, MemberState.Role role) {
DLedgerController.this.startScheduling();
break;
}
+ if (!DLedgerController.this.getMemberState().isLeader()) {
+ // now is not a leader
+ log.error("Append a initial log failed because current state is not leader");
+ break;
+ }
+ log.error("Controller leader append initial log failed, try again");
+ tryTimes++;
+ if (tryTimes % 3 == 0) {
+ log.warn("Controller leader append initial log failed too many times, please wait a while");
+ }
} catch (final Throwable e) {
log.error("Error happen when controller leader append initial request to dledger", e);
tryTimes++;
Review Comment:
> Yep~ Maybe we can check the state once the appending is failed(appendToDLedfer return false or appendToDLedger AndWait throws an exception)
How about creating a function to deal with it?
--
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] RongtongJin commented on a diff in pull request #4918: [ISSUE#4917] Optimize the retry logic in appending a no-op request when controller change to leader
Posted by GitBox <gi...@apache.org>.
RongtongJin commented on code in PR #4918:
URL: https://github.com/apache/rocketmq/pull/4918#discussion_r957275150
##########
controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java:
##########
@@ -432,6 +432,16 @@ public void handle(long term, MemberState.Role role) {
DLedgerController.this.startScheduling();
break;
}
+ if (!DLedgerController.this.getMemberState().isLeader()) {
+ // now is not a leader
+ log.error("Append a initial log failed because current state is not leader");
+ break;
+ }
+ log.error("Controller leader append initial log failed, try again");
+ tryTimes++;
+ if (tryTimes % 3 == 0) {
+ log.warn("Controller leader append initial log failed too many times, please wait a while");
+ }
} catch (final Throwable e) {
log.error("Error happen when controller leader append initial request to dledger", e);
tryTimes++;
Review Comment:
If an exception is thrown, do we need to determine whether it is a leader?
--
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 commented on a diff in pull request #4918: [ISSUE#4917] Optimize the retry logic in appending a no-op request when controller change to leader
Posted by GitBox <gi...@apache.org>.
TheR1sing3un commented on code in PR #4918:
URL: https://github.com/apache/rocketmq/pull/4918#discussion_r957284534
##########
controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java:
##########
@@ -432,6 +432,16 @@ public void handle(long term, MemberState.Role role) {
DLedgerController.this.startScheduling();
break;
}
+ if (!DLedgerController.this.getMemberState().isLeader()) {
+ // now is not a leader
+ log.error("Append a initial log failed because current state is not leader");
+ break;
+ }
+ log.error("Controller leader append initial log failed, try again");
+ tryTimes++;
+ if (tryTimes % 3 == 0) {
+ log.warn("Controller leader append initial log failed too many times, please wait a while");
+ }
} catch (final Throwable e) {
log.error("Error happen when controller leader append initial request to dledger", e);
tryTimes++;
Review Comment:
Yep~ Maybe we can check the state once the appending is failed(appendToDLedgerAndWait return false or appendToDLedgerAndWait throws an exception)
--
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 commented on a diff in pull request #4918: [ISSUE#4917] Optimize the retry logic in appending a no-op request when controller change to leader
Posted by GitBox <gi...@apache.org>.
TheR1sing3un commented on code in PR #4918:
URL: https://github.com/apache/rocketmq/pull/4918#discussion_r957373577
##########
controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java:
##########
@@ -432,6 +432,16 @@ public void handle(long term, MemberState.Role role) {
DLedgerController.this.startScheduling();
break;
}
+ if (!DLedgerController.this.getMemberState().isLeader()) {
+ // now is not a leader
+ log.error("Append a initial log failed because current state is not leader");
+ break;
+ }
+ log.error("Controller leader append initial log failed, try again");
+ tryTimes++;
+ if (tryTimes % 3 == 0) {
+ log.warn("Controller leader append initial log failed too many times, please wait a while");
+ }
} catch (final Throwable e) {
log.error("Error happen when controller leader append initial request to dledger", e);
tryTimes++;
Review Comment:
> > Yep~ Maybe we can check the state once the appending is failed(appendToDLedfer return false or appendToDLedger AndWait throws an exception)
>
> How about creating a function to deal with it?
I find that maybe it is uncessary to add a function to deal with it.
--
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] codecov-commenter commented on pull request #4918: [ISSUE#4917] Optimize the retry logic in appending a no-op request when controller change to leader
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #4918:
URL: https://github.com/apache/rocketmq/pull/4918#issuecomment-1229844526
# [Codecov](https://codecov.io/gh/apache/rocketmq/pull/4918?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#4918](https://codecov.io/gh/apache/rocketmq/pull/4918?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (1a41203) into [develop](https://codecov.io/gh/apache/rocketmq/commit/64c18fb0dbb8d7e0e4af9edf49d04ab8dd64bccd?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (64c18fb) will **decrease** coverage by `0.14%`.
> The diff coverage is `42.85%`.
> :exclamation: Current head 1a41203 differs from pull request most recent head 9dd1449. Consider uploading reports for the commit 9dd1449 to get more accurate results
```diff
@@ Coverage Diff @@
## develop #4918 +/- ##
=============================================
- Coverage 43.29% 43.15% -0.15%
+ Complexity 7688 7684 -4
=============================================
Files 991 994 +3
Lines 68781 68946 +165
Branches 9111 9134 +23
=============================================
- Hits 29782 29756 -26
- Misses 35253 35459 +206
+ Partials 3746 3731 -15
```
| [Impacted Files](https://codecov.io/gh/apache/rocketmq/pull/4918?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...he/rocketmq/controller/impl/DLedgerController.java](https://codecov.io/gh/apache/rocketmq/pull/4918/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29udHJvbGxlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcm9ja2V0bXEvY29udHJvbGxlci9pbXBsL0RMZWRnZXJDb250cm9sbGVyLmphdmE=) | `67.01% <42.85%> (-5.97%)` | :arrow_down: |
| [...a/org/apache/rocketmq/store/StoreStatsService.java](https://codecov.io/gh/apache/rocketmq/pull/4918/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3RvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3N0b3JlL1N0b3JlU3RhdHNTZXJ2aWNlLmphdmE=) | `39.22% <0.00%> (-10.50%)` | :arrow_down: |
| [...or/validator/DefaultTopicMessageTypeValidator.java](https://codecov.io/gh/apache/rocketmq/pull/4918/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHJveHkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3Byb3h5L3Byb2Nlc3Nvci92YWxpZGF0b3IvRGVmYXVsdFRvcGljTWVzc2FnZVR5cGVWYWxpZGF0b3IuamF2YQ==) | `40.00% <0.00%> (-10.00%)` | :arrow_down: |
| [...e/rocketmq/controller/impl/manager/BrokerInfo.java](https://codecov.io/gh/apache/rocketmq/pull/4918/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29udHJvbGxlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcm9ja2V0bXEvY29udHJvbGxlci9pbXBsL21hbmFnZXIvQnJva2VySW5mby5qYXZh) | `78.94% <0.00%> (-9.29%)` | :arrow_down: |
| [...ocketmq/controller/impl/manager/SyncStateInfo.java](https://codecov.io/gh/apache/rocketmq/pull/4918/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29udHJvbGxlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcm9ja2V0bXEvY29udHJvbGxlci9pbXBsL21hbmFnZXIvU3luY1N0YXRlSW5mby5qYXZh) | `83.33% <0.00%> (-7.58%)` | :arrow_down: |
| [...apache/rocketmq/store/queue/ConsumeQueueStore.java](https://codecov.io/gh/apache/rocketmq/pull/4918/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3RvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3N0b3JlL3F1ZXVlL0NvbnN1bWVRdWV1ZVN0b3JlLmphdmE=) | `53.41% <0.00%> (-5.56%)` | :arrow_down: |
| [...e/rocketmq/store/ha/autoswitch/EpochFileCache.java](https://codecov.io/gh/apache/rocketmq/pull/4918/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3RvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3N0b3JlL2hhL2F1dG9zd2l0Y2gvRXBvY2hGaWxlQ2FjaGUuamF2YQ==) | `77.08% <0.00%> (-4.17%)` | :arrow_down: |
| [...apache/rocketmq/remoting/netty/ResponseFuture.java](https://codecov.io/gh/apache/rocketmq/pull/4918/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3Rpbmcvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3JlbW90aW5nL25ldHR5L1Jlc3BvbnNlRnV0dXJlLmphdmE=) | `77.55% <0.00%> (-4.09%)` | :arrow_down: |
| [...rocketmq/remoting/netty/NettyRemotingAbstract.java](https://codecov.io/gh/apache/rocketmq/pull/4918/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3Rpbmcvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3JlbW90aW5nL25ldHR5L05ldHR5UmVtb3RpbmdBYnN0cmFjdC5qYXZh) | `50.00% <0.00%> (-3.96%)` | :arrow_down: |
| ... and [41 more](https://codecov.io/gh/apache/rocketmq/pull/4918/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
--
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