You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by gr...@apache.org on 2020/01/21 18:15:38 UTC

[kudu] branch master updated: [master] Replace hive_metastore_sasl_enabled validator

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

granthenke 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 950d9bf  [master] Replace hive_metastore_sasl_enabled validator
950d9bf is described below

commit 950d9bfb8f451f3d3ba1b920ada31c9add6e5e4e
Author: Grant Henke <gr...@apache.org>
AuthorDate: Tue Jan 21 11:24:10 2020 -0600

    [master] Replace hive_metastore_sasl_enabled validator
    
    The hive_metastore_sasl_enabled GROUP_FLAG_VALIDATOR
    that was added in a76177f was accidentally removed in 4f82a46.
    
    The validation is added back in this patch. However, it is
    validated in RunMasterServer() as opposed to using a
    GROUP_FLAG_VALIDATOR because the master server can be run
    from the tools now.
    
    Change-Id: I9ecea5b4b4e0d4bdd198241f23bf34ea46ff6945
    Reviewed-on: http://gerrit.cloudera.org:8080/15076
    Tested-by: Kudu Jenkins
    Reviewed-by: Andrew Wong <aw...@cloudera.com>
---
 src/kudu/master/master_runner.cc | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/kudu/master/master_runner.cc b/src/kudu/master/master_runner.cc
index 07cec26..3c5d8ef 100644
--- a/src/kudu/master/master_runner.cc
+++ b/src/kudu/master/master_runner.cc
@@ -34,9 +34,26 @@ using std::string;
 
 DECLARE_bool(evict_failed_followers);
 
+DECLARE_bool(hive_metastore_sasl_enabled);
+DECLARE_string(keytab_file);
+
 namespace kudu {
 namespace master {
 
+// Validates that if the HMS is configured with SASL enabled, the server has a
+// keytab available. This doesn't use a GROUP_FLAG_VALIDATOR because this check
+// only needs to be run on a server. E.g. tools that run with the HMS don't need
+// to pass in a keytab.
+static Status ValidateHiveMetastoreSaslEnabled() {
+    if (FLAGS_hive_metastore_sasl_enabled &&
+        FLAGS_keytab_file.empty()) {
+        return Status::ConfigurationError("When the Hive Metastore has SASL enabled "
+                                          "(--hive_metastore_sasl_enabled), Kudu must be "
+                                          "configured with a keytab (--keytab_file).");
+    }
+    return Status::OK();
+}
+
 void SetMasterFlagDefaults() {
   // Reset some default values before parsing gflags.
   CHECK_NE("", google::SetCommandLineOptionWithMode("rpc_bind_addresses",
@@ -75,6 +92,8 @@ Status RunMasterServer() {
             << "Master server version:\n"
             << VersionInfo::GetAllVersionInfo();
 
+  RETURN_NOT_OK(ValidateHiveMetastoreSaslEnabled());
+
   Master server({});
   RETURN_NOT_OK(server.Init());
   RETURN_NOT_OK(server.Start());