You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by xi...@apache.org on 2023/05/17 09:09:08 UTC
[iotdb] 01/02: fix bug when cast postion in cache and tsfile
This is an automated email from the ASF dual-hosted git repository.
xingtanzjr pushed a commit to branch tiered_storage
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit b7c436101a9f2fe78a0c2117a9b3983d1d150a27
Author: Jinrui.Zhang <xi...@gmail.com>
AuthorDate: Wed May 17 15:47:00 2023 +0800
fix bug when cast postion in cache and tsfile
---
.../src/main/java/org/apache/iotdb/os/cache/OSFileCacheValue.java | 4 ++++
.../src/main/java/org/apache/iotdb/os/cache/OSFileChannel.java | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/object-storage/src/main/java/org/apache/iotdb/os/cache/OSFileCacheValue.java b/object-storage/src/main/java/org/apache/iotdb/os/cache/OSFileCacheValue.java
index ff8c985f6f..1eed2f6e72 100644
--- a/object-storage/src/main/java/org/apache/iotdb/os/cache/OSFileCacheValue.java
+++ b/object-storage/src/main/java/org/apache/iotdb/os/cache/OSFileCacheValue.java
@@ -84,6 +84,10 @@ public class OSFileCacheValue {
return endPositionInTsFile;
}
+ public long getEndPositionInCacheFile() {
+ return startPositionInCacheFile + getLength();
+ }
+
/**
* Convert position in the TsFile to the corresponding position in the cache file. Return -1 when
* the position is outside the cache file range
diff --git a/object-storage/src/main/java/org/apache/iotdb/os/cache/OSFileChannel.java b/object-storage/src/main/java/org/apache/iotdb/os/cache/OSFileChannel.java
index 0380e540f4..b5cee34dcc 100644
--- a/object-storage/src/main/java/org/apache/iotdb/os/cache/OSFileChannel.java
+++ b/object-storage/src/main/java/org/apache/iotdb/os/cache/OSFileChannel.java
@@ -115,7 +115,7 @@ public class OSFileChannel implements Closeable {
long readStartPosition = cacheFile.convertTsFilePos2CachePos(startPos);
long readEndPosition = cacheFile.convertTsFilePos2CachePos(endPos);
if (readEndPosition < 0) {
- readEndPosition = cacheFile.getEndPositionInTsFile();
+ readEndPosition = cacheFile.getEndPositionInCacheFile();
}
int readSize = (int) (readEndPosition - readStartPosition);
cacheFileChannel.position(readStartPosition);