From 1a51faa476b8d9e7e00f5b04d492654581bc0b02 Mon Sep 17 00:00:00 2001 From: mwtian <81660174+mwtian@users.noreply.github.com> Date: Sat, 18 May 2024 08:37:05 -0700 Subject: [PATCH] Upgrade rocksdb crate (#17813) ## Description The upgrades the underlying rocksdb library as well. ## Test plan CI Private testnet: no visible performance change --- ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] Indexer: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK: --- Cargo.lock | 23 ++++++++--------------- Cargo.toml | 2 +- crates/typed-store/src/rocks/mod.rs | 15 ++++----------- 3 files changed, 13 insertions(+), 27 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5ada214be0130..a6912770f6230 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1817,17 +1817,16 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.65.1" +version = "0.69.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5" +checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.1", "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", @@ -6194,9 +6193,9 @@ checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" [[package]] name = "librocksdb-sys" -version = "0.11.0+8.1.1" +version = "0.16.0+8.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3386f101bcb4bd252d8e9d2fb41ec3b0862a15a62b478c355b2982efa469e3e" +checksum = "ce3d60bc059831dc1c83903fb45c103f75db65c5a7bf22272764d9cc683e348c" dependencies = [ "bindgen", "bzip2-sys", @@ -8893,12 +8892,6 @@ 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" @@ -10194,9 +10187,9 @@ dependencies = [ [[package]] name = "rocksdb" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb6f170a4041d50a0ce04b0d2e14916d6ca863ea2e422689a5b694395d299ffe" +checksum = "6bd13e55d6d7b8cd0ea569161127567cd587676c99f4472f779a0279aa60a7a7" dependencies = [ "libc", "librocksdb-sys", diff --git a/Cargo.toml b/Cargo.toml index 03cd1ce562492..b49860694cc1d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -421,7 +421,7 @@ reqwest = { version = "0.11.20", default_features = false, features = [ "rustls-tls", ] } roaring = "0.10.1" -rocksdb = { version = "0.21.0", features = [ +rocksdb = { version = "0.22.0", features = [ "snappy", "lz4", "zstd", diff --git a/crates/typed-store/src/rocks/mod.rs b/crates/typed-store/src/rocks/mod.rs index 2cde6b4c69968..52500b1309e5c 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( + pub fn batched_multi_get_cf_opt<'a, I, K>( &self, cf: &impl AsColumnFamilyRef, keys: I, @@ -299,8 +299,8 @@ impl RocksDB { readopts: &ReadOptions, ) -> Vec>, Error>> where - I: IntoIterator, - K: AsRef<[u8]>, + K: AsRef<[u8]> + 'a + ?Sized, + I: IntoIterator, { 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,13 +2372,6 @@ 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.