-
Notifications
You must be signed in to change notification settings - Fork 763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(query): get the system open file limits and set #8388
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,9 @@ use databend_query::servers::MySQLHandler; | |
use databend_query::servers::Server; | ||
use databend_query::servers::ShutdownHandle; | ||
use databend_query::GlobalServices; | ||
use limits_rs::get_own_limits; | ||
use tracing::info; | ||
use tracing::warn; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the use. |
||
|
||
#[databend_main] | ||
async fn main(_global_tracker: Arc<RuntimeTracker>) -> common_exception::Result<()> { | ||
|
@@ -73,6 +75,9 @@ async fn main(_global_tracker: Arc<RuntimeTracker>) -> common_exception::Result< | |
init_default_metrics_recorder(); | ||
set_panic_hook(); | ||
|
||
#[cfg(not(target_os = "macos"))] | ||
check_max_open_files(); | ||
|
||
GlobalServices::init(conf.clone()).await?; | ||
let mut shutdown_handle = ShutdownHandle::create()?; | ||
|
||
|
@@ -251,3 +256,22 @@ fn run_cmd(conf: &Config) -> bool { | |
|
||
true | ||
} | ||
|
||
#[cfg(not(target_os = "macos"))] | ||
fn check_max_open_files() { | ||
let limits = match get_own_limits() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. get_own_limits-->limits_rs::get_own_limits There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do I need to file another PR to fix this problems? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
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!( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warn! --> tracing::warn! |
||
"The open file limit is too low for the databend-query. Please consider increase it by running `ulimit -n 65535`" | ||
); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the use.