From 05668dcd47d1ee19bcd7012493a29244977ee9da Mon Sep 17 00:00:00 2001 From: Zijie Lu Date: Wed, 26 Oct 2022 13:16:03 +0800 Subject: [PATCH] Address review comments --- src/binaries/query/main.rs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/binaries/query/main.rs b/src/binaries/query/main.rs index 8a71fdf3761ba..a22133ae32e7a 100644 --- a/src/binaries/query/main.rs +++ b/src/binaries/query/main.rs @@ -76,8 +76,7 @@ async fn main(_global_tracker: Arc) -> common_exception::Result< set_panic_hook(); #[cfg(not(target_os = "macos"))] - // Try to set max open files. - try_set_max_open_files(); + check_max_open_files(); GlobalServices::init(conf.clone()).await?; let mut shutdown_handle = ShutdownHandle::create()?; @@ -259,12 +258,20 @@ fn run_cmd(conf: &Config) -> bool { } #[cfg(not(target_os = "macos"))] -fn try_set_max_open_files() { - let limits = get_own_limits().unwrap(); +fn check_max_open_files() { + let limits = match get_own_limits() { + Ok(limits) => limits, + Err(err) => { + warn!("get system limit of databend-query failed: {e:?}"; + return; + } + }; let max_open_files_limit = limits.max_open_files.soft; if let Some(max_open_files) = max_open_files_limit { if max_open_files < 65535 { - warn!("The open file limit is too low for the databend-query. Please consider increase it by running `ulimit -n 65535`"); + warn!( + "The open file limit is too low for the databend-query. Please consider increase it by running `ulimit -n 65535`" + ); } } }