You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by sa...@apache.org on 2018/04/23 17:38:55 UTC
[07/20] impala git commit: IMPALA-6878: SentryServicePinger should
not print stacktrace at every retry
IMPALA-6878: SentryServicePinger should not print stacktrace at every retry
With this patch, SentryServicePinger only prints the stacktrace at the
very end when Sentry Service is unable to start.
Testing:
- Started Sentry in a normal way to make sure no stack trace was printed
- Injected failure in Sentry to see the stack trace at the end
Change-Id: I26f9a141c89692443cb3cdcb6bf62581a93b5ba0
Reviewed-on: http://gerrit.cloudera.org:8080/10108
Reviewed-by: Philip Zeyliger <ph...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>
Project: http://git-wip-us.apache.org/repos/asf/impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/impala/commit/423ab360
Tree: http://git-wip-us.apache.org/repos/asf/impala/tree/423ab360
Diff: http://git-wip-us.apache.org/repos/asf/impala/diff/423ab360
Branch: refs/heads/2.x
Commit: 423ab36010b40eedb4f5657023f5b168db658cb2
Parents: dfc17b8
Author: Fredy wijaya <fw...@cloudera.com>
Authored: Wed Apr 18 14:02:59 2018 -0700
Committer: Impala Public Jenkins <im...@gerrit.cloudera.org>
Committed: Thu Apr 19 22:10:21 2018 +0000
----------------------------------------------------------------------
.../impala/testutil/SentryServicePinger.java | 22 ++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/impala/blob/423ab360/fe/src/test/java/org/apache/impala/testutil/SentryServicePinger.java
----------------------------------------------------------------------
diff --git a/fe/src/test/java/org/apache/impala/testutil/SentryServicePinger.java b/fe/src/test/java/org/apache/impala/testutil/SentryServicePinger.java
index 96a849b..705f58a 100644
--- a/fe/src/test/java/org/apache/impala/testutil/SentryServicePinger.java
+++ b/fe/src/test/java/org/apache/impala/testutil/SentryServicePinger.java
@@ -21,12 +21,12 @@ import org.apache.commons.cli.BasicParser;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.impala.authorization.User;
import org.apache.impala.authorization.SentryConfig;
+import org.apache.impala.authorization.User;
import org.apache.impala.util.SentryPolicyService;
+import org.apache.log4j.Level;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Simple class that issues a read-only RPC to the Sentry Service to check if it
@@ -41,6 +41,11 @@ public class SentryServicePinger {
// Suppress warnings from OptionBuilder.
@SuppressWarnings("static-access")
public static void main(String[] args) throws Exception {
+ // Programmatically disable Sentry Thrift logging since Sentry error logging can be
+ // pretty noisy and verbose.
+ org.apache.log4j.Logger logger4j = org.apache.log4j.Logger.getLogger("sentry");
+ logger4j.setLevel(Level.OFF);
+
// Parse command line options to get config file path.
Options options = new Options();
options.addOption(OptionBuilder.withLongOpt("config_file")
@@ -69,6 +74,7 @@ public class SentryServicePinger {
int sleepSecs = Integer.parseInt(cmdArgs.getOptionValue("sleep_secs"));
sentryConfig.loadConfig();
+ Exception exception = null;
while (numPings > 0) {
SentryPolicyService policyService = new SentryPolicyService(sentryConfig);
try {
@@ -76,12 +82,16 @@ public class SentryServicePinger {
LOG.info("Sentry Service ping succeeded.");
System.exit(0);
} catch (Exception e) {
- LOG.error(String.format("Error issuing RPC to Sentry Service (attempt %d/%d): ",
- maxPings - numPings + 1, maxPings), e);
+ exception = e;
+ LOG.error(String.format("Error issuing RPC to Sentry Service (attempt %d/%d)",
+ maxPings - numPings + 1, maxPings));
Thread.sleep(sleepSecs * 1000);
}
--numPings;
}
+ if (exception != null) {
+ LOG.error("Error starting Sentry Service: ", exception);
+ }
System.exit(1);
}
}