fix reading chunk length calculation

This commit is contained in:
chrislu 2024-08-11 20:59:32 -07:00
parent 270e91b0be
commit c055ee7334

View File

@ -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);