RockteMQ-AI commented on code in PR #10930:
URL: https://github.com/apache/rocketmq/pull/10930#discussion_r3783651944


##########
common/src/main/java/org/apache/rocketmq/common/lite/LiteSubscription.java:
##########
@@ -17,34 +17,28 @@
 
 package org.apache.rocketmq.common.lite;
 
-import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
 public class LiteSubscription {
     private String group;
     private String topic;
-    private final Set<String> liteTopicSet = ConcurrentHashMap.newKeySet();
+    private final Set<String> lmqSet = ConcurrentHashMap.newKeySet();
     private volatile long updateTime = System.currentTimeMillis();
 
-    public boolean addLiteTopic(String liteTopic) {
-        updateTime();
-        return this.liteTopicSet.add(liteTopic);
-    }
-
-    public void addLiteTopic(Collection<String> set) {
-        updateTime();
-        this.liteTopicSet.addAll(set);
+    public LiteSubscription touch() {
+        this.updateTime = System.currentTimeMillis();

Review Comment:
   **[Warning]** The removal of automatic `updateTime()` from 
`addLmq()`/`removeLmq()` and requiring explicit `touch()` is a behavioral 
change. Please verify all callers remember to call `touch()` after modifying 
the lmq set, otherwise the subscription may be incorrectly evicted due to stale 
`updateTime`.



##########
broker/src/main/java/org/apache/rocketmq/broker/lite/AbstractLiteLifecycleManager.java:
##########
@@ -69,21 +76,52 @@ public boolean init() {
     }
 
     /**
-     * This method actually returns NEXT slot index to use, starting from 0
+     * Populate the prefix index once at startup. Must be called after {@link 
#init()}.
      */
-    public abstract long getMaxOffsetInQueue(String lmqName);
+    public void bootstrapLmqPrefixIndex() {
+        long start = System.currentTimeMillis();

Review Comment:
   **[Info]** `bootstrapLmqPrefixIndex()` iterates all lmqs at startup. Ensure 
this is called after the broker is fully initialized and no concurrent lmq 
create/delete operations are in progress, otherwise the index may be 
inconsistent. Consider adding a comment about the expected call order.



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