Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add allow_ingest_behind ffi call for DB Options #808

Merged
merged 7 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/db_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3056,6 +3056,24 @@ impl Options {
ffi::rocksdb_options_set_blob_compaction_readahead_size(self.inner, val);
}
}

/// Set this option to true during creation of database if you want
/// to be able to ingest behind (call IngestExternalFile() skipping keys
/// that already exist, rather than overwriting matching keys).
/// Setting this option to true has the following effects:
/// 1) Disable some internal optimizations around SST file compression.
/// 2) Reserve the last level for ingested files only.
/// 3) Compaction will not include any file from the last level.
/// Note that only Universal Compaction supports allow_ingest_behind.
/// `num_levels` should be >= 3 if this option is turned on.
///
/// DEFAULT: false
/// Immutable.
pub fn set_allow_ingest_behind(&mut self, val: bool) {
unsafe {
ffi::rocksdb_options_set_allow_ingest_behind(self.inner, c_uchar::from(val));
}
}
}

impl Default for Options {
Expand Down
6 changes: 3 additions & 3 deletions tests/test_comparator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ pub fn rocks_old_compare(one: &[u8], two: &[u8]) -> Ordering {
one.cmp(two)
}

type CompareFn = dyn Fn(&[u8], &[u8]) -> Ordering;

/// create database add some values, and iterate over these
pub fn write_to_db_with_comparator(
compare_fn: Box<dyn Fn(&[u8], &[u8]) -> Ordering>,
) -> Vec<String> {
pub fn write_to_db_with_comparator(compare_fn: Box<CompareFn>) -> Vec<String> {
let mut result_vec = Vec::new();

let path = "_path_for_rocksdb_storage";
Expand Down