caigy commented on code in PR #5456:
URL: https://github.com/apache/rocketmq/pull/5456#discussion_r1014951958
##########
store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:
##########
@@ -1001,4 +1002,20 @@ public void swapMap(int reserveNum, long
forceSwapIntervalMs, long normalSwapInt
public void cleanSwappedMap(long forceCleanSwapIntervalMs) {
mappedFileQueue.cleanSwappedMap(forceCleanSwapIntervalMs);
}
+
+ private int getEarliestOffset(int targetOffset, ByteBuffer byteBuffer,
long currentStoreTime) {
+ if (targetOffset == 0) {
+ return targetOffset;
+ }
+ int preOffset = targetOffset - CQ_STORE_UNIT_SIZE;
+ byteBuffer.position(preOffset);
+ long prePhyOffset = byteBuffer.getLong();
+ int preSize = byteBuffer.getInt();
+ long preStoreTime =
+
this.messageStore.getCommitLog().pickupStoreTimestamp(prePhyOffset, preSize);
+ if (currentStoreTime == preStoreTime) {
+ targetOffset = getEarliestOffset(preOffset, byteBuffer,
preStoreTime);
+ }
Review Comment:
If the batch is large, it may cause a deep recursion. Would it be better to
turn this recursion into iteration?
--
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]