Skip to content

Commit 7714ca9

Browse files
authored
chore(cubestore): Allow to configure max_background_jobs & max_subcompactions (#7036)
1 parent 3d034e6 commit 7714ca9

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ impl RocksStoreDetails for RocksCacheStoreDetails {
9696
block_opts
9797
};
9898

99+
opts.set_max_background_jobs(rocksdb_config.max_background_jobs as i32);
100+
opts.set_max_subcompactions(rocksdb_config.max_subcompactions);
99101
opts.set_block_based_table_factory(&block_opts);
100102
opts.set_compression_type(rocksdb_config.compression_type);
101103

rust/cubestore/cubestore/src/metastore/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,7 +1224,10 @@ impl RocksStoreDetails for RocksMetaStoreDetails {
12241224
block_opts
12251225
};
12261226

1227+
opts.set_max_background_jobs(rocksdb_config.max_background_jobs as i32);
1228+
opts.set_max_subcompactions(rocksdb_config.max_subcompactions);
12271229
opts.set_block_based_table_factory(&block_opts);
1230+
opts.set_compression_type(rocksdb_config.compression_type);
12281231

12291232
DB::open(&opts, path)
12301233
.map_err(|err| CubeError::internal(format!("DB::open error for metastore: {}", err)))

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

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -629,11 +629,18 @@ impl RocksStoreChecksumType {
629629
}
630630
}
631631

632+
pub type RocksStoreCompressionType = DBCompressionType;
633+
632634
#[derive(Debug, Clone)]
633635
pub struct RocksStoreConfig {
634636
pub checksum_type: RocksStoreChecksumType,
635637
pub cache_capacity: usize,
636-
pub compression_type: DBCompressionType,
638+
pub compression_type: RocksStoreCompressionType,
639+
// Sets maximum number of concurrent background jobs (compactions and flushes).
640+
pub max_background_jobs: u32,
641+
// Sets maximum number of threads that will concurrently perform a compaction job by breaking
642+
// it into multiple, smaller ones that are run simultaneously.
643+
pub max_subcompactions: u32,
637644
}
638645

639646
impl RocksStoreConfig {
@@ -642,7 +649,10 @@ impl RocksStoreConfig {
642649
// Supported since RocksDB 6.27
643650
checksum_type: RocksStoreChecksumType::XXH3,
644651
cache_capacity: 8 * 1024 * 1024,
645-
compression_type: DBCompressionType::None,
652+
compression_type: RocksStoreCompressionType::None,
653+
max_background_jobs: 2,
654+
// Default: 1 (i.e. no subcompactions)
655+
max_subcompactions: 1,
646656
}
647657
}
648658

@@ -651,7 +661,10 @@ impl RocksStoreConfig {
651661
// Supported since RocksDB 6.27
652662
checksum_type: RocksStoreChecksumType::XXH3,
653663
cache_capacity: 8 * 1024 * 1024,
654-
compression_type: DBCompressionType::None,
664+
compression_type: RocksStoreCompressionType::None,
665+
max_background_jobs: 2,
666+
// Default: 1 (i.e. no subcompactions)
667+
max_subcompactions: 1,
655668
}
656669
}
657670
}

0 commit comments

Comments
 (0)