Skip to content

Commit

Permalink
Update RocksDB to 8.5.3 (#815)
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasf committed Sep 21, 2023
1 parent 36ac5ef commit 734cf99
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ serde1 = ["serde"]

[dependencies]
libc = "0.2"
librocksdb-sys = { path = "librocksdb-sys", version = "0.11.0" }
librocksdb-sys = { path = "librocksdb-sys", version = "0.12.0" }
serde = { version = "1", features = [ "derive" ], optional = true }

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion librocksdb-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "librocksdb-sys"
version = "0.11.0+8.3.2"
version = "0.12.0+8.5.3"
edition = "2018"
rust-version = "1.63"
authors = ["Karl Hobley <karlhobley10@gmail.com>", "Arkadiy Paronyan <arkadiy@ethcore.io>"]
Expand Down
8 changes: 4 additions & 4 deletions librocksdb-sys/build_version.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@

// The build script may replace these values with real values based
// on whether or not GIT is available and the platform settings
static const std::string rocksdb_build_git_sha = "3f7c92b9753b697ce6a5ea737086d2751f17956c";
static const std::string rocksdb_build_git_tag = "rocksdb_build_git_tag:v8.3.2";
static const std::string rocksdb_build_git_sha = "f32521662acf3352397d438b732144c7813bbbec";
static const std::string rocksdb_build_git_tag = "rocksdb_build_git_tag:v8.5.3";
#define HAS_GIT_CHANGES 0
#if HAS_GIT_CHANGES == 0
// If HAS_GIT_CHANGES is 0, the GIT date is used.
// Use the time the branch/tag was last modified
static const std::string rocksdb_build_date = "rocksdb_build_date:2023-06-15 05:32:14";
static const std::string rocksdb_build_date = "rocksdb_build_date:2023-09-01 20:58:39";
#else
// If HAS_GIT_CHANGES is > 0, the branch/tag has modifications.
// Use the time the build was created.
static const std::string rocksdb_build_date = "rocksdb_build_date:2023-06-15 05:32:14";
static const std::string rocksdb_build_date = "rocksdb_build_date:2023-09-01 20:58:39";
#endif

std::unordered_map<std::string, ROCKSDB_NAMESPACE::RegistrarFunc> ROCKSDB_NAMESPACE::ObjectRegistry::builtins_ = {};
Expand Down
2 changes: 1 addition & 1 deletion librocksdb-sys/rocksdb
Submodule rocksdb updated 236 files
2 changes: 2 additions & 0 deletions librocksdb-sys/rocksdb_lib_sources.txt
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ util/stderr_logger.cc
util/string_util.cc
util/thread_local.cc
util/threadpool_imp.cc
util/udt_util.cc
util/write_batch_util.cc
util/xxhash.cc
utilities/agg_merge/agg_merge.cc
utilities/backup/backup_engine.cc
Expand Down
2 changes: 1 addition & 1 deletion librocksdb-sys/tests/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,7 @@ fn ffi() {
rocksdb_slicetransform_create_fixed_prefix(3),
);
rocksdb_options_set_hash_skip_list_rep(options, 5000, 4, 4);
rocksdb_options_set_plain_table_factory(options, 4, 10, 0.75, 16);
rocksdb_options_set_plain_table_factory(options, 4, 10, 0.75, 16, 0, 0, 0, 0);
rocksdb_options_set_allow_concurrent_memtable_write(options, 0);

db = rocksdb_open(options, dbname, &mut err);
Expand Down
33 changes: 32 additions & 1 deletion src/db_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2426,14 +2426,18 @@ impl Options {
/// # Examples
///
/// ```
/// use rocksdb::{Options, PlainTableFactoryOptions};
/// use rocksdb::{KeyEncodingType, Options, PlainTableFactoryOptions};
///
/// let mut opts = Options::default();
/// let factory_opts = PlainTableFactoryOptions {
/// user_key_length: 0,
/// bloom_bits_per_key: 20,
/// hash_table_ratio: 0.75,
/// index_sparseness: 16,
/// huge_page_tlb_size: 0,
/// encoding_type: KeyEncodingType::Plain,
/// full_scan_mode: false,
/// store_index_in_file: false,
/// };
///
/// opts.set_plain_table_factory(&factory_opts);
Expand All @@ -2446,6 +2450,10 @@ impl Options {
options.bloom_bits_per_key,
options.hash_table_ratio,
options.index_sparseness,
options.huge_page_tlb_size,
options.encoding_type as c_char,
c_uchar::from(options.full_scan_mode),
c_uchar::from(options.store_index_in_file),
);
}
}
Expand Down Expand Up @@ -3596,6 +3604,21 @@ pub enum ChecksumType {
XXH3 = 4, // Supported since RocksDB 6.27
}

/// Used in [`PlainTableFactoryOptions`].
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum KeyEncodingType {
/// Always write full keys.
Plain = 0,
/// Find opportunities to write the same prefix for multiple rows.
Prefix = 1,
}

impl Default for KeyEncodingType {
fn default() -> Self {
KeyEncodingType::Plain
}
}

/// Used with DBOptions::set_plain_table_factory.
/// See official [wiki](https://github.com/facebook/rocksdb/wiki/PlainTable-Format) for more
/// information.
Expand All @@ -3605,11 +3628,19 @@ pub enum ChecksumType {
/// bloom_bits_per_key: 10
/// hash_table_ratio: 0.75
/// index_sparseness: 16
/// huge_page_tlb_size: 0
/// encoding_type: KeyEncodingType::Plain
/// full_scan_mode: false
/// store_index_in_file: false
pub struct PlainTableFactoryOptions {
pub user_key_length: u32,
pub bloom_bits_per_key: i32,
pub hash_table_ratio: f64,
pub index_sparseness: usize,
pub huge_page_tlb_size: usize,
pub encoding_type: KeyEncodingType,
pub full_scan_mode: bool,
pub store_index_in_file: bool,
}

#[derive(Debug, Copy, Clone, PartialEq, Eq)]
Expand Down
5 changes: 3 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,9 @@ pub use crate::{
BlockBasedIndexType, BlockBasedOptions, BottommostLevelCompaction, Cache, ChecksumType,
CompactOptions, CuckooTableOptions, DBCompactionStyle, DBCompressionType, DBPath,
DBRecoveryMode, DataBlockIndexType, FifoCompactOptions, FlushOptions,
IngestExternalFileOptions, LogLevel, MemtableFactory, Options, PlainTableFactoryOptions,
ReadOptions, UniversalCompactOptions, UniversalCompactionStopStyle, WriteOptions,
IngestExternalFileOptions, KeyEncodingType, LogLevel, MemtableFactory, Options,
PlainTableFactoryOptions, ReadOptions, UniversalCompactOptions,
UniversalCompactionStopStyle, WriteOptions,
},
db_pinnable_slice::DBPinnableSlice,
env::Env,
Expand Down
5 changes: 4 additions & 1 deletion tests/test_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,7 @@ fn fifo_compaction_test() {
let mut opts = Options::default();
opts.create_if_missing(true);
opts.create_missing_column_families(true);
opts.set_level_compaction_dynamic_level_bytes(false);

// set compaction style
{
Expand Down Expand Up @@ -783,7 +784,7 @@ fn fifo_compaction_test() {
let livefiles = db.live_files().unwrap();
assert_eq!(livefiles.len(), 1);
livefiles.iter().for_each(|f| {
assert_eq!(f.level, 1);
assert_eq!(f.level, 6);
assert_eq!(f.column_family_name, "cf1");
assert!(!f.name.is_empty());
assert_eq!(f.start_key.as_ref().unwrap().as_slice(), "k1".as_bytes());
Expand Down Expand Up @@ -875,6 +876,7 @@ fn get_with_cache_and_bulkload_test() {
opts.set_db_log_dir(&log_path);
opts.set_memtable_whole_key_filtering(true);
opts.set_dump_malloc_stats(true);
opts.set_level_compaction_dynamic_level_bytes(false);

// trigger all sst files in L1/2 instead of L0
opts.set_max_bytes_for_level_base(64 << 10); // 64KB
Expand Down Expand Up @@ -1010,6 +1012,7 @@ fn get_with_cache_and_bulkload_and_blobs_test() {
opts.set_dump_malloc_stats(true);
opts.set_enable_blob_files(true);
opts.set_min_blob_size(256); // set small to ensure it is actually used
opts.set_level_compaction_dynamic_level_bytes(false);

// trigger all sst files in L1/2 instead of L0
opts.set_max_bytes_for_level_base(64 << 10); // 64KB
Expand Down

0 comments on commit 734cf99

Please sign in to comment.