Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jerqi committed Apr 12, 2023
1 parent 77d8afb commit 5fab041
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,6 @@ private int uncompress(CompressedShuffleBlock rawBlock, ByteBuffer rawData) {

int uncompressedLen = rawBlock.getUncompressLength();
if (codec != null) {
if (uncompressedData != null) {
LOG.warn("UncompressedData: " + uncompressedLen + " Capacity: " + uncompressedData.capacity());
}
if (uncompressedData == null || uncompressedData.capacity() < uncompressedLen) {
if (uncompressedData != null) {
RssUtils.releaseByteBuffer(uncompressedData);
Expand All @@ -161,12 +158,12 @@ private int uncompress(CompressedShuffleBlock rawBlock, ByteBuffer rawData) {
unCompressedBytesLength += uncompressedLen;
long decompressDuration = System.currentTimeMillis() - startDecompress;
decompressTime += decompressDuration;
// ByteBuffer's limit may not uncompressDataLength after using compress method.
// So we need set limit here.
uncompressedData.limit(uncompressedData.position() + uncompressedLen);
} else {
uncompressedData = rawData;
}
// ByteBuffer's limit may not uncompressDataLength after using compress method.
// So we need set limit here.
uncompressedData.limit(uncompressedData.position() + uncompressedLen);
return uncompressedLen;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public ByteBuffer readAsByteBuffer(long offset, int length) {
public ByteBuffer readAsByteBuffer() {
try {
long length = getFileLen();
if (length > Integer.MAX_VALUE) {
if (length - fsDataInputStream.getPos() > Integer.MAX_VALUE) {
LOG.warn("File " + path + "length is too long");
return ByteBuffer.allocateDirect(0);
}
Expand Down

0 comments on commit 5fab041

Please sign in to comment.