sentry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sp...@apache.org
Subject sentry git commit: SENTRY-1985: Sentry should log in stdout when it is ready to serve requests (Sergio Pena, reviewed by Alexander Kolbasov, Na Li)
Date Mon, 16 Oct 2017 18:21:04 GMT
Repository: sentry
Updated Branches:
  refs/heads/master 2ec0f3f82 -> ce049714b


SENTRY-1985: Sentry should log in stdout when it is ready to serve requests (Sergio Pena,
reviewed by Alexander Kolbasov, Na Li)


Project: http://git-wip-us.apache.org/repos/asf/sentry/repo
Commit: http://git-wip-us.apache.org/repos/asf/sentry/commit/ce049714
Tree: http://git-wip-us.apache.org/repos/asf/sentry/tree/ce049714
Diff: http://git-wip-us.apache.org/repos/asf/sentry/diff/ce049714

Branch: refs/heads/master
Commit: ce049714b529df02e795ffd3575ae1d33646329a
Parents: 2ec0f3f
Author: Sergio Pena <sergio.pena@cloudera.com>
Authored: Mon Oct 16 13:20:32 2017 -0500
Committer: Sergio Pena <sergio.pena@cloudera.com>
Committed: Mon Oct 16 13:20:32 2017 -0500

----------------------------------------------------------------------
 .../java/org/apache/sentry/service/thrift/HMSFollower.java  | 9 +++++++++
 .../org/apache/sentry/service/thrift/SentryService.java     | 3 +++
 2 files changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sentry/blob/ce049714/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 31fd459..0861132 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
@@ -49,6 +49,7 @@ public class HMSFollower implements Runnable, AutoCloseable {
   private final Configuration authzConf;
   private final SentryStore sentryStore;
   private final NotificationProcessor notificationProcessor;
+  private boolean readyToServe;
   private final HiveNotificationFetcher notificationFetcher;
   private final boolean hdfsSyncEnabled;
 
@@ -84,6 +85,7 @@ public class HMSFollower implements Runnable, AutoCloseable {
   public HMSFollower(Configuration conf, SentryStore store, LeaderStatusMonitor leaderMonitor,
               HiveConnectionFactory hiveConnectionFactory, String authServerName) {
     LOGGER.info("HMSFollower is being initialized");
+    readyToServe = false;
     authzConf = conf;
     this.leaderMonitor = leaderMonitor;
     sentryStore = store;
@@ -197,6 +199,13 @@ public class HMSFollower implements Runnable, AutoCloseable {
         return;
       }
 
+      if (!readyToServe) {
+        // Allow users and/or applications who look into the Sentry console output to see
+        // when Sentry is ready to serve.
+        System.out.println("Sentry HMS support is ready");
+        readyToServe = true;
+      }
+
       // Continue with processing new notifications if no snapshots are done.
       processNotifications(notifications);
     } catch (TException e) {

http://git-wip-us.apache.org/repos/asf/sentry/blob/ce049714/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 d2a4c2d..43535a7 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
@@ -270,6 +270,9 @@ public class SentryService implements Callable, SigUtils.SigListener {
     // 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");
+
+    // Allow clients/users watching the console to know when sentry is ready
+    System.out.println("Sentry service is ready to serve client requests");
     SentryStateBank.enableState(SentryServiceState.COMPONENT, SentryServiceState.SERVICE_RUNNING);
     thriftServer.serve();
   }


Mime
View raw message