From 71812d5efdec559fd16dca67f49a87aec25bf0b9 Mon Sep 17 00:00:00 2001 From: TheR1sing3un Date: Sun, 28 May 2023 21:27:51 +0800 Subject: [PATCH] fix(tieredstorage): fix a dead cycle in TieredFileSegmentInputStream 1. fix a dead cycle in TieredFileSegmentInputStream.java 2. remove unused JMH related dependency Closes https://github.com/apache/rocketmq/issues/6624 --- tieredstore/pom.xml | 12 ------------ .../inputstream/TieredFileSegmentInputStream.java | 2 +- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/tieredstore/pom.xml b/tieredstore/pom.xml index 5cd89581c8d..f0179fbf70b 100644 --- a/tieredstore/pom.xml +++ b/tieredstore/pom.xml @@ -53,17 +53,5 @@ commons-io test - - - org.openjdk.jmh - jmh-core - 1.35 - - - org.openjdk.jmh - jmh-generator-annprocess - 1.35 - provided - diff --git a/tieredstore/src/main/java/org/apache/rocketmq/tieredstore/provider/inputstream/TieredFileSegmentInputStream.java b/tieredstore/src/main/java/org/apache/rocketmq/tieredstore/provider/inputstream/TieredFileSegmentInputStream.java index 79efcedbf26..d5118c1464e 100644 --- a/tieredstore/src/main/java/org/apache/rocketmq/tieredstore/provider/inputstream/TieredFileSegmentInputStream.java +++ b/tieredstore/src/main/java/org/apache/rocketmq/tieredstore/provider/inputstream/TieredFileSegmentInputStream.java @@ -156,7 +156,7 @@ public int read(byte[] b, int off, int len) { needRead -= readLen; pos += readLen; posInCurBuffer += readLen; - if (posInCurBuffer == remaining) { + if (posInCurBuffer == curBuffer.remaining()) { // read from next buf bufIndex++; posInCurBuffer = 0;