From c055ee733435147f01d1d61ac00ad63f1d917087 Mon Sep 17 00:00:00 2001 From: chrislu Date: Sun, 11 Aug 2024 20:59:32 -0700 Subject: [PATCH] fix reading chunk length calculation --- .../java/client/src/main/java/seaweedfs/client/SeaweedRead.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/other/java/client/src/main/java/seaweedfs/client/SeaweedRead.java b/other/java/client/src/main/java/seaweedfs/client/SeaweedRead.java index 23fb14ebb..cac85d186 100644 --- a/other/java/client/src/main/java/seaweedfs/client/SeaweedRead.java +++ b/other/java/client/src/main/java/seaweedfs/client/SeaweedRead.java @@ -103,7 +103,7 @@ public class SeaweedRead { chunkCache.setChunk(chunkView.fileId, chunkData); } - int len = (int) chunkView.size; + int len = (int) chunkView.size - (int) (startOffset - chunkView.logicOffset); LOG.debug("readChunkView fid:{} chunkData.length:{} chunkView.offset:{} chunkView[{};{}) startOffset:{}", chunkView.fileId, chunkData.length, chunkView.offset, chunkView.logicOffset, chunkView.logicOffset + chunkView.size, startOffset); buf.put(chunkData, (int) (startOffset - chunkView.logicOffset + chunkView.offset), len);