Skip to content

Commit 7be7202

Browse files
authored
[ISSUE #10108] Broker startup fail in recover (#10109)
1 parent b8f8856 commit 7be7202

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -564,8 +564,10 @@ public void correctMinOffset(long minCommitLogOffset) {
564564
SelectMappedBufferResult lastRecord = null;
565565
try {
566566
int maxReadablePosition = lastMappedFile.getReadPosition();
567-
lastRecord = lastMappedFile.selectMappedBuffer(maxReadablePosition - ConsumeQueue.CQ_STORE_UNIT_SIZE,
568-
ConsumeQueue.CQ_STORE_UNIT_SIZE);
567+
if (maxReadablePosition >= ConsumeQueue.CQ_STORE_UNIT_SIZE) {
568+
lastRecord = lastMappedFile.selectMappedBuffer(maxReadablePosition - ConsumeQueue.CQ_STORE_UNIT_SIZE,
569+
ConsumeQueue.CQ_STORE_UNIT_SIZE);
570+
}
569571
if (null != lastRecord) {
570572
ByteBuffer buffer = lastRecord.getByteBuffer();
571573
long commitLogOffset = buffer.getLong();

0 commit comments

Comments
 (0)