Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
TszKitLo40 committed Oct 26, 2022
1 parent 0849c6c commit 5ed1855
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/binaries/query/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ async fn main(_global_tracker: Arc<RuntimeTracker>) -> 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()?;
Expand Down Expand Up @@ -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: {:?}", err);
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`"
);
}
}
}

0 comments on commit 5ed1855

Please sign in to comment.