Skip to content

Commit d02b140

Browse files
authored
chore(cubestore): Allow to configure compression type for RocksStore (#6944)
1 parent b2146b8 commit d02b140

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

rust/cubestore/cubestore-sql-tests/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ tar = "0.4.38"
5454
[dev-dependencies]
5555
criterion = { version = "0.4.0", features = ["async_tokio", "html_reports"] }
5656
# Awaiting 0.20.2
57-
rocksdb = { git = "https://github.com/rust-rocksdb/rust-rocksdb", rev = "44dc84171adefbbe75a25b72c35f773a643655a0", default-features = false, features = ["bzip2"] }
57+
rocksdb = { git = "https://github.com/rust-rocksdb/rust-rocksdb", rev = "44dc84171adefbbe75a25b72c35f773a643655a0", default-features = false, features = ["bzip2", "snappy"] }
5858

5959
[[bench]]
6060
name = "in_process"

rust/cubestore/cubestore/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ async-trait = "0.1.36"
4242
actix-rt = "2.7.0"
4343
regex = "1.3.9"
4444
# Awaiting 0.20.2
45-
rocksdb = { git = "https://github.com/rust-rocksdb/rust-rocksdb", rev = "44dc84171adefbbe75a25b72c35f773a643655a0", default-features = false, features = ["bzip2"] }
45+
rocksdb = { git = "https://github.com/rust-rocksdb/rust-rocksdb", rev = "44dc84171adefbbe75a25b72c35f773a643655a0", default-features = false, features = ["bzip2", "snappy"] }
4646
uuid = { version = "0.8", features = ["serde", "v4"] }
4747
num = "0.3.0"
4848
enum_primitive = "0.1.1"

rust/cubestore/cubestore/src/cachestore/cache_rocksstore.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ impl RocksStoreDetails for RocksCacheStoreDetails {
9797
};
9898

9999
opts.set_block_based_table_factory(&block_opts);
100+
opts.set_compression_type(rocksdb_config.compression_type);
100101

101102
DB::open(&opts, path)
102103
.map_err(|err| CubeError::internal(format!("DB::open error for cachestore: {}", err)))

rust/cubestore/cubestore/src/metastore/rocks_store.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use datafusion::cube_ext;
1212
use log::{info, trace};
1313
use rocksdb::backup::{BackupEngine, BackupEngineOptions, RestoreOptions};
1414
use rocksdb::checkpoint::Checkpoint;
15-
use rocksdb::{Env, Snapshot, WriteBatch, WriteBatchIterator, DB};
15+
use rocksdb::{DBCompressionType, Env, Snapshot, WriteBatch, WriteBatchIterator, DB};
1616
use serde::{Deserialize, Serialize};
1717
use std::collections::HashMap;
1818
use std::fmt::Debug;
@@ -520,6 +520,7 @@ impl RocksStoreChecksumType {
520520
pub struct RocksStoreConfig {
521521
pub checksum_type: RocksStoreChecksumType,
522522
pub cache_capacity: usize,
523+
pub compression_type: DBCompressionType,
523524
}
524525

525526
impl RocksStoreConfig {
@@ -528,6 +529,7 @@ impl RocksStoreConfig {
528529
// Supported since RocksDB 6.27
529530
checksum_type: RocksStoreChecksumType::XXH3,
530531
cache_capacity: 8 * 1024 * 1024,
532+
compression_type: DBCompressionType::None,
531533
}
532534
}
533535

@@ -536,6 +538,7 @@ impl RocksStoreConfig {
536538
// Supported since RocksDB 6.27
537539
checksum_type: RocksStoreChecksumType::XXH3,
538540
cache_capacity: 8 * 1024 * 1024,
541+
compression_type: DBCompressionType::None,
539542
}
540543
}
541544
}

0 commit comments

Comments
 (0)