Skip to content
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

Merged
merged 3 commits into from
Oct 26, 2022

Conversation

TszKitLo40
Copy link
Contributor

@TszKitLo40 TszKitLo40 commented Oct 21, 2022

I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/

Summary

If the open file limit is less than 65535, set it to 65535.

Fixes #8387

@vercel
Copy link

vercel bot commented Oct 21, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated
databend ⬜️ Ignored (Inspect) Oct 26, 2022 at 5:55AM (UTC)

@mergify mergify bot added the pr-feature this PR introduces a new feature to the codebase label Oct 21, 2022
@TszKitLo40 TszKitLo40 force-pushed the open-files-limit branch 3 times, most recently from 850fd44 to 1983e4f Compare October 21, 2022 07:31
@TszKitLo40 TszKitLo40 marked this pull request as ready for review October 21, 2022 08:54
@BohuTANG BohuTANG self-requested a review October 22, 2022 01:46
@BohuTANG
Copy link
Member

@mergify update

@mergify
Copy link
Contributor

mergify bot commented Oct 23, 2022

update

❌ Base branch update has failed

refusing to allow a GitHub App to create or update workflow .github/workflows/build-tool.yml without workflows permission
err-code: EE06A

@BohuTANG
Copy link
Member

I have pushed a demo FYI:
BohuTANG@c6fb934

@TszKitLo40
Copy link
Contributor Author

I have pushed a demo FYI: BohuTANG@c6fb934

updated

@TszKitLo40 TszKitLo40 force-pushed the open-files-limit branch 2 times, most recently from df40ecd to 95d902e Compare October 24, 2022 02:43
@TszKitLo40
Copy link
Contributor Author

@BohuTANG It seems that limits-rs can't work on MacOS.

@BohuTANG
Copy link
Member

@mergify update

@mergify
Copy link
Contributor

mergify bot commented Oct 24, 2022

update

❌ Base branch update has failed

refusing to allow a GitHub App to create or update workflow .github/workflows/build-tool.yml without workflows permission
err-code: 6EA3F

@BohuTANG
Copy link
Member

@BohuTANG It seems that limits-rs can't work on MacOS.

We can add:

#[cfg(not(target_os = "macos"))]

to check.

@Xuanwo
Copy link
Member

Xuanwo commented Oct 25, 2022

I wouldn't say I like this PR.

It's not a good idea to set open file limits in code. How about printing a warning message with the action needs to take?

For example:

The open file limit is too low for the databend-query. Please consider increase it by running `ulimit -n 65536`

There are many system settings that need to tune for query, we can't set them all.

@sundy-li
Copy link
Member

How about printing a warning message with the action needs to take?

That's right!

@TszKitLo40
Copy link
Contributor Author

How about printing a warning message with the action needs to take?

That's right!

OK,I will print a warning message instead of set open file limits in this PR.

src/binaries/query/main.rs Outdated Show resolved Hide resolved
src/binaries/query/main.rs Outdated Show resolved Hide resolved
@Xuanwo
Copy link
Member

Xuanwo commented Oct 26, 2022

@TszKitLo40 Thanks for your work! This PR is almost LGTM now. I left some review here, PTAL.

Copy link
Member

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!

@Xuanwo
Copy link
Member

Xuanwo commented Oct 26, 2022

CI failure need to be addressed:

error[E0425]: cannot find value `e` in this scope
   --> src/binaries/query/main.rs:265:64
    |
265 |             warn!("get system limit of databend-query failed: {e:?}");
    |                                                                ^ not found in this scope

@TszKitLo40
Copy link
Contributor Author

CI failure need to be addressed:

error[E0425]: cannot find value `e` in this scope
   --> src/binaries/query/main.rs:265:64
    |
265 |             warn!("get system limit of databend-query failed: {e:?}");
    |                                                                ^ not found in this scope

I think I have fixed it.

@Xuanwo
Copy link
Member

Xuanwo commented Oct 26, 2022

Please merge with the main branch to make sure our PR are updated~

@mergify mergify bot merged commit 2430726 into databendlabs:main Oct 26, 2022
@@ -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;
Copy link
Member

@BohuTANG BohuTANG Oct 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the use.

use tracing::info;
use tracing::warn;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the use.

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!(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warn! --> tracing::warn!

@BohuTANG
Copy link
Member

This PR breaks the MacOS:

error: unused import: `limits_rs::get_own_limits`
  --> src/binaries/query/main.rs:37:5
   |
37 | use limits_rs::get_own_limits;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `-D unused-imports` implied by `-D warnings`

error: unused import: `tracing::warn`
  --> src/binaries/query/main.rs:39:5
   |
39 | use tracing::warn;
   |     ^^^^^^^^^^^^^


#[cfg(not(target_os = "macos"))]
fn check_max_open_files() {
let limits = match get_own_limits() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_own_limits-->limits_rs::get_own_limits

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I need to file another PR to fix this problems?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

This works on my MacOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-feature this PR introduces a new feature to the codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants