Skip to content

Commit

Permalink
[WIP] Expose WAL compression option
Browse files Browse the repository at this point in the history
Signed-off-by: Bisheng Huang <[email protected]>
  • Loading branch information
hbisheng committed Aug 22, 2024
1 parent af14652 commit f4c5733
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 6 deletions.
8 changes: 4 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[submodule "rocksdb"]
path = librocksdb_sys/rocksdb
url = https://github.com/v01dstar/rocksdb.git
branch = 8.10-tikv
url = https://github.com/hbisheng/rocksdb.git
branch = fix-pri

[submodule "titan"]
path = librocksdb_sys/libtitan_sys/titan
url = https://github.com/v01dstar/titan.git
branch = upgrade-rocksdb
url = https://github.com/hbisheng/titan.git
branch = fix-pri
8 changes: 8 additions & 0 deletions librocksdb_sys/crocksdb/c.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5070,6 +5070,14 @@ void crocksdb_options_set_min_level_to_compress(crocksdb_options_t* opt,
}
}

uint32_t crocksdb_options_get_wal_compression(crocksdb_options_t* opt) {
return static_cast<uint32_t>(opt->rep.wal_compression);
}

void crocksdb_options_set_wal_compression(crocksdb_options_t* opt, int compression_type) {
opt->rep.wal_compression = static_cast<CompressionType>(compression_type);
}

size_t crocksdb_livefiles_count(const crocksdb_livefiles_t* lf) {
return static_cast<int>(lf->rep.size());
}
Expand Down
5 changes: 5 additions & 0 deletions librocksdb_sys/crocksdb/crocksdb/c.h
Original file line number Diff line number Diff line change
Expand Up @@ -1345,6 +1345,11 @@ extern C_ROCKSDB_LIBRARY_API void crocksdb_options_set_plain_table_factory(
extern C_ROCKSDB_LIBRARY_API void crocksdb_options_set_min_level_to_compress(
crocksdb_options_t* opt, int level);

extern C_ROCKSDB_LIBRARY_API uint32_t crocksdb_options_get_wal_compression(
crocksdb_options_t* opt);
extern C_ROCKSDB_LIBRARY_API void crocksdb_options_set_wal_compression(
crocksdb_options_t* opt, int compression_type);

extern C_ROCKSDB_LIBRARY_API void crocksdb_options_set_memtable_huge_page_size(
crocksdb_options_t*, size_t);

Expand Down
2 changes: 1 addition & 1 deletion librocksdb_sys/libtitan_sys/titan
Submodule titan updated 1 files
+2 −2 CMakeLists.txt
2 changes: 1 addition & 1 deletion librocksdb_sys/rocksdb
Submodule rocksdb updated 1 files
+1 −0 db/write_thread.h
5 changes: 5 additions & 0 deletions librocksdb_sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,11 @@ extern "C" {
zstd_max_train_bytes: c_int,
parallel_threads: c_int,
);
pub fn crocksdb_options_set_wal_compression(
options: *mut Options,
compression_style_no: DBCompressionType,
);
pub fn crocksdb_options_get_wal_compression(options: *mut Options) -> DBCompressionType;
pub fn crocksdb_options_set_bottommost_compression_options(
options: *mut Options,
window_bits: c_int,
Expand Down
8 changes: 8 additions & 0 deletions src/rocksdb_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,14 @@ impl DBOptions {
}
}

pub fn set_wal_compression(&self, c: DBCompressionType) {
unsafe { crocksdb_ffi::crocksdb_options_set_wal_compression(self.inner, c) }
}

pub fn get_wal_compression(&self) -> DBCompressionType {
unsafe { crocksdb_ffi::crocksdb_options_get_wal_compression(self.inner) }
}

pub fn set_delayed_write_rate(&mut self, rate: u64) {
unsafe {
crocksdb_ffi::crocksdb_options_set_delayed_write_rate(self.inner, rate);
Expand Down

0 comments on commit f4c5733

Please sign in to comment.