- 
                Notifications
    You must be signed in to change notification settings 
- Fork 12k
[ISSUE #2732] Fix message loss problem when rebalance with LitePullConsumer #2832
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
| Is the range of this lock a bit large? If a consumer allocates more queues, will many pull tasks get stuck in updatePullOffset? | 
|  | ||
| public void updatePullOffset(MessageQueue messageQueue, long offset) { | ||
| public void updatePullOffset(MessageQueue messageQueue, long offset, ProcessQueue processQueue) { | ||
| MessageQueueState messageQueueState = assignedMessageQueueState.get(messageQueue); | 
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.
If return null here, it may report to NPE.
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.
fixed
| synchronized (this.assignedMessageQueueState) { | ||
| if (messageQueueState.getProcessQueue() != processQueue) { | ||
| return; | ||
| } | ||
| if (messageQueueState != null) { | ||
| messageQueueState.setPullOffset(offset); | ||
| } | ||
| } | 
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.
Synchronized here seems to be unnecessary
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.
it seems putting the synchronized before assignedMessageQueueState.get will be better.
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.
It seems the synchronized lock can be removed.
I have update this branch.
| Codecov Report
 @@              Coverage Diff              @@
##             develop    #2832      +/-   ##
=============================================
+ Coverage      46.52%   46.59%   +0.06%     
- Complexity      3426     3427       +1     
=============================================
  Files            307      307              
  Lines          29059    29065       +6     
  Branches        4172     4175       +3     
=============================================
+ Hits           13520    13543      +23     
+ Misses         13697    13674      -23     
- Partials        1842     1848       +6     Continue to review full report at Codecov. 
 | 
* [ISSUE #1233] Fix CVE-2011-1473 * fix Multiple instances in the same application share MQClientInstance * [ISSUE #2748] Fix deleteSubscriptionGroup not remove consumer offset * [ISSUE #2745] Changed the support time of the request/reply feature to 4.6.0. Co-authored-by: von gosling <[email protected]> * [ISSUE #2729] Replace with Math.min method call * [ISSUE #2801]Fix NamesrvAddr connot set in Producer * [ISSUE 2800] optimize: the spelling of topicSynFlag Co-authored-by: ph3636 <[email protected]> * [ISSUE #2803] Fix the endpoint cannot get instanceId without http (#2804) * fix the endpoint cannot get instanceId without http * fix the endpoint cannot get instanceId without http * add unit test * add unit test * add unit test Co-authored-by: panzhi33 <[email protected]> * fix messageArrivingListener NPE * [ISSUE #2538]Optimize log output when message trace saving fails * [ISSUE #2811] Fix the wrong topic was consumed in the DefaultMessageStoreTest test program * [ISSUE #2821] Overriding the ServiceThread#shutdown in HAClient class * [ISSUE #2805] remove redundant package imports * [ISSUE #2833] Support trace for TranscationProducer (#2834) * [ISSUE #2732] Fix message loss problem when rebalance with LitePullConsumer (#2832) * [ISSUE #2732] Fix message loss problem when rebalance with LitePullConsumer * Fix message loss problem when rebalance with LitePullConsumer, update 2 * [ISSUE #2846]fix -E might not port to other systems * fix some nonconformity after checkstyle * Support OpenTracing(#2861) * [ISSUE #2872] remove log files created by integration test when mvn clean * [ISSUE #2872] move log files created by integration test to target dir * Change log level to debug: "Half offset {} has been committed/rolled back" * Fix unit test stability Bump mockito-core to 3.10.0, remove powermock dependency, suppress useless logging * [ISSUE #2898] Resolve rocketmq-example project failed during checkstyle execution (#2899) Co-authored-by: SSpirits <[email protected]> Co-authored-by: panzhi33 <[email protected]> Co-authored-by: panzhi <[email protected]> Co-authored-by: ArronHuang <[email protected]> Co-authored-by: von gosling <[email protected]> Co-authored-by: drgnchan <[email protected]> Co-authored-by: zhangjidi2016 <[email protected]> Co-authored-by: ph3636 <[email protected]> Co-authored-by: ph3636 <[email protected]> Co-authored-by: BurningCN <[email protected]> Co-authored-by: francis lee <[email protected]> Co-authored-by: 灼华 <[email protected]> Co-authored-by: yuz10 <[email protected]> Co-authored-by: huangli <[email protected]> Co-authored-by: chenrl <[email protected]> Co-authored-by: ayanamist <[email protected]> Co-authored-by: zhangjidi2016 <[email protected]>
…PullConsumer (apache#2832) * [ISSUE apache#2732] Fix message loss problem when rebalance with LitePullConsumer * Fix message loss problem when rebalance with LitePullConsumer, update 2
…PullConsumer (apache#2832) * [ISSUE apache#2732] Fix message loss problem when rebalance with LitePullConsumer * Fix message loss problem when rebalance with LitePullConsumer, update 2
Make sure set the target branch to
developWhat is the purpose of the change
see issue #2732
this commit will help reproduce the bug : areyouok@a54599e
Brief changelog
Verifying this change
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.