SENTRY-1717: Sentry should emit log messages when it is ready to serve requests (Na Li, reviewed by Alex Kolbasov)
Change-Id: Icf6827395dc4637214b330727a97a2dd51d6f2d7 Reviewed-on: http://gerrit.sjc.cloudera.com:8080/22666 Tested-by: Jenkins User Reviewed-by: Alexander Kolbasov <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/sentry/repo Commit: http://git-wip-us.apache.org/repos/asf/sentry/commit/28636395 Tree: http://git-wip-us.apache.org/repos/asf/sentry/tree/28636395 Diff: http://git-wip-us.apache.org/repos/asf/sentry/diff/28636395 Branch: refs/for/cdh5-1.5.1_ha Commit: 2863639537197ef1f8065cc6f1ea9877a20facab Parents: 14e9ac7 Author: Alexander Kolbasov <[email protected]> Authored: Thu May 11 21:48:00 2017 -0700 Committer: Alexander Kolbasov <[email protected]> Committed: Mon May 15 14:01:31 2017 -0700 ---------------------------------------------------------------------- .../java/org/apache/sentry/service/thrift/HMSFollower.java | 8 ++++++++ .../java/org/apache/sentry/service/thrift/SentryService.java | 4 ++++ 2 files changed, 12 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/sentry/blob/28636395/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 d2bc5af..5548ac0 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 @@ -84,6 +84,7 @@ public class HMSFollower implements Runnable, AutoCloseable { private String hiveInstance; private boolean needHiveSnapshot = true; + private boolean needLogHMSSupportReady = true; private final LeaderStatusMonitor leaderMonitor; HMSFollower(Configuration conf, SentryStore store, LeaderStatusMonitor leaderMonitor) throws Exception { @@ -313,6 +314,13 @@ public class HMSFollower implements Runnable, AutoCloseable { wakeUpWaitingClientsForSync(currentEventID); } + // HMSFollower connected to HMS and it finished full snapshot if that was required + // Log this message only once + if (needLogHMSSupportReady && connectedToHMS) { + LOGGER.info("Sentry HMS support is ready"); + needLogHMSSupportReady = false; + } + // HIVE-15761: Currently getNextNotification API may return an empty // NotificationEventResponse causing TProtocolException. // Workaround: Only processes the notification events newer than the last updated one. http://git-wip-us.apache.org/repos/asf/sentry/blob/28636395/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 a8c8e05..3543ace 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 @@ -265,6 +265,10 @@ public class SentryService implements Callable, SigUtils.SigListener { thriftServer = new TThreadPoolServer(args); LOGGER.info("Serving on " + address); startSentryWebServer(); + + // thriftServer.serve() does not return until thriftServer is stopped. Need to log before + // calling thriftServer.serve() + LOGGER.info("Sentry service is ready to serve client requests"); thriftServer.serve(); }
