Skip to content

Conversation

@kaka11chen
Copy link
Contributor

@kaka11chen kaka11chen commented Oct 27, 2023

Proposed changes

Avoid update_process_fd_num reporting no such file error indiscriminately.

Further comments

If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...

@kaka11chen kaka11chen changed the title [Enhancement](metrics) Avoid update_process_fd_num report no such fil… [Enhancement](metrics) Avoid update_process_fd_num reporting no such file error indiscriminately. Oct 27, 2023
@kaka11chen
Copy link
Contributor Author

run buildall

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@doris-robot
Copy link

(From new machine)TeamCity pipeline, clickbench performance test result:
the sum of best hot time: 46.3 seconds
stream load tsv: 577 seconds loaded 74807831229 Bytes, about 123 MB/s
stream load json: 20 seconds loaded 2358488459 Bytes, about 112 MB/s
stream load orc: 64 seconds loaded 1101869774 Bytes, about 16 MB/s
stream load parquet: 32 seconds loaded 861443392 Bytes, about 25 MB/s
insert into select: 29.1 seconds inserted 10000000 Rows, about 343K ops/s
storage size: 17162138648 Bytes

@kaka11chen kaka11chen force-pushed the update_process_fd_num_error branch from 1c29115 to 0836acb Compare October 29, 2023 07:25
@kaka11chen
Copy link
Contributor Author

run buildall

morningman
morningman previously approved these changes Oct 29, 2023
Copy link
Contributor

@morningman morningman left a comment

Choose a reason for hiding this comment

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

LGTM

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Oct 29, 2023
@github-actions
Copy link
Contributor

PR approved by at least one committer and no changes requested.

@github-actions
Copy link
Contributor

PR approved by anyone and no changes requested.

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@doris-robot
Copy link

(From new machine)TeamCity pipeline, clickbench performance test result:
the sum of best hot time: 46.39 seconds
stream load tsv: 554 seconds loaded 74807831229 Bytes, about 128 MB/s
stream load json: 20 seconds loaded 2358488459 Bytes, about 112 MB/s
stream load orc: 65 seconds loaded 1101869774 Bytes, about 16 MB/s
stream load parquet: 32 seconds loaded 861443392 Bytes, about 25 MB/s
insert into select: 28.9 seconds inserted 10000000 Rows, about 346K ops/s
storage size: 17162140363 Bytes


process_fd_num_used->set_value(count);

auto limits = fmt::format("/proc/{}/limits", pid);
Copy link
Contributor

Choose a reason for hiding this comment

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

can use ‘/proc/self/limits’

process_fd_num_used->set_value(0);
return;
}
for (const auto& entry : dict_iter) {
Copy link
Contributor

Choose a reason for hiding this comment

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

use count_if to replace this for loop

if (!st.ok()) {
LOG(WARNING) << "failed to count fd: " << st;
std::error_code ec;
std::filesystem::directory_iterator dict_iter(fmt::format("/proc/{}/fd/", pid), ec);
Copy link
Contributor

Choose a reason for hiding this comment

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

use ‘/proc/self/fd/'

@github-actions github-actions bot removed the approved Indicates a PR has been approved by one committer. label Oct 30, 2023
@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@kaka11chen
Copy link
Contributor Author

run buildall

void DorisMetrics::_update_process_thread_num() {
int64_t pid = getpid();
std::stringstream ss;
ss << "/proc/" << pid << "/task/";
Copy link
Contributor

Choose a reason for hiding this comment

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

remove this dead code

return;
}
int64_t count = std::count_if(dict_iter, fs::directory_iterator(),
[](const fs::directory_entry& entry) {
Copy link
Contributor

Choose a reason for hiding this comment

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

in lambda , use const auto & entry to replace const fs::directory_entry& entry

@kaka11chen kaka11chen force-pushed the update_process_fd_num_error branch 2 times, most recently from 5b2bb09 to 3fd5472 Compare October 30, 2023 03:34
@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

1 similar comment
@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@kaka11chen
Copy link
Contributor Author

run buildall

@kaka11chen kaka11chen force-pushed the update_process_fd_num_error branch from 3fd5472 to 0de5285 Compare October 30, 2023 05:18
@kaka11chen
Copy link
Contributor Author

run buildall

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@kaka11chen kaka11chen force-pushed the update_process_fd_num_error branch from 0de5285 to bc5ec47 Compare October 30, 2023 05:38
@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Status st = io::global_local_filesystem()->iterate_directory(ss.str(), cb);
if (!st.ok()) {
LOG(WARNING) << "failed to count fd: " << st;
std::error_code ec;
Copy link
Contributor

Choose a reason for hiding this comment

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

remove these unused shadow variable

return;
}
int64_t count = std::count_if(dict_iter, std::filesystem::fs::directory_iterator(), [](const auto& entry) {
std::error_code ec;
Copy link
Contributor

Choose a reason for hiding this comment

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

not use shadow variable, just use dec or something else

process_fd_num_used->set_value(0);
return;
}
int64_t count = std::count_if(dict_iter, std::filesystem::directory_iterator(), [](const auto& entry) {
Copy link
Contributor

Choose a reason for hiding this comment

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

use std::filesystem::end(dict_iter) to replace std::filesystem::directory_iterator(), std::filesystem::directory_iterator() is ub in end

@kaka11chen kaka11chen force-pushed the update_process_fd_num_error branch from bc5ec47 to 533fe3c Compare October 30, 2023 06:52
@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@kaka11chen
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 37.37% (8475/22676)
Line Coverage: 29.66% (68516/230968)
Region Coverage: 28.24% (35584/126018)
Branch Coverage: 25.10% (18214/72564)
Coverage Report: http://coverage.selectdb-in.cc/coverage/533fe3c91acf73113bf20b82f301dfd6f5efe9d3_533fe3c91acf73113bf20b82f301dfd6f5efe9d3/report/index.html

@doris-robot
Copy link

(From new machine)TeamCity pipeline, clickbench performance test result:
the sum of best hot time: 46.06 seconds
stream load tsv: 555 seconds loaded 74807831229 Bytes, about 128 MB/s
stream load json: 20 seconds loaded 2358488459 Bytes, about 112 MB/s
stream load orc: 65 seconds loaded 1101869774 Bytes, about 16 MB/s
stream load parquet: 32 seconds loaded 861443392 Bytes, about 25 MB/s
insert into select: 28.9 seconds inserted 10000000 Rows, about 346K ops/s
storage size: 17162068629 Bytes

Copy link
Contributor

@JackDrogon JackDrogon left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@morningman morningman left a comment

Choose a reason for hiding this comment

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

LGTM

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Oct 31, 2023
@github-actions
Copy link
Contributor

PR approved by at least one committer and no changes requested.

@morningman morningman merged commit b619982 into apache:master Oct 31, 2023
xiaokang pushed a commit that referenced this pull request Nov 3, 2023
dutyu pushed a commit to dutyu/doris that referenced this pull request Nov 4, 2023
…file error indiscriminately. (apache#26013)

Avoid `update_process_fd_num` reporting `no such file error `indiscriminately.
seawinde pushed a commit to seawinde/doris that referenced this pull request Nov 13, 2023
…file error indiscriminately. (apache#26013)

Avoid `update_process_fd_num` reporting `no such file error `indiscriminately.
gnehil pushed a commit to gnehil/doris that referenced this pull request Dec 4, 2023
XuJianxu pushed a commit to XuJianxu/doris that referenced this pull request Dec 14, 2023
…file error indiscriminately. (apache#26013)

Avoid `update_process_fd_num` reporting `no such file error `indiscriminately.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. dev/2.0.3-merged reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants