From 57023c8ba93a5c43793c4e109e1c020d00eebc80 Mon Sep 17 00:00:00 2001 From: Shay Banon Date: Wed, 4 Jul 2012 17:14:12 +0200 Subject: [PATCH] Compression: Support snappy as a compression option, closes #2081. --- pom.xml | 10 +- src/main/assemblies/common-bin.xml | 1 + .../client/transport/TransportClient.java | 3 + .../elasticsearch/cluster/ClusterState.java | 2 +- .../common/compress/CompressedIndexInput.java | 23 ++-- .../compress/CompressedIndexOutput.java | 13 +- .../compress/CompressedStreamInput.java | 9 +- .../compress/CompressedStreamOutput.java | 13 +- .../common/compress/Compressor.java | 3 + .../common/compress/CompressorContext.java | 25 ++++ .../common/compress/CompressorFactory.java | 51 ++++++- .../compress/lzf/LZFCompressedIndexInput.java | 5 +- .../lzf/LZFCompressedIndexOutput.java | 5 +- .../lzf/LZFCompressedStreamInput.java | 7 +- .../lzf/LZFCompressedStreamOutput.java | 5 +- .../common/compress/lzf/LZFCompressor.java | 5 + .../compress/lzf/LZFCompressorContext.java | 29 ++++ .../snappy/SnappyCompressedIndexInput.java | 67 +++++++++ .../snappy/SnappyCompressedIndexOutput.java | 64 +++++++++ .../snappy/SnappyCompressedStreamInput.java | 72 ++++++++++ .../snappy/SnappyCompressedStreamOutput.java | 64 +++++++++ .../compress/snappy/SnappyCompressor.java | 128 ++++++++++++++++++ .../snappy/SnappyCompressorContext.java | 43 ++++++ .../snappy/UnavailableSnappyCompressor.java | 77 +++++++++++ .../compress/snappy/xerial/XerialSnappy.java | 45 ++++++ .../XerialSnappyCompressedIndexInput.java | 49 +++++++ .../XerialSnappyCompressedIndexOutput.java | 51 +++++++ .../XerialSnappyCompressedStreamInput.java | 54 ++++++++ .../XerialSnappyCompressedStreamOutput.java | 51 +++++++ .../snappy/xerial/XerialSnappyCompressor.java | 68 ++++++++++ .../org/elasticsearch/common/io/Streams.java | 4 +- .../common/io/stream/AdapterStreamOutput.java | 2 +- .../common/io/stream/CachedStreamOutput.java | 31 ++--- .../common/io/stream/HandlesStreamOutput.java | 10 +- .../zen/ping/multicast/MulticastZenPing.java | 2 +- .../publish/PublishClusterStateAction.java | 2 +- .../gateway/blobstore/BlobStoreGateway.java | 4 +- .../state/meta/LocalGatewayMetaState.java | 4 +- .../state/shards/LocalGatewayShardsState.java | 2 +- .../index/mapper/core/BinaryFieldMapper.java | 2 +- .../mapper/internal/SourceFieldMapper.java | 12 +- .../index/translog/fs/FsTranslog.java | 2 +- .../node/internal/InternalNode.java | 3 + .../action/support/RestXContentBuilder.java | 2 +- .../transport/local/LocalTransport.java | 2 +- .../local/LocalTransportChannel.java | 7 +- .../netty/NettyTransportChannel.java | 5 +- .../transport/support/TransportStreams.java | 8 +- .../compress/LuceneCompressionBenchmark.java | 29 ++-- .../compress/SearchSourceCompressTests.java | 29 +++- .../CompressIndexInputOutputTests.java | 86 +++++++++--- .../compress/CompressedStringTests.java | 14 +- .../common/io/streams/BytesStreamsTests.java | 2 +- 53 files changed, 1173 insertions(+), 133 deletions(-) create mode 100644 src/main/java/org/elasticsearch/common/compress/CompressorContext.java create mode 100644 src/main/java/org/elasticsearch/common/compress/lzf/LZFCompressorContext.java create mode 100644 src/main/java/org/elasticsearch/common/compress/snappy/SnappyCompressedIndexInput.java create mode 100644 src/main/java/org/elasticsearch/common/compress/snappy/SnappyCompressedIndexOutput.java create mode 100644 src/main/java/org/elasticsearch/common/compress/snappy/SnappyCompressedStreamInput.java create mode 100644 src/main/java/org/elasticsearch/common/compress/snappy/SnappyCompressedStreamOutput.java create mode 100644 src/main/java/org/elasticsearch/common/compress/snappy/SnappyCompressor.java create mode 100644 src/main/java/org/elasticsearch/common/compress/snappy/SnappyCompressorContext.java create mode 100644 src/main/java/org/elasticsearch/common/compress/snappy/UnavailableSnappyCompressor.java create mode 100644 src/main/java/org/elasticsearch/common/compress/snappy/xerial/XerialSnappy.java create mode 100644 src/main/java/org/elasticsearch/common/compress/snappy/xerial/XerialSnappyCompressedIndexInput.java create mode 100644 src/main/java/org/elasticsearch/common/compress/snappy/xerial/XerialSnappyCompressedIndexOutput.java create mode 100644 src/main/java/org/elasticsearch/common/compress/snappy/xerial/XerialSnappyCompressedStreamInput.java create mode 100644 src/main/java/org/elasticsearch/common/compress/snappy/xerial/XerialSnappyCompressedStreamOutput.java create mode 100644 src/main/java/org/elasticsearch/common/compress/snappy/xerial/XerialSnappyCompressor.java diff --git a/pom.xml b/pom.xml index b3ccc199223..fa9b30bd4ed 100644 --- a/pom.xml +++ b/pom.xml @@ -184,6 +184,14 @@ true + + org.xerial.snappy + snappy-java + 1.0.4.1 + compile + true + +