Browse Source

fix reading chunk length calculation

pull/5890/head
chrislu 4 months ago
parent
commit
c055ee7334
  1. 2
      other/java/client/src/main/java/seaweedfs/client/SeaweedRead.java

2
other/java/client/src/main/java/seaweedfs/client/SeaweedRead.java

@ -103,7 +103,7 @@ public class SeaweedRead {
chunkCache.setChunk(chunkView.fileId, chunkData); 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:{}", LOG.debug("readChunkView fid:{} chunkData.length:{} chunkView.offset:{} chunkView[{};{}) startOffset:{}",
chunkView.fileId, chunkData.length, chunkView.offset, chunkView.logicOffset, chunkView.logicOffset + chunkView.size, startOffset); chunkView.fileId, chunkData.length, chunkView.offset, chunkView.logicOffset, chunkView.logicOffset + chunkView.size, startOffset);
buf.put(chunkData, (int) (startOffset - chunkView.logicOffset + chunkView.offset), len); buf.put(chunkData, (int) (startOffset - chunkView.logicOffset + chunkView.offset), len);

Loading…
Cancel
Save