Skip to content

Commit

Permalink
[rpc] add kudu namespace to DnsResolver in generated code
Browse files Browse the repository at this point in the history
When building service proxies in non-Kudu projects like Impala, the lack
of the namespace could result in a build failure.

Change-Id: Ia9a8c8a95256192267c2de7e61d7489f7af6e282
Reviewed-on: http://gerrit.cloudera.org:8080/17968
Reviewed-by: Alexey Serbin <[email protected]>
Tested-by: Alexey Serbin <[email protected]>
  • Loading branch information
andrwng authored and alexeyserbin committed Oct 26, 2021
1 parent 96aa6ee commit 50cc6f9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/kudu/rpc/protoc-gen-krpc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ class CodeGenerator : public ::google::protobuf::compiler::CodeGenerator {
"#include \"kudu/rpc/result_tracker.h\"\n"
"#include \"kudu/rpc/service_if.h\"\n"
"#include \"kudu/util/metrics.h\"\n"
"#include \"kudu/util/net/dns_resolver.h\"\n"
"\n");

// Define metric prototypes for each method in the service.
Expand Down Expand Up @@ -578,7 +579,7 @@ class CodeGenerator : public ::google::protobuf::compiler::CodeGenerator {
" $service_name$Proxy(\n"
" std::shared_ptr<::kudu::rpc::Messenger> messenger,\n"
" const ::kudu::HostPort& hp,\n"
" DnsResolver* dns_resolver);\n"
" ::kudu::DnsResolver* dns_resolver);\n"
" ~$service_name$Proxy();\n");

for (int method_idx = 0; method_idx < service->method_count();
Expand Down Expand Up @@ -620,6 +621,7 @@ class CodeGenerator : public ::google::protobuf::compiler::CodeGenerator {
"#include \"$path_no_extension$.proxy.h\"\n"
"\n"
"namespace kudu {\n"
"class DnsResolver;\n"
"namespace rpc {\n"
"class Messenger;\n"
"class RpcController;\n"
Expand All @@ -646,7 +648,7 @@ class CodeGenerator : public ::google::protobuf::compiler::CodeGenerator {
"$service_name$Proxy::$service_name$Proxy(\n"
" std::shared_ptr<::kudu::rpc::Messenger> messenger,\n"
" const ::kudu::HostPort& hp,\n"
" DnsResolver* dns_resolver)\n"
" ::kudu::DnsResolver* dns_resolver)\n"
" : Proxy(std::move(messenger),\n"
" hp,\n"
" dns_resolver,\n"
Expand Down

0 comments on commit 50cc6f9

Please sign in to comment.