Skip to content

Commit

Permalink
JVM crash issue in snappy compressor
Browse files Browse the repository at this point in the history
  • Loading branch information
akashrn5 committed Jan 7, 2019
1 parent 28432e3 commit b50d1c8
Showing 1 changed file with 0 additions and 22 deletions.
Expand Up @@ -17,10 +17,8 @@

package org.apache.carbondata.core.datastore.page;

import java.io.IOException;
import java.math.BigDecimal;

import org.apache.carbondata.core.datastore.compression.Compressor;
import org.apache.carbondata.core.datastore.page.encoding.ColumnPageEncoderMeta;
import org.apache.carbondata.core.memory.CarbonUnsafe;
import org.apache.carbondata.core.memory.MemoryBlock;
Expand Down Expand Up @@ -541,26 +539,6 @@ public long getPageLengthInBytes() {
return totalLength;
}

@Override public byte[] compress(Compressor compressor) throws MemoryException, IOException {
if (UnsafeMemoryManager.isOffHeap() && compressor.supportUnsafe()) {
// use raw compression and copy to byte[]
int inputSize = totalLength;
long compressedMaxSize = compressor.maxCompressedLength(inputSize);
MemoryBlock compressed =
UnsafeMemoryManager.allocateMemoryWithRetry(taskId, compressedMaxSize);
long outSize = compressor.rawCompress(baseOffset, inputSize, compressed.getBaseOffset());
assert outSize < Integer.MAX_VALUE;
byte[] output = new byte[(int) outSize];
CarbonUnsafe.getUnsafe()
.copyMemory(compressed.getBaseObject(), compressed.getBaseOffset(), output,
CarbonUnsafe.BYTE_ARRAY_OFFSET, outSize);
UnsafeMemoryManager.INSTANCE.freeMemory(taskId, compressed);
return output;
} else {
return super.compress(compressor);
}
}

/**
* reallocate memory if capacity length than current size + request size
*/
Expand Down

0 comments on commit b50d1c8

Please sign in to comment.