Skip to content

[opt](brpc) check and remove unavailable brpc stubs#43212

Merged
yiguolei merged 2 commits intoapache:masterfrom
mrhhsg:opt_brpc
Nov 13, 2024
Merged

[opt](brpc) check and remove unavailable brpc stubs#43212
yiguolei merged 2 commits intoapache:masterfrom
mrhhsg:opt_brpc

Conversation

@mrhhsg
Copy link
Copy Markdown
Member

@mrhhsg mrhhsg commented Nov 4, 2024

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

Check List (For Committer)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No colde files have been changed.
      • Other reason
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.
  • Release note

    None

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

@doris-robot
Copy link
Copy Markdown

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR

Since 2024-03-18, the Document has been moved to doris-website.
See Doris Document.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 4, 2024

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

Comment thread be/src/runtime/fragment_mgr.cpp Outdated
void FragmentMgr::register_brpc_with_query(const TNetworkAddress& network_address,
std::shared_ptr<PBackendService_Stub> brpc_stub,
TUniqueId query_id) {
std::lock_guard<std::mutex> lock(_lock);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the lock will very very busy, we could save it in query context and collect it during cancel worker

@mrhhsg mrhhsg force-pushed the opt_brpc branch 3 times, most recently from c7ce8e0 to 02163a0 Compare November 4, 2024 10:26
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

Comment thread be/src/runtime/query_context.h
Comment thread be/src/runtime/fragment_mgr.cpp Outdated
c->clear_finished_tasks();
}

std::unordered_map<TNetworkAddress, BrpcItem> brpc_stub_with_queries;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

不要这么写,会出现2个rpc 链接的host 一样,但是brpc的对象不一样的问题。
可以使用brpc stub的指针做key,然后把network address 放到BrpcItem 这里面,供check的时候打log 使用。

Comment thread be/src/runtime/fragment_mgr.cpp Outdated
if (cntl.Failed()) {
error_message = cntl.ErrorText();
LOG(WARNING) << "brpc stub: " << network_address << " check failed: " << error_message;
} else if (response.has_status() && response.has_hello() && response.hello() == message &&
Copy link
Copy Markdown
Contributor

@yiguolei yiguolei Nov 4, 2024

Choose a reason for hiding this comment

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

Do not need check response value.
If has response, it means we could connect dest succesfully, then the connection is OK.

Comment thread be/src/runtime/fragment_mgr.cpp Outdated
request.set_hello(message);
PHandShakeResponse response;
brpc::Controller cntl;
cntl.set_timeout_ms(500);
Copy link
Copy Markdown
Contributor

@yiguolei yiguolei Nov 4, 2024

Choose a reason for hiding this comment

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

500 * (failed_count + 1) * 2

Comment thread be/src/runtime/fragment_mgr.cpp
Comment thread be/src/runtime/fragment_mgr.h Outdated
private:
struct BrpcItem {
std::shared_ptr<PBackendService_Stub> brpc_stub;
std::map<std::string, std::weak_ptr<QueryContext>> queries;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why it is a map? a vector is not ok?

yiguolei
yiguolei previously approved these changes Nov 5, 2024
@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Nov 5, 2024
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 5, 2024

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 5, 2024

PR approved by anyone and no changes requested.

@yiguolei
Copy link
Copy Markdown
Contributor

yiguolei commented Nov 5, 2024

run buildall

@doris-robot
Copy link
Copy Markdown

TeamCity be ut coverage result:
Function Coverage: 37.86% (9838/25986)
Line Coverage: 29.03% (81841/281923)
Region Coverage: 28.26% (42164/149188)
Branch Coverage: 24.85% (21400/86118)
Coverage Report: http://coverage.selectdb-in.cc/coverage/7b29bb3e90eb3951f30bcce3d779d8ab2464e178_7b29bb3e90eb3951f30bcce3d779d8ab2464e178/report/index.html

@mrhhsg
Copy link
Copy Markdown
Member Author

mrhhsg commented Nov 6, 2024

run buildall

@github-actions github-actions bot removed the approved Indicates a PR has been approved by one committer. label Nov 6, 2024
@doris-robot
Copy link
Copy Markdown

TeamCity be ut coverage result:
Function Coverage: 37.85% (9837/25986)
Line Coverage: 29.03% (81836/281926)
Region Coverage: 28.26% (42163/149191)
Branch Coverage: 24.84% (21396/86120)
Coverage Report: http://coverage.selectdb-in.cc/coverage/efc91f5511d83fc1a0ec9916528d660fe20cc7de_efc91f5511d83fc1a0ec9916528d660fe20cc7de/report/index.html

@mrhhsg
Copy link
Copy Markdown
Member Author

mrhhsg commented Nov 11, 2024

run buildall

@mrhhsg
Copy link
Copy Markdown
Member Author

mrhhsg commented Nov 11, 2024

run buildall

@doris-robot
Copy link
Copy Markdown

TeamCity be ut coverage result:
Function Coverage: 37.77% (9843/26058)
Line Coverage: 29.05% (82294/283279)
Region Coverage: 28.18% (42314/150158)
Branch Coverage: 24.76% (21453/86634)
Coverage Report: http://coverage.selectdb-in.cc/coverage/950a530b549508dbc2dbd45bab02e350a5c57c9e_950a530b549508dbc2dbd45bab02e350a5c57c9e/report/index.html

@mrhhsg
Copy link
Copy Markdown
Member Author

mrhhsg commented Nov 12, 2024

run buildall

Comment thread be/src/runtime/fragment_mgr.cpp Outdated
@@ -912,9 +915,18 @@ void FragmentMgr::cancel_worker() {
LOG_WARNING("Query {} is timeout", print_id(it->first));
queries_timeout.push_back(it->first);
++it;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

这个it ++ 是多余的

@github-actions
Copy link
Copy Markdown
Contributor

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

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Nov 12, 2024
@yiguolei
Copy link
Copy Markdown
Contributor

run buildall

Copy link
Copy Markdown
Contributor

@xinyiZzz xinyiZzz left a comment

Choose a reason for hiding this comment

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

LGTM

@yiguolei yiguolei merged commit 47dab4d into apache:master Nov 13, 2024
@mrhhsg mrhhsg deleted the opt_brpc branch November 13, 2024 06:50
mrhhsg added a commit to mrhhsg/doris that referenced this pull request Nov 13, 2024
mrhhsg added a commit to mrhhsg/doris that referenced this pull request Nov 13, 2024
yiguolei pushed a commit to mrhhsg/doris that referenced this pull request Nov 14, 2024
mrhhsg added a commit to mrhhsg/doris that referenced this pull request Dec 2, 2024
mrhhsg added a commit to mrhhsg/doris that referenced this pull request Dec 2, 2024
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.1.8-merged reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants