SENTRY-1632: Make HMSFollower initialDelay and run period configurable (Hao Hao, Reviewed by: Vamsee Yarlagadda)
Change-Id: If62bf25f65324fcd0c7dfd252066e59069a292c9 Project: http://git-wip-us.apache.org/repos/asf/sentry/repo Commit: http://git-wip-us.apache.org/repos/asf/sentry/commit/3f99bbdb Tree: http://git-wip-us.apache.org/repos/asf/sentry/tree/3f99bbdb Diff: http://git-wip-us.apache.org/repos/asf/sentry/diff/3f99bbdb Branch: refs/heads/sentry-ha-redesign Commit: 3f99bbdb3a75637f070cd51910853fb82ae34a49 Parents: 0a1a736 Author: hahao <[email protected]> Authored: Fri Feb 17 11:41:12 2017 -0800 Committer: hahao <[email protected]> Committed: Fri Feb 17 11:41:12 2017 -0800 ---------------------------------------------------------------------- .../java/org/apache/sentry/service/thrift/SentryService.java | 6 +++++- .../org/apache/sentry/service/thrift/ServiceConstants.java | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/sentry/blob/3f99bbdb/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java index be59c1e..e6021f1 100644 --- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java +++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java @@ -157,9 +157,13 @@ public class SentryService implements Callable, SigUtils.SigListener { if (notificationLogEnabled) { try { + long initDelay = conf.getLong(ServerConfig.SENTRY_HMSFOLLOWER_INIT_DELAY_MILLS, + ServerConfig.SENTRY_HMSFOLLOWER_INIT_DELAY_MILLS_DEFAULT); + long period = conf.getLong(ServerConfig.SENTRY_HMSFOLLOWER_INTERVAL_MILLS, + ServerConfig.SENTRY_HMSFOLLOWER_INTERVAL_MILLS_DEFAULT); hmsFollowerExecutor = Executors.newScheduledThreadPool(1); hmsFollowerExecutor.scheduleAtFixedRate(new HMSFollower(conf, leaderMonitor), - 60000, 500, TimeUnit.MILLISECONDS); + initDelay, period, TimeUnit.MILLISECONDS); } catch (Exception e) { //TODO: Handle LOGGER.error("Could not start HMSFollower"); http://git-wip-us.apache.org/repos/asf/sentry/blob/3f99bbdb/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java index e10ddfd..806d03e 100644 --- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java +++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java @@ -165,6 +165,12 @@ public class ServiceConstants { .put("javax.jdo.option.Multithreaded", "true") .build(); + // InitialDelay and period time for HMSFollower thread. + public static final String SENTRY_HMSFOLLOWER_INIT_DELAY_MILLS = "sentry.hmsfollower.init.delay.mills"; + public static final long SENTRY_HMSFOLLOWER_INIT_DELAY_MILLS_DEFAULT = 60000; + public static final String SENTRY_HMSFOLLOWER_INTERVAL_MILLS = "sentry.hmsfollower.interval.mills"; + public static final long SENTRY_HMSFOLLOWER_INTERVAL_MILLS_DEFAULT = 500; + public static final String SENTRY_NOTIFICATION_LOG_ENABLED = "sentry.notification.log.enabled"; public static final boolean SENTRY_NOTIFICATION_LOG_ENABLED_DEFAULT = false; public static final String SENTRY_WEB_ENABLE = "sentry.service.web.enable";
