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/06/11 13:31:43 UTC

[GitHub] [rocketmq] BurningCN opened a new issue, #4451: Question about this.lock(mq) in updateProcessQueueTableInRebalance method

BurningCN opened a new issue, #4451:
URL: https://github.com/apache/rocketmq/issues/4451

   
   Because the `put` operation occurs after the `lock`, and the `lock` method will not be able to obtain the `processQueue` and `setLocked(true)`
   So it can only be locked by timed tasks (`lockMQPeriodically`)
   
   ![image](https://user-images.githubusercontent.com/43363120/173189770-ae8784b7-d086-4d8e-bad1-f6b77ede1a38.png)
   


-- 
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.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] MatrixHB commented on issue #4451: Question about this.lock(mq) in updateProcessQueueTableInRebalance method

Posted by GitBox <gi...@apache.org>.
MatrixHB commented on issue #4451:
URL: https://github.com/apache/rocketmq/issues/4451#issuecomment-1155951974

   When executing `if (isOrder && !this.lock(mq))`, the main purpose is to lock the messageQueue in the server-side, `processQueue.setLocked(true);` is secondary.
   ![image](https://user-images.githubusercontent.com/23614576/173732924-a8bac67e-b1ee-4805-965e-4a39b8a6e27a.png)
   


-- 
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] ni-ze commented on issue #4451: Question about this.lock(mq) in updateProcessQueueTableInRebalance method

Posted by GitBox <gi...@apache.org>.
ni-ze commented on issue #4451:
URL: https://github.com/apache/rocketmq/issues/4451#issuecomment-1158444267

   是的,代码的确是这样,processQueueTable中的processQueue.setLocked(true);方法需要等到定时任务才能调用,可以提个pr试试怎么改下看


-- 
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] github-actions[bot] commented on issue #4451: Question about this.lock(mq) in updateProcessQueueTableInRebalance method

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #4451:
URL: https://github.com/apache/rocketmq/issues/4451#issuecomment-1595898157

   This issue 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.


-- 
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] ni-ze commented on issue #4451: Question about this.lock(mq) in updateProcessQueueTableInRebalance method

Posted by GitBox <gi...@apache.org>.
ni-ze commented on issue #4451:
URL: https://github.com/apache/rocketmq/issues/4451#issuecomment-1158428169

   拉取数据前需要rebalance,rebalance之后才能拉取数据,也就是说在拉取消息之前有已经锁定了,调用了processQueue.setLocked(true)方法,在消费数据时自然就不会延迟。这个有延迟的定时任务是周期性去broker端锁定,防止锁定过期


-- 
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] github-actions[bot] closed issue #4451: Question about this.lock(mq) in updateProcessQueueTableInRebalance method

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed issue #4451: Question about this.lock(mq) in updateProcessQueueTableInRebalance method
URL: https://github.com/apache/rocketmq/issues/4451


-- 
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] BurningCN commented on issue #4451: Question about this.lock(mq) in updateProcessQueueTableInRebalance method

Posted by GitBox <gi...@apache.org>.
BurningCN commented on issue #4451:
URL: https://github.com/apache/rocketmq/issues/4451#issuecomment-1158435866

   > 拉取数据前需要rebalance,rebalance之后才能拉取数据,也就是说在拉取消息之前有已经锁定了,调用了processQueue.setLocked(true)方法,在消费数据时自然就不会延迟。这个有延迟的定时任务是周期性去broker端锁定,防止锁定过期
   
   最上面的截图,顺序消费模式,第一次在rebalance的时候会执行`this.lock(mq)`,但是无法置`processQueue.setLocked(true)`,因为取不到`processQueue`(`processQueue`的存入是在`this.lock(mq)`之后的)


-- 
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] BurningCN commented on issue #4451: Question about this.lock(mq) in updateProcessQueueTableInRebalance method

Posted by GitBox <gi...@apache.org>.
BurningCN commented on issue #4451:
URL: https://github.com/apache/rocketmq/issues/4451#issuecomment-1158439979

   在`rebalance`的时候,`this.lock(mq)`执行之后,`mq`在`broker`是锁定的,但是`processQueue.isLocked`还是`false`,然后接着执行`this.processQueueTable.putIfAbsent(mq,pq);`此时table才有了此entry。
   
   这样定时任务`ConsumeMessageOrderlyService#lockMQPeriodically`再次执行lock的时候才能拿到processQueue(前面的entry)并置为locked。而`lockMQPeriodically`第一次执行是在1s后


-- 
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] BurningCN commented on issue #4451: Question about this.lock(mq) in updateProcessQueueTableInRebalance method

Posted by GitBox <gi...@apache.org>.
BurningCN commented on issue #4451:
URL: https://github.com/apache/rocketmq/issues/4451#issuecomment-1156159863

   因为顺序消费需要判断`processQueue.isLocked()`才能往下执行,而目前只有`ConsumeMessageOrderlyService#lockMQPeriodically`触发后才能置为`processQueue.setLocked(true)`(因为初始延迟1s后触发,此时执行如上图代码的时候processQueue不会为null),这样会导致顺序消费模式会延后一段时间才开始消费(1s延迟)
   ![image](https://user-images.githubusercontent.com/43363120/173779628-64ab4436-1b09-4a9d-9f9d-99bdc66ed271.png)
   ![image](https://user-images.githubusercontent.com/43363120/173780791-5974a4d1-36d1-4607-b620-a0d4a769922d.png)
   


-- 
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] github-actions[bot] commented on issue #4451: Question about this.lock(mq) in updateProcessQueueTableInRebalance method

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #4451:
URL: https://github.com/apache/rocketmq/issues/4451#issuecomment-1601842228

   This issue was closed because it has been inactive for 3 days since being marked as stale.


-- 
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