You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "RongtongJin (via GitHub)" <gi...@apache.org> on 2023/01/26 03:08:22 UTC
[GitHub] [rocketmq] RongtongJin opened a new pull request, #5930: [ISSUE #5929] Fix the issue that broker send heartbeat to controller frequently causing thread blocking when the network partition
RongtongJin opened a new pull request, #5930:
URL: https://github.com/apache/rocketmq/pull/5930
**Make sure set the target branch to `develop`**
## What is the purpose of the change
Close #5929
Fix the issue that broker send heartbeat to controller frequently causing thread blocking when the network partition
## Brief changelog
1. Regularly scan whether the address of controllers is connected
2. Heartbeat is only sent to available controller addresses
## 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: commits-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 #5930: [ISSUE #5929] Fix the issue that broker send heartbeat to controller frequently causing thread blocking when the network partition
Posted by "RongtongJin (via GitHub)" <gi...@apache.org>.
RongtongJin commented on code in PR #5930:
URL: https://github.com/apache/rocketmq/pull/5930#discussion_r1089851439
##########
broker/src/main/java/org/apache/rocketmq/broker/controller/ReplicasManager.java:
##########
@@ -491,4 +532,8 @@ public List<String> getControllerAddresses() {
public List<EpochEntry> getEpochEntries() {
return this.haService.getEpochEntries();
}
+
+ public List<String> getAvailableControllerAddresses() {
+ return new ArrayList<>(availableControllerAddresses.keySet());
+ }
Review Comment:
This list will not expand.
--
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
[GitHub] [rocketmq] mxsm commented on a diff in pull request #5930: [ISSUE #5929] Fix the issue that broker send heartbeat to controller frequently causing thread blocking when the network partition
Posted by "mxsm (via GitHub)" <gi...@apache.org>.
mxsm commented on code in PR #5930:
URL: https://github.com/apache/rocketmq/pull/5930#discussion_r1089609548
##########
broker/src/main/java/org/apache/rocketmq/broker/controller/ReplicasManager.java:
##########
@@ -445,6 +457,35 @@ private void stopCheckSyncStateSet() {
}
}
+ private void scanAvailableControllerAddresses() {
+ if (controllerAddresses == null) {
+ LOGGER.warn("scanAvailableControllerAddresses addresses of controller is null!");
+ return;
+ }
+
+ for (String address : availableControllerAddresses.keySet()) {
+ if (!controllerAddresses.contains(address)) {
+ LOGGER.warn("scanAvailableControllerAddresses remove invalid address {}", address);
+ availableControllerAddresses.remove(address);
+ }
+ }
+
+ for (String address : controllerAddresses) {
+ scanExecutor.submit(new Runnable() {
+ @Override public void run() {
+ if (brokerOuterAPI.checkAddressCanConnect(address)) {
Review Comment:
code style
```
@Override
public void run() {
```
##########
broker/src/main/java/org/apache/rocketmq/broker/controller/ReplicasManager.java:
##########
@@ -491,4 +532,8 @@ public List<String> getControllerAddresses() {
public List<EpochEntry> getEpochEntries() {
return this.haService.getEpochEntries();
}
+
+ public List<String> getAvailableControllerAddresses() {
+ return new ArrayList<>(availableControllerAddresses.keySet());
+ }
Review Comment:
How about set ArrayList initialCapacity to prevent expansion
--
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
[GitHub] [rocketmq] MatrixHB merged pull request #5930: [ISSUE #5929] Fix the issue that broker send heartbeat to controller frequently causing thread blocking when the network partition
Posted by "MatrixHB (via GitHub)" <gi...@apache.org>.
MatrixHB merged PR #5930:
URL: https://github.com/apache/rocketmq/pull/5930
--
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
[GitHub] [rocketmq] codecov-commenter commented on pull request #5930: [ISSUE #5929] Fix the issue that broker send heartbeat to controller frequently causing thread blocking when the network partition
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #5930:
URL: https://github.com/apache/rocketmq/pull/5930#issuecomment-1404546119
# [Codecov](https://codecov.io/gh/apache/rocketmq/pull/5930?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 [#5930](https://codecov.io/gh/apache/rocketmq/pull/5930?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (44eb17e) into [develop](https://codecov.io/gh/apache/rocketmq/commit/a961a9b37b0e9e4c6e30d7cc6ab1a9c796634e6f?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (a961a9b) will **increase** coverage by `0.01%`.
> The diff coverage is `41.17%`.
```diff
@@ Coverage Diff @@
## develop #5930 +/- ##
=============================================
+ Coverage 43.36% 43.38% +0.01%
- Complexity 8810 8812 +2
=============================================
Files 1090 1090
Lines 76407 76439 +32
Branches 9981 9988 +7
=============================================
+ Hits 33135 33164 +29
Misses 39126 39126
- Partials 4146 4149 +3
```
| [Impacted Files](https://codecov.io/gh/apache/rocketmq/pull/5930?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...a/org/apache/rocketmq/broker/BrokerController.java](https://codecov.io/gh/apache/rocketmq/pull/5930?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvQnJva2VyQ29udHJvbGxlci5qYXZh) | `43.25% <0.00%> (ø)` | |
| [...org/apache/rocketmq/broker/out/BrokerOuterAPI.java](https://codecov.io/gh/apache/rocketmq/pull/5930?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvb3V0L0Jyb2tlck91dGVyQVBJLmphdmE=) | `16.52% <0.00%> (-0.03%)` | :arrow_down: |
| [...e/rocketmq/remoting/netty/NettyRemotingClient.java](https://codecov.io/gh/apache/rocketmq/pull/5930?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3Rpbmcvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3JlbW90aW5nL25ldHR5L05ldHR5UmVtb3RpbmdDbGllbnQuamF2YQ==) | `41.49% <0.00%> (-0.57%)` | :arrow_down: |
| [...he/rocketmq/broker/controller/ReplicasManager.java](https://codecov.io/gh/apache/rocketmq/pull/5930?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvY29udHJvbGxlci9SZXBsaWNhc01hbmFnZXIuamF2YQ==) | `46.76% <56.00%> (+3.67%)` | :arrow_up: |
| [...ocketmq/tieredstore/container/TieredIndexFile.java](https://codecov.io/gh/apache/rocketmq/pull/5930?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-dGllcmVkc3RvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3RpZXJlZHN0b3JlL2NvbnRhaW5lci9UaWVyZWRJbmRleEZpbGUuamF2YQ==) | `68.10% <0.00%> (-3.88%)` | :arrow_down: |
| [...controller/impl/DefaultBrokerHeartbeatManager.java](https://codecov.io/gh/apache/rocketmq/pull/5930?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29udHJvbGxlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcm9ja2V0bXEvY29udHJvbGxlci9pbXBsL0RlZmF1bHRCcm9rZXJIZWFydGJlYXRNYW5hZ2VyLmphdmE=) | `82.27% <0.00%> (-3.80%)` | :arrow_down: |
| [.../apache/rocketmq/store/ha/DefaultHAConnection.java](https://codecov.io/gh/apache/rocketmq/pull/5930?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3RvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3N0b3JlL2hhL0RlZmF1bHRIQUNvbm5lY3Rpb24uamF2YQ==) | `65.86% <0.00%> (-1.21%)` | :arrow_down: |
| [...ache/rocketmq/proxy/common/ReceiptHandleGroup.java](https://codecov.io/gh/apache/rocketmq/pull/5930?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHJveHkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3Byb3h5L2NvbW1vbi9SZWNlaXB0SGFuZGxlR3JvdXAuamF2YQ==) | `66.32% <0.00%> (-1.03%)` | :arrow_down: |
| [...rocketmq/broker/processor/PopMessageProcessor.java](https://codecov.io/gh/apache/rocketmq/pull/5930?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvcHJvY2Vzc29yL1BvcE1lc3NhZ2VQcm9jZXNzb3IuamF2YQ==) | `36.52% <0.00%> (-0.46%)` | :arrow_down: |
| [...cketmq/store/ha/autoswitch/AutoSwitchHAClient.java](https://codecov.io/gh/apache/rocketmq/pull/5930?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3RvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3N0b3JlL2hhL2F1dG9zd2l0Y2gvQXV0b1N3aXRjaEhBQ2xpZW50LmphdmE=) | `76.17% <0.00%> (-0.37%)` | :arrow_down: |
| ... and [14 more](https://codecov.io/gh/apache/rocketmq/pull/5930?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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [rocketmq] lizhimins commented on a diff in pull request #5930: [ISSUE #5929] Fix the issue that broker send heartbeat to controller frequently causing thread blocking when the network partition
Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins commented on code in PR #5930:
URL: https://github.com/apache/rocketmq/pull/5930#discussion_r1090120323
##########
remoting/src/main/java/org/apache/rocketmq/remoting/RemotingClient.java:
##########
@@ -52,5 +52,7 @@ void registerProcessor(final int requestCode, final NettyRequestProcessor proces
boolean isChannelWritable(final String addr);
+ boolean isAddressCanConnect(final String addr);
Review Comment:
Suggest rename it to "isAddressReachable"
--
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