On Solaris, default LZF compress type (for transport) can cause segfault

closes #3634
This commit is contained in:
Shay Banon 2013-09-06 00:41:14 +02:00
parent b3d51df493
commit 95b894e6f6
1 changed files with 6 additions and 1 deletions

View File

@ -24,6 +24,7 @@ import com.ning.compress.lzf.LZFChunk;
import com.ning.compress.lzf.LZFEncoder; import com.ning.compress.lzf.LZFEncoder;
import com.ning.compress.lzf.util.ChunkDecoderFactory; import com.ning.compress.lzf.util.ChunkDecoderFactory;
import org.apache.lucene.store.IndexInput; import org.apache.lucene.store.IndexInput;
import org.apache.lucene.util.Constants;
import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.compress.CompressedIndexInput; import org.elasticsearch.common.compress.CompressedIndexInput;
import org.elasticsearch.common.compress.CompressedStreamInput; import org.elasticsearch.common.compress.CompressedStreamInput;
@ -48,7 +49,11 @@ public class LZFCompressor implements Compressor {
private ChunkDecoder decoder; private ChunkDecoder decoder;
public LZFCompressor() { public LZFCompressor() {
if (Constants.SUN_OS) {
this.decoder = ChunkDecoderFactory.safeInstance();
} else {
this.decoder = ChunkDecoderFactory.optimalInstance(); this.decoder = ChunkDecoderFactory.optimalInstance();
}
Loggers.getLogger(LZFCompressor.class).debug("using [{}] decoder", this.decoder.getClass().getSimpleName()); Loggers.getLogger(LZFCompressor.class).debug("using [{}] decoder", this.decoder.getClass().getSimpleName());
} }