This is an automated email from the ASF dual-hosted git repository.

lizhimins pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


The following commit(s) were added to refs/heads/develop by this push:
     new c6fc39ab5f [ISSUE #10276] Fix PopConsumerService 
changeInvisibilityDuration losing CK record when visibilityTimeout collision 
(#10277)
c6fc39ab5f is described below

commit c6fc39ab5f1661cab5e2d6ff0c215c0add9c6d1d
Author: qianye <[email protected]>
AuthorDate: Wed May 6 11:23:35 2026 +0800

    [ISSUE #10276] Fix PopConsumerService changeInvisibilityDuration losing CK 
record when visibilityTimeout collision (#10277)
---
 .../org/apache/rocketmq/broker/pop/PopConsumerService.java  | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git 
a/broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerService.java 
b/broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerService.java
index da3ccdcdad..9ab5eb651b 100644
--- 
a/broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerService.java
+++ 
b/broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerService.java
@@ -511,8 +511,10 @@ public class PopConsumerService extends ServiceThread {
 
         // No need to generate new records when the group does not exist,
         // because these retry messages will not be consumed by anyone.
-        if (brokerConfig.isPopReviveSkipIfGroupAbsent() &&
-            
!brokerController.getSubscriptionGroupManager().containsSubscriptionGroup(groupId))
 {
+        boolean skipWrite = brokerConfig.isPopReviveSkipIfGroupAbsent() &&
+            
!brokerController.getSubscriptionGroupManager().containsSubscriptionGroup(groupId);
+
+        if (skipWrite) {
             log.info("PopConsumerService change invisibility skip, time={}, " +
                 "groupId={}, topicId={}, queueId={}, offset={}", popTime, 
groupId, topicId, queueId, offset);
         } else {
@@ -525,7 +527,12 @@ public class PopConsumerService extends ServiceThread {
             }
         }
 
-        
this.popConsumerStore.deleteRecords(Collections.singletonList(ackRecord));
+        // If the new CK has the same key as the old CK (same 
visibilityTimeout),
+        // the write already overwrites the old record in RocksDB, skip delete
+        // to avoid removing the newly written record.
+        if (skipWrite || ckRecord.getVisibilityTimeout() != 
ackRecord.getVisibilityTimeout()) {
+            
this.popConsumerStore.deleteRecords(Collections.singletonList(ackRecord));
+        }
     }
 
     // Use broker escape bridge to support remote read

Reply via email to