CDH-53636: HMSFollower would never start Change-Id: Id1dc86a51d368c2f35f95266a6bc275ef2d5c396 Reviewed-on: http://gerrit.sjc.cloudera.com:8080/22443 Tested-by: Jenkins User Reviewed-by: Alexander Kolbasov <[email protected]> Reviewed-by: Kalyan Kumar Kalvagadda <[email protected]>
Project: http://git-wip-us.apache.org/repos/asf/sentry/repo Commit: http://git-wip-us.apache.org/repos/asf/sentry/commit/06444b9e Tree: http://git-wip-us.apache.org/repos/asf/sentry/tree/06444b9e Diff: http://git-wip-us.apache.org/repos/asf/sentry/diff/06444b9e Branch: refs/for/cdh5-1.5.1_ha Commit: 06444b9eff4a8f86494383d47b614d7a920ac976 Parents: 5bdecd7 Author: Alexander Kolbasov <[email protected]> Authored: Tue May 9 17:37:54 2017 -0700 Committer: Alexander Kolbasov <[email protected]> Committed: Tue May 9 19:15:35 2017 -0700 ---------------------------------------------------------------------- .../apache/sentry/service/thrift/HMSFollower.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/sentry/blob/06444b9e/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/HMSFollower.java ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/HMSFollower.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/HMSFollower.java index da576c9..29f6957 100644 --- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/HMSFollower.java +++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/HMSFollower.java @@ -128,13 +128,20 @@ public class HMSFollower implements Runnable, AutoCloseable { return client; } + final HiveConf hiveConf = new HiveConf(); // Do not create client if the metastre URI in the configuration is missing - if (conf.get(CONF_METASTORE_URI, "").isEmpty()) { - // Come back later with real Hive URI - return null; + if (hiveConf.get(CONF_METASTORE_URI, "").isEmpty()) { + // HDFS e2e tests add metastore URI to the sentry config, so it might be there + String metastoreUri = conf.get(CONF_METASTORE_URI); + if (metastoreUri == null) { + // Come back later with real Hive URI + return null; + } + // Ok, we found metastore URI in Sentry config (thanks to the tests setup), copy it to + // the Hive config + hiveConf.set(CONF_METASTORE_URI, metastoreUri); } - final HiveConf hiveConf = new HiveConf(); hiveInstance = hiveConf.get(HiveAuthzConf.AuthzConfVars.AUTHZ_SERVER_NAME.getVar()); String principal, keytab;
