[ISSUE #2476] Fix HaClient Infinite loop
try to fix epollwait no block, trash selector, regen it!
What is the purpose of the change
fix epollwait no block https://github.com/apache/rocketmq/issues/2487
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 increased (+0.5%) to 51.832% when pulling cc68e7d62cc65bb2707c6064166141295382f144 on crazywen:master into 9f95a972e10e0681bc3f2d00e9957aa212e897b5 on apache:master.
@crazywen The original reason is that the HAClient.READ_MAX_BUFFER_SIZE muse be equal or larger than the haTransferBatchSize.
Otherwise, the slave HAClient cannot read all the data to byteBufferRead as it has been full already, and the reallocation will take no effect, the new buffer will still be full.

@crazywen It is not a good way to fix the BUFFER SIZE. You could introduce another config(for example haReceiveBatchSize) to control the HAClient read buffer size, which is now fixed to 4M by READ_MAX_BUFFER_SIZE. And then make sure the haTransferBatchSize is equal or smaller than haReceiveBatchSize.
@crazywen It is not a good way to fix the BUFFER SIZE. You could introduce another config(for example haReceiveBatchSize) to control the HAClient read buffer size, which is now fixed to 4M by READ_MAX_BUFFER_SIZE. And then make sure the haTransferBatchSize is equal or smaller than haReceiveBatchSize.
@crazywen It is not a good way to fix the BUFFER SIZE. You could introduce another config(for example haReceiveBatchSize) to control the HAClient read buffer size, which is now fixed to 4M by READ_MAX_BUFFER_SIZE. And then make sure the haTransferBatchSize is equal or smaller than haReceiveBatchSize.
haReceiveBatchSize also should have the max size, and the property is valid in slave, and haTransferBatchSize is valid in master, if like what you suggest, the master property should depend on the salve ?
Codecov Report
Merging #2487 (cc68e7d) into master (9f95a97) will increase coverage by
0.76%. The diff coverage is25.00%.
@@ Coverage Diff @@
## master #2487 +/- ##
============================================
+ Coverage 45.69% 46.46% +0.76%
- Complexity 4271 4551 +280
============================================
Files 546 547 +1
Lines 35860 38475 +2615
Branches 4763 5551 +788
============================================
+ Hits 16388 17876 +1488
- Misses 17429 18432 +1003
- Partials 2043 2167 +124
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 9f95a97...cc68e7d. Read the comment docs.
@crazywen Usually, the config of each node should keep the same in the same cluster(or at least for pair of master-slave which has the same broker name). If so, just make sure haTransferBatchSize is equal or smaller than haReceiveBatchSize in the config file.
This PR is stale because it has been open for 365 days with no activity. It will be closed in 3 days if no further activity occurs. If you wish not to mark it as stale, please leave a comment in this PR.
This PR was closed because it has been inactive for 3 days since being marked as stale.