From 66cf564c67a722dbb6de7c7525db19f5d8d8fca8 Mon Sep 17 00:00:00 2001 From: mxsm Date: Sun, 2 Apr 2023 09:52:48 +0800 Subject: [PATCH] [ISSUE #6523] Schematic diagram of adding BatchConsumeQueue storage unit (#6524) --- .../rocketmq/store/queue/BatchConsumeQueue.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java b/store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java index 8a307b957e..e60f09bce2 100644 --- a/store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java +++ b/store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java @@ -44,7 +44,20 @@ import org.apache.rocketmq.store.logfile.MappedFile; public class BatchConsumeQueue implements ConsumeQueueInterface, FileQueueLifeCycle { protected static final Logger log = LoggerFactory.getLogger(LoggerName.STORE_LOGGER_NAME); - //position 8, size 4, tagscode 8, storetime 8, msgBaseOffset 8, batchSize 2, compactedOffset 4, reserved 4 + /** + * BatchConsumeQueue's store unit. Format: + *
+     * ┌─────────────────────────┬───────────┬────────────┬──────────┬─────────────┬─────────┬───────────────┬─────────┐
+     * │CommitLog Physical Offset│ Body Size │Tag HashCode│Store time│msgBaseOffset│batchSize│compactedOffset│reserved │
+     * │        (8 Bytes)        │ (4 Bytes) │ (8 Bytes)  │(8 Bytes) │(8 Bytes)    │(2 Bytes)│   (4 Bytes)   │(4 Bytes)│
+     * ├─────────────────────────┴───────────┴────────────┴──────────┴─────────────┴─────────┴───────────────┴─────────┤
+     * │                                                  Store Unit                                                   │
+     * │                                                                                                               │
+     * 
+ * BatchConsumeQueue's store unit. Size: + * CommitLog Physical Offset(8) + Body Size(4) + Tag HashCode(8) + Store time(8) + + * msgBaseOffset(8) + batchSize(2) + compactedOffset(4) + reserved(4)= 46 Bytes + */ public static final int CQ_STORE_UNIT_SIZE = 46; public static final int MSG_TAG_OFFSET_INDEX = 12; public static final int MSG_STORE_TIME_OFFSET_INDEX = 20;