[ISSUE #7585] Always return duplicate buffer when filter message and fix log format (#7654)

This commit is contained in:
lizhimins
2023-12-13 19:50:19 +08:00
committed by GitHub
parent a376fbcdb8
commit 50a92a2474
2 changed files with 3 additions and 4 deletions
@@ -23,7 +23,6 @@ import org.apache.rocketmq.store.GetMessageResult;
import org.apache.rocketmq.store.GetMessageStatus;
import org.apache.rocketmq.store.MessageFilter;
import org.apache.rocketmq.store.SelectMappedBufferResult;
import org.apache.rocketmq.tieredstore.util.MessageBufferUtil;
public class GetMessageResultExt extends GetMessageResult {
@@ -63,9 +62,9 @@ public class GetMessageResultExt extends GetMessageResult {
continue;
}
long offset = this.getMessageQueueOffset().get(i);
result.addMessage(new SelectMappedBufferResult(bufferResult.getStartOffset(),
bufferResult.getByteBuffer(), bufferResult.getSize(), null),
MessageBufferUtil.getQueueOffset(bufferResult.getByteBuffer()));
bufferResult.getByteBuffer().asReadOnlyBuffer(), bufferResult.getSize(), null), offset);
}
if (result.getBufferTotalSize() == 0) {
@@ -367,7 +367,7 @@ public abstract class TieredFileSegment implements Comparable<TieredFileSegment>
if (fileSegmentInputStream != null) {
long fileSize = this.getSize();
if (fileSize == -1L) {
logger.error("Get commit position error before commit, Commit: %d, Expect: %d, Current Max: %d, FileName: %s",
logger.error("Get commit position error before commit, Commit: {}, Expect: {}, Current Max: {}, FileName: {}",
commitPosition, commitPosition + fileSegmentInputStream.getContentLength(), appendPosition, getPath());
releaseCommitLock();
return CompletableFuture.completedFuture(false);