diff --git a/Cargo.lock b/Cargo.lock index 3899e917..a662b4e0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -959,7 +959,7 @@ dependencies = [ [[package]] name = "dragonfly-client" -version = "0.1.59" +version = "0.1.60" dependencies = [ "anyhow", "bytes", @@ -1022,7 +1022,7 @@ dependencies = [ [[package]] name = "dragonfly-client-backend" -version = "0.1.59" +version = "0.1.60" dependencies = [ "dragonfly-client-core", "futures", @@ -1040,7 +1040,7 @@ dependencies = [ [[package]] name = "dragonfly-client-config" -version = "0.1.59" +version = "0.1.60" dependencies = [ "dragonfly-client-core", "home", @@ -1059,7 +1059,7 @@ dependencies = [ [[package]] name = "dragonfly-client-core" -version = "0.1.59" +version = "0.1.60" dependencies = [ "libloading", "reqwest", @@ -1070,7 +1070,7 @@ dependencies = [ [[package]] name = "dragonfly-client-init" -version = "0.1.59" +version = "0.1.60" dependencies = [ "anyhow", "clap", @@ -1086,7 +1086,7 @@ dependencies = [ [[package]] name = "dragonfly-client-storage" -version = "0.1.59" +version = "0.1.60" dependencies = [ "base16ct", "blake3", @@ -1110,7 +1110,7 @@ dependencies = [ [[package]] name = "dragonfly-client-util" -version = "0.1.59" +version = "0.1.60" dependencies = [ "dragonfly-api", "dragonfly-client-core", @@ -1568,7 +1568,7 @@ dependencies = [ [[package]] name = "hdfs" -version = "0.1.59" +version = "0.1.60" dependencies = [ "dragonfly-client-backend", "dragonfly-client-core", diff --git a/Cargo.toml b/Cargo.toml index 8aeb8a4c..c10a29d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ members = [ ] [workspace.package] -version = "0.1.59" +version = "0.1.60" authors = ["The Dragonfly Developers"] homepage = "https://d7y.io/" repository = "https://github.com/dragonflyoss/client.git" @@ -22,13 +22,13 @@ readme = "README.md" edition = "2021" [workspace.dependencies] -dragonfly-client = { path = "dragonfly-client", version = "0.1.59" } -dragonfly-client-core = { path = "dragonfly-client-core", version = "0.1.59" } -dragonfly-client-config = { path = "dragonfly-client-config", version = "0.1.59" } -dragonfly-client-storage = { path = "dragonfly-client-storage", version = "0.1.59" } -dragonfly-client-backend = { path = "dragonfly-client-backend", version = "0.1.59" } -dragonfly-client-util = { path = "dragonfly-client-util", version = "0.1.59" } -dragonfly-client-init = { path = "dragonfly-client-init", version = "0.1.59" } +dragonfly-client = { path = "dragonfly-client", version = "0.1.60" } +dragonfly-client-core = { path = "dragonfly-client-core", version = "0.1.60" } +dragonfly-client-config = { path = "dragonfly-client-config", version = "0.1.60" } +dragonfly-client-storage = { path = "dragonfly-client-storage", version = "0.1.60" } +dragonfly-client-backend = { path = "dragonfly-client-backend", version = "0.1.60" } +dragonfly-client-util = { path = "dragonfly-client-util", version = "0.1.60" } +dragonfly-client-init = { path = "dragonfly-client-init", version = "0.1.60" } thiserror = "1.0" dragonfly-api = "2.0.112" reqwest = { version = "0.11.27", features = ["stream", "native-tls", "default-tls", "rustls-tls"] } diff --git a/dragonfly-client-storage/src/storage_engine/rocksdb.rs b/dragonfly-client-storage/src/storage_engine/rocksdb.rs index 5fa8ca75..dc5b9a97 100644 --- a/dragonfly-client-storage/src/storage_engine/rocksdb.rs +++ b/dragonfly-client-storage/src/storage_engine/rocksdb.rs @@ -19,7 +19,7 @@ use dragonfly_client_core::{ error::{ErrorType, OrErr}, Error, Result, }; -use rocksdb::WriteOptions; +use rocksdb::{ReadOptions, WriteOptions}; use std::{ops::Deref, path::Path}; use tracing::info; @@ -55,7 +55,7 @@ impl RocksdbStorageEngine { const DEFAULT_BLOCK_SIZE: usize = 64 * 1024; /// DEFAULT_CACHE_SIZE is the default cache size for rocksdb. - const DEFAULT_CACHE_SIZE: usize = 16 * 1024 * 1024; + const DEFAULT_CACHE_SIZE: usize = 32 * 1024 * 1024; /// open opens a rocksdb storage engine with the given directory and column families. pub fn open(dir: &Path, cf_names: &[&str]) -> Result { @@ -67,7 +67,7 @@ impl RocksdbStorageEngine { options.increase_parallelism(num_cpus::get() as i32); options.set_max_open_files(Self::DEFAULT_MAX_OPEN_FILES); // Set prefix extractor to reduce the memory usage of bloom filter. - options.set_prefix_extractor(rocksdb::SliceTransform::create_fixed_prefix(128)); + options.set_prefix_extractor(rocksdb::SliceTransform::create_fixed_prefix(64)); options.set_memtable_prefix_bloom_ratio(0.2); // Initialize rocksdb block based table options. @@ -93,7 +93,12 @@ impl Operations for RocksdbStorageEngine { // get gets the object by key. fn get(&self, key: &[u8]) -> Result> { let cf = cf_handle::(self)?; - let value = self.get_cf(cf, key).or_err(ErrorType::StorageError)?; + let mut options = ReadOptions::default(); + options.set_total_order_seek(true); + + let value = self + .get_cf_opt(cf, key, &options) + .or_err(ErrorType::StorageError)?; match value { Some(value) => Ok(Some(O::deserialize_from(&value)?)), None => Ok(None),