Skip to content

Conversation

@kaijchen
Copy link
Member

backport #40074

… to brpc (apache#40074)

Currently brpc does not support resloving IPv6 hostnames, errors will be
returned on `brpc::Channel::Init`.
The brpc client cache may return `nullptr` on its `get_client` or
`get_new_client_no_cache` APIs.

This PR made the following changes:

1. Resolve hostnames from DNS cache before passing it to brpc.
2. Callers should check nullptr after get client, in case of failures.
@doris-robot
Copy link

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.

@kaijchen
Copy link
Member Author

run buildall

Copy link
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

if (!is_valid_ip(host)) {
Status status = ExecEnv::GetInstance()->dns_cache()->get(host, &realhost);
std::string realhost = host;
auto dns_cache = ExecEnv::GetInstance()->dns_cache();
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: 'auto dns_cache' can be declared as 'auto *dns_cache' [readability-qualified-auto]

Suggested change
auto dns_cache = ExecEnv::GetInstance()->dns_cache();
auto *dns_cache = ExecEnv::GetInstance()->dns_cache();

RETURN_IF_ERROR(request_embed_attachment_contain_blockv2(closure->request_.get(), closure));

std::string host = brpc_dest_addr.hostname;
auto dns_cache = ExecEnv::GetInstance()->dns_cache();
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: 'auto dns_cache' can be declared as 'auto *dns_cache' [readability-qualified-auto]

Suggested change
auto dns_cache = ExecEnv::GetInstance()->dns_cache();
auto *dns_cache = ExecEnv::GetInstance()->dns_cache();

}

std::string host = _node_info.host;
auto dns_cache = ExecEnv::GetInstance()->dns_cache();
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: 'auto dns_cache' can be declared as 'auto *dns_cache' [readability-qualified-auto]

Suggested change
auto dns_cache = ExecEnv::GetInstance()->dns_cache();
auto *dns_cache = ExecEnv::GetInstance()->dns_cache();

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 36.15% (9318/25778)
Line Coverage: 27.71% (76485/276002)
Region Coverage: 26.48% (39264/148250)
Branch Coverage: 23.32% (20033/85906)
Coverage Report: http://coverage.selectdb-in.cc/coverage/cc9d32d6d823023cc307e99dab7319fef098972b_cc9d32d6d823023cc307e99dab7319fef098972b/report/index.html

@yiguolei yiguolei merged commit 7851563 into apache:branch-2.1 Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants