This is an automated email from the ASF dual-hosted git repository.

abukor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git


The following commit(s) were added to refs/heads/master by this push:
     new 960e300  KUDU-3189: log Hive Metatore URI when connecting
960e300 is described below

commit 960e30055b12870ad425e746b907b9b7d9459194
Author: Zoltan Chovan <[email protected]>
AuthorDate: Sat Jul 17 18:26:50 2021 +0200

    KUDU-3189: log Hive Metatore URI when connecting
    
    When 'kudu hms' is connecting to an HMS instance there is no user facing
    information log about which HMS instance the connection is opened for.
    This change adds a simple log line to the thrift client that shows this
    information, but only when the verbosity level is set to 1.
    
    Change-Id: Ide920bc1fca44e318d3c4e2921eb0588a82b7400
    Reviewed-on: http://gerrit.cloudera.org:8080/17695
    Tested-by: Kudu Jenkins
    Reviewed-by: Attila Bukor <[email protected]>
---
 src/kudu/thrift/client.h         |  2 ++
 src/kudu/tools/kudu-tool-test.cc | 30 ++++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/src/kudu/thrift/client.h b/src/kudu/thrift/client.h
index fa1210f..76a554b 100644
--- a/src/kudu/thrift/client.h
+++ b/src/kudu/thrift/client.h
@@ -340,6 +340,8 @@ Status HaClient<Service>::Reconnect() {
     reconnect_idx_ = (reconnect_idx_ + 1) % addresses_.size();
 
     service_client_ = Service(address, options_);
+    VLOG(1) << strings::Substitute(
+            "Attempting to connect to $0", address.ToString());
     s = service_client_.Start();
     if (s.ok()) {
       VLOG(1) << strings::Substitute(
diff --git a/src/kudu/tools/kudu-tool-test.cc b/src/kudu/tools/kudu-tool-test.cc
index d77f8bc..aa70e15 100644
--- a/src/kudu/tools/kudu-tool-test.cc
+++ b/src/kudu/tools/kudu-tool-test.cc
@@ -5468,6 +5468,36 @@ TEST_F(ToolTest, TestHmsList) {
   ASSERT_STR_CONTAINS(out, "table2,,,");
 }
 
+TEST_F(ToolTest, TestHMSAddressLog) {
+  ExternalMiniClusterOptions opts;
+  opts.hms_mode = HmsMode::ENABLE_HIVE_METASTORE;
+  opts.enable_kerberos = EnableKerberos();
+  NO_FATALS(StartExternalMiniCluster(std::move(opts)));
+
+  // Enable the HMS integration.
+  cluster_->ShutdownNodes(cluster::ClusterNodes::MASTERS_ONLY);
+  cluster_->EnableMetastoreIntegration();
+  ASSERT_OK(cluster_->Restart());
+
+  string master_addr = cluster_->master()->bound_rpc_addr().ToString();
+  thrift::ClientOptions hms_opts;
+  hms_opts.enable_kerberos = EnableKerberos();
+  hms_opts.service_principal = "hive";
+  HmsClient hms_client(cluster_->hms()->address(), hms_opts);
+  ASSERT_OK(hms_client.Start());
+  ASSERT_TRUE(hms_client.IsConnected());
+
+  FLAGS_hive_metastore_uris = cluster_->hms()->uris();
+  FLAGS_hive_metastore_sasl_enabled = EnableKerberos();
+  HmsCatalog hms_catalog(master_addr);
+  ASSERT_OK(hms_catalog.Start());
+
+  string err;
+  RunActionStderrString(Substitute("hms list $0 -v 1", master_addr), &err);
+  ASSERT_STR_CONTAINS(err,
+      Substitute("Attempting to connect to $0", 
cluster_->hms()->address().ToString()));
+}
+
 // This test is parameterized on the serialization mode and Kerberos.
 class ControlShellToolTest :
     public ToolTest,

Reply via email to