summaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@wiredtiger.com>2014-07-09 10:03:14 +1000
committerMichael Cahill <michael.cahill@wiredtiger.com>2014-07-09 10:03:14 +1000
commit34c45cb6a3e4e161f1610c6ac604db2e0944412d (patch)
treebd9778e3fa585e857355a23e848e5ea5c052085e /api
parent33692a6a3ad934fa96dd62dfba2ee94fc16d3b01 (diff)
downloadmongo-34c45cb6a3e4e161f1610c6ac604db2e0944412d.tar.gz
Add support for zlib compression to the RocksDB API.
Diffstat (limited to 'api')
-rw-r--r--api/leveldb/include/leveldb/options.h3
-rw-r--r--api/leveldb/leveldb_wt.cc10
2 files changed, 13 insertions, 0 deletions
diff --git a/api/leveldb/include/leveldb/options.h b/api/leveldb/include/leveldb/options.h
index 311a4d82cb0..ae4164bb318 100644
--- a/api/leveldb/include/leveldb/options.h
+++ b/api/leveldb/include/leveldb/options.h
@@ -31,6 +31,9 @@ enum CompressionType {
// part of the persistent format on disk.
kNoCompression = 0x0,
kSnappyCompression = 0x1
+#ifdef HAVE_ROCKSDB
+ , kZlibCompression = 0x2
+#endif
};
// Options to control the behavior of a database (passed to DB::Open)
diff --git a/api/leveldb/leveldb_wt.cc b/api/leveldb/leveldb_wt.cc
index 081dd5f4884..1609b43f3d1 100644
--- a/api/leveldb/leveldb_wt.cc
+++ b/api/leveldb/leveldb_wt.cc
@@ -209,6 +209,10 @@ wtleveldb_create(
s_table << "leaf_item_max=" << options.block_size / 4 << ",";
if (options.compression == leveldb::kSnappyCompression)
s_table << "block_compressor=snappy,";
+#ifdef HAVE_ROCKSDB
+ if (options.compression == leveldb::kZlibCompression)
+ s_table << "block_compressor=zlib,";
+#endif
s_table << "lsm=(";
s_table << "chunk_size=" << options.write_buffer_size << ",";
if (options.filter_policy) {
@@ -246,6 +250,12 @@ leveldb::DB::Open(const Options &options, const std::string &name, leveldb::DB *
if (options.compression == kSnappyCompression)
s_conn << "extensions=[libwiredtiger_snappy.so],";
#endif
+#ifdef HAVE_ROCKSDB
+#ifndef HAVE_BUILTIN_ZLIB
+ if (options.compression == kZlibCompression)
+ s_conn << "extensions=[libwiredtiger_zlib.so],";
+#endif
+#endif
size_t cache_size = 2 * options.write_buffer_size;
cache_size += (size_t)options.max_open_files * (4 << 20);
if (options.block_cache)