cserwen edited a comment on issue #3491:
URL: https://github.com/apache/rocketmq/issues/3491#issuecomment-971255903


   > I agree with you, but I think the main function of this lock is to save 
the offset scene at the time when the offset is rolled back, which is 
convenient for checking the problem, it does increase the lock competition. Do 
you have a better way to balance performance and problem site information?
   
   I don't understand when the offset rollback will happen, so I can't get the 
effect of this lock. 
   I have a solution that we can use the `PopLongPollingService` thread to scan 
the requests in the `pollingMap` to determine if the locks corresponding to 
those requests can be acquired, and if possible, we will `wakeUp` these 
requests in advance.
   The code is here: 
https://github.com/apache/rocketmq/blob/4506f34e24714ec4d6ac37babd8f096632fd6b1c/broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java#L808
   
   just like this:
   ```java
   if (!PopMessageProcessor.this.queueLockManager.isLock(key)) {  
       totalPollingNum.decrementAndGet();
       wakeUp(first);
       continue;
   }    //above lines.
   
   if (!first.isTimeout()) {
       if (popQ.add(first)) {
           break;
       } else {
           POP_LOGGER.info("polling, add fail again: {}", first);
       }
   }
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to