Github user fuyou001 commented on a diff in the pull request: https://github.com/apache/incubator-rocketmq/pull/159#discussion_r136494489 --- Diff: store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java --- @@ -84,6 +84,58 @@ public boolean load() { return result; } + public void checkCommitLogAndConsumeQueueConsistent() { + + String queueDir = this.storePath + + File.separator + topic + + File.separator + queueId + File.separator; + + long lastRecordOffset = Math.max(getMaxOffsetInQueue() - 1, 0); + + if (lastRecordOffset == 0) { + return; + } + + SelectMappedBufferResult consumeQueueBuffer = getIndexBuffer(lastRecordOffset); + + if (consumeQueueBuffer == null) { + String errorMsg = String.format("Can't find consume queue mappedBuffer by offset %s,queueDir %s", lastRecordOffset, queueDir); + log.error(errorMsg); + throw new IllegalStateException(errorMsg); + } + + //position latest consume queue offset, + long offsetPy = consumeQueueBuffer.getByteBuffer().getLong(); + int sizePy = consumeQueueBuffer.getByteBuffer().getInt(); + consumeQueueBuffer.getByteBuffer().getLong(); --- End diff -- fixed
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---