From 937c6b025086c21ac4cb5f54d61b5108a90827a3 Mon Sep 17 00:00:00 2001 From: CalvinNeo Date: Wed, 31 Aug 2022 16:14:53 +0800 Subject: [PATCH] f Signed-off-by: CalvinNeo --- components/proxy_server/src/config.rs | 5 ++++- components/proxy_server/src/proxy.rs | 5 +++-- src/config.rs | 3 --- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/components/proxy_server/src/config.rs b/components/proxy_server/src/config.rs index 5a6f1b09cfda..5775f74abaa0 100644 --- a/components/proxy_server/src/config.rs +++ b/components/proxy_server/src/config.rs @@ -165,11 +165,14 @@ pub fn check_critical_config(config: &TiKvConfig) -> Result<(), String> { // Check current critical configurations with last time, if there are some // changes, user must guarantee relevant works have been done. if let Some(mut cfg) = get_last_config(&config.storage.data_dir) { + info!("check_critical_config finished compatible_adjust"); cfg.compatible_adjust(); if let Err(e) = cfg.validate() { warn!("last_tikv.toml is invalid but ignored: {:?}", e); } + info!("check_critical_config finished validate"); config.check_critical_cfg_with(&cfg)?; + info!("check_critical_config finished check_critical_cfg_with"); } Ok(()) } @@ -179,7 +182,7 @@ pub fn get_last_config(data_dir: &str) -> Option { let last_cfg_path = store_path.join(LAST_CONFIG_FILE); let mut v: Vec = vec![]; if last_cfg_path.exists() { - let s = TiKvConfig::from_file(&last_cfg_path, None).unwrap_or_else(|e| { + let s = TiKvConfig::from_file(&last_cfg_path, Some(&mut v)).unwrap_or_else(|e| { error!( "invalid auto generated configuration file {}, err {}", last_cfg_path.display(), diff --git a/components/proxy_server/src/proxy.rs b/components/proxy_server/src/proxy.rs index 0bf815593518..fe21bd799a8e 100644 --- a/components/proxy_server/src/proxy.rs +++ b/components/proxy_server/src/proxy.rs @@ -55,11 +55,12 @@ pub fn gen_tikv_config( }, ) .unwrap_or_else(|e| { - panic!( - "invalid auto generated configuration file {}, err {}", + error!( + "invalid default auto generated configuration file {}, err {}", path.display(), e ); + std::process::exit(1); }) }) } diff --git a/src/config.rs b/src/config.rs index f27181fb774f..8ade86eb3d78 100644 --- a/src/config.rs +++ b/src/config.rs @@ -3281,13 +3281,10 @@ pub fn check_critical_config(config: &TiKvConfig) -> Result<(), String> { // changes, user must guarantee relevant works have been done. if let Some(mut cfg) = get_last_config(&config.storage.data_dir) { cfg.compatible_adjust(); - info!("check_critical_config finished compatible_adjust"); if let Err(e) = cfg.validate() { warn!("last_tikv.toml is invalid but ignored: {:?}", e); } - info!("check_critical_config finished validate"); config.check_critical_cfg_with(&cfg)?; - info!("check_critical_config finished check_critical_cfg_with"); } Ok(()) }