From 33c5534c84d8a4638cda391cbc0030126b6eac46 Mon Sep 17 00:00:00 2001 From: Tpt Date: Fri, 11 Jan 2019 15:52:42 +0100 Subject: [PATCH] Updates RocksDB and makes it do some compression --- lib/Cargo.toml | 2 +- lib/src/store/rocksdb.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 5d67424a..2f7440b3 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -17,7 +17,7 @@ travis-ci = { repository = "Tpt/rudf" } [dependencies] lazy_static = "1" -rocksdb = { version = "0.10", optional = true } +rocksdb = { version = "0.11", optional = true } url = "1" uuid = { version = "0.7", features = ["v4"] } bzip2 = "0.3" diff --git a/lib/src/store/rocksdb.rs b/lib/src/store/rocksdb.rs index 46ae9fde..f5b9ec12 100644 --- a/lib/src/store/rocksdb.rs +++ b/lib/src/store/rocksdb.rs @@ -7,6 +7,8 @@ use byteorder::ByteOrder; use byteorder::LittleEndian; use failure::format_err; use rocksdb::ColumnFamily; +use rocksdb::DBCompactionStyle; +use rocksdb::DBCompressionType; use rocksdb::DBRawIterator; use rocksdb::Options; use rocksdb::WriteBatch; @@ -63,6 +65,8 @@ impl RocksDbStore { let mut options = Options::default(); options.create_if_missing(true); options.create_missing_column_families(true); + options.set_compaction_style(DBCompactionStyle::Universal); + options.set_compression_type(DBCompressionType::Lz4hc); let db = DB::open_cf(&options, path, &COLUMN_FAMILIES)?; let id2str_cf = SendColumnFamily(get_cf(&db, STR2ID_CF)?); @@ -552,7 +556,6 @@ fn to_bytes(int: u64) -> [u8; 8] { // TODO: very bad but I believe it is fine #[derive(Clone, Copy)] struct SendColumnFamily(ColumnFamily); -unsafe impl Send for SendColumnFamily {} unsafe impl Sync for SendColumnFamily {} impl Deref for SendColumnFamily {