GitHub user Willhow-Gao closed a discussion: 
ConsumeMessageOrderlyService消费消息时,对processQueue的consumeLock加读锁的作用是什么

看网上的资料都说加锁是为了防止当前consumer还在消费,且没有提交位移时发生了重平衡,正在消费的messagequeue被分配给了其他消费者,导致重复消费。但是通过阅读源码发现,在发生锁争抢时,processQueue是dropped状态,即使加了读锁保证消费完了才继续重分配,消费位移还是无法被提交。还是我理解有误?
ConsumeMessageOrderlyService内部类ConsumeRequest#run的部分代码
![image](https://github.com/apache/rocketmq/assets/65004897/c5c4fdb9-f710-413e-9202-ee36ad05c0dc)
![image](https://github.com/apache/rocketmq/assets/65004897/6fa24539-f3de-4b4f-9fb9-19ecdf677ec3)
![image](https://github.com/apache/rocketmq/assets/65004897/8b656448-e2e6-4636-81f7-12430f2d2106)
顺序消费的重平衡逻辑实现类RebalancePushImpl里的部分代码
![image](https://github.com/apache/rocketmq/assets/65004897/e3c41786-9f10-47c8-b372-3b6332bcaf02)



GitHub link: https://github.com/apache/rocketmq/discussions/8114

----
This is an automatically sent email for dev@rocketmq.apache.org.
To unsubscribe, please send an email to: dev-unsubscr...@rocketmq.apache.org

Reply via email to