From 6c67bfed5d51c33fe656e0d7aabaaf7b234da108 Mon Sep 17 00:00:00 2001 From: Lonng Date: Fri, 26 Apr 2019 01:24:47 +0800 Subject: [PATCH] import: use memory to cache split sst instead of disk file (#4566) Signed-off-by: Lonng --- src/import/engine.rs | 2 +- src/import/import.rs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/import/engine.rs b/src/import/engine.rs index a06ff370580..cb186704a56 100644 --- a/src/import/engine.rs +++ b/src/import/engine.rs @@ -222,7 +222,7 @@ pub struct SSTWriter { impl SSTWriter { pub fn new(db_cfg: &DbConfig, security_cfg: &SecurityConfig, path: &str) -> Result { - let mut env = Arc::new(Env::default()); + let mut env = Arc::new(Env::new_mem()); let mut base_env = None; if !security_cfg.cipher_file.is_empty() { base_env = Some(Arc::clone(&env)); diff --git a/src/import/import.rs b/src/import/import.rs index 189421b3cd3..2cf7ff11695 100644 --- a/src/import/import.rs +++ b/src/import/import.rs @@ -78,6 +78,12 @@ impl ImportJob { "retry_count" => %retry_count, "current_round" => %i, ); + if i == MAX_RETRY_TIMES - 1 { + res = Err(Error::ImportJobFailed(format!( + "retry {} times still {} ranges failed", + i, retry_count + ))) + } } IMPORT_EACH_PHASE.with_label_values(&["import"]).set(0.0);