From f531168c745260b60a4ec4906c9f2b22240d872d Mon Sep 17 00:00:00 2001 From: Mark Logan Date: Wed, 5 Jun 2024 11:50:21 -0700 Subject: [PATCH] Revert "Upgrade rocksdb crate (#17813)" This reverts commit 1a51faa476b8d9e7e00f5b04d492654581bc0b02. --- Cargo.lock | 23 +++++++++++++++-------- Cargo.toml | 2 +- crates/typed-store/src/rocks/mod.rs | 15 +++++++++++---- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index eb32a0d2f2c97..e9ec4115b9d01 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1817,16 +1817,17 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.69.4" +version = "0.65.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5" dependencies = [ - "bitflags 2.4.1", + "bitflags 1.3.2", "cexpr", "clang-sys", - "itertools 0.12.0", "lazy_static", "lazycell", + "peeking_take_while", + "prettyplease 0.2.17", "proc-macro2 1.0.78", "quote 1.0.35", "regex", @@ -6140,9 +6141,9 @@ checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" [[package]] name = "librocksdb-sys" -version = "0.16.0+8.10.0" +version = "0.11.0+8.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce3d60bc059831dc1c83903fb45c103f75db65c5a7bf22272764d9cc683e348c" +checksum = "d3386f101bcb4bd252d8e9d2fb41ec3b0862a15a62b478c355b2982efa469e3e" dependencies = [ "bindgen", "bzip2-sys", @@ -8809,6 +8810,12 @@ dependencies = [ "hmac 0.12.1", ] +[[package]] +name = "peeking_take_while" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" + [[package]] name = "pem" version = "1.1.0" @@ -10104,9 +10111,9 @@ dependencies = [ [[package]] name = "rocksdb" -version = "0.22.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bd13e55d6d7b8cd0ea569161127567cd587676c99f4472f779a0279aa60a7a7" +checksum = "bb6f170a4041d50a0ce04b0d2e14916d6ca863ea2e422689a5b694395d299ffe" dependencies = [ "libc", "librocksdb-sys", diff --git a/Cargo.toml b/Cargo.toml index 42754c9bc33a2..223f493c2f6fe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -419,7 +419,7 @@ reqwest = { version = "0.11.20", default_features = false, features = [ "rustls-tls", ] } roaring = "0.10.1" -rocksdb = { version = "0.22.0", features = [ +rocksdb = { version = "0.21.0", features = [ "snappy", "lz4", "zstd", diff --git a/crates/typed-store/src/rocks/mod.rs b/crates/typed-store/src/rocks/mod.rs index 52500b1309e5c..2cde6b4c69968 100644 --- a/crates/typed-store/src/rocks/mod.rs +++ b/crates/typed-store/src/rocks/mod.rs @@ -291,7 +291,7 @@ impl RocksDB { delegate_call!(self.multi_get_cf_opt(keys, readopts)) } - pub fn batched_multi_get_cf_opt<'a, I, K>( + pub fn batched_multi_get_cf_opt( &self, cf: &impl AsColumnFamilyRef, keys: I, @@ -299,8 +299,8 @@ impl RocksDB { readopts: &ReadOptions, ) -> Vec>, Error>> where - K: AsRef<[u8]> + 'a + ?Sized, - I: IntoIterator, + I: IntoIterator, + K: AsRef<[u8]>, { delegate_call!(self.batched_multi_get_cf_opt(cf, keys, sorted_input, readopts)) } @@ -932,7 +932,7 @@ impl DBMap { .rocksdb .batched_multi_get_cf_opt( &self.cf(), - &(keys_bytes?), + keys_bytes?, /*sorted_keys=*/ false, &self.opts.readopts(), ) @@ -2372,6 +2372,13 @@ impl DBOptions { self } + + // Optimize tables receiving significant deletions. + // TODO: revisit when intra-epoch pruning is enabled. + pub fn optimize_for_pruning(mut self) -> DBOptions { + self.options.set_min_write_buffer_number_to_merge(2); + self + } } /// Creates a default RocksDB option, to be used when RocksDB option is unspecified.