[ISSUE #10108] Broker startup fail in recover (#10109)

This commit is contained in:
yuz10
2026-02-24 13:56:23 +08:00
committed by GitHub
parent b8f8856868
commit 7be720250e
@@ -564,8 +564,10 @@ public class ConsumeQueue implements ConsumeQueueInterface {
SelectMappedBufferResult lastRecord = null;
try {
int maxReadablePosition = lastMappedFile.getReadPosition();
lastRecord = lastMappedFile.selectMappedBuffer(maxReadablePosition - ConsumeQueue.CQ_STORE_UNIT_SIZE,
ConsumeQueue.CQ_STORE_UNIT_SIZE);
if (maxReadablePosition >= ConsumeQueue.CQ_STORE_UNIT_SIZE) {
lastRecord = lastMappedFile.selectMappedBuffer(maxReadablePosition - ConsumeQueue.CQ_STORE_UNIT_SIZE,
ConsumeQueue.CQ_STORE_UNIT_SIZE);
}
if (null != lastRecord) {
ByteBuffer buffer = lastRecord.getByteBuffer();
long commitLogOffset = buffer.getLong();