You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sentry.apache.org by sr...@apache.org on 2016/10/27 20:25:45 UTC
sentry git commit: SENTRY-1270: Improve error handling - Database
with malformed URI causes NPE in HMS plugin during DDL (Sravya Tirukkovalur,
Reviewed by: Lenni Kuff)
Repository: sentry
Updated Branches:
refs/heads/master 44dc1598e -> b8be26f84
SENTRY-1270: Improve error handling - Database with malformed URI causes NPE in HMS plugin during DDL (Sravya Tirukkovalur, Reviewed by: Lenni Kuff)
Change-Id: I11da6179300ff50e892b7d7c0d290d4213be55a9
Project: http://git-wip-us.apache.org/repos/asf/sentry/repo
Commit: http://git-wip-us.apache.org/repos/asf/sentry/commit/b8be26f8
Tree: http://git-wip-us.apache.org/repos/asf/sentry/tree/b8be26f8
Diff: http://git-wip-us.apache.org/repos/asf/sentry/diff/b8be26f8
Branch: refs/heads/master
Commit: b8be26f84277644ddfd5d0e8512404857dc89ab1
Parents: 44dc159
Author: Sravya Tirukkovalur <sr...@apache.org>
Authored: Thu Oct 27 13:25:11 2016 -0700
Committer: Sravya Tirukkovalur <sr...@apache.org>
Committed: Thu Oct 27 13:25:11 2016 -0700
----------------------------------------------------------------------
.../java/org/apache/sentry/hdfs/MetastorePlugin.java | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/sentry/blob/b8be26f8/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/MetastorePlugin.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/MetastorePlugin.java b/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/MetastorePlugin.java
index f37596d..2df9f45 100644
--- a/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/MetastorePlugin.java
+++ b/sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/MetastorePlugin.java
@@ -53,6 +53,10 @@ public class MetastorePlugin extends SentryMetastoreListenerPlugin {
private static final Logger LOGGER = LoggerFactory.getLogger(MetastorePlugin.class);
+ private static final String initializationFailureMsg = "Cache failed to initialize, cannot send path updates to Sentry." +
+ " Please review HMS error logs during startup for additional information. If the initialization failure is due" +
+ " to SentryMalformedPathException, you will need to rectify the malformed path in HMS db and restart HMS";
+
class SyncTask implements Runnable {
@Override
public void run() {
@@ -61,8 +65,7 @@ public class MetastorePlugin extends SentryMetastoreListenerPlugin {
return;
}
if (MetastorePlugin.this.authzPaths == null) {
- LOGGER.info("#### Metastore Plugin cache has not finished" +
- "initialization.");
+ LOGGER.warn(initializationFailureMsg);
return;
}
try {
@@ -316,6 +319,10 @@ public class MetastorePlugin extends SentryMetastoreListenerPlugin {
protected void applyLocal(PathsUpdate update) {
final Timer.Context timerContext =
SentryHdfsMetricsUtil.getApplyLocalUpdateTimer.time();
+ if(authzPaths == null) {
+ LOGGER.error(initializationFailureMsg);
+ return;
+ }
authzPaths.updatePartial(Lists.newArrayList(update), new ReentrantReadWriteLock());
timerContext.stop();
SentryHdfsMetricsUtil.getApplyLocalUpdateHistogram.update(
@@ -323,6 +330,10 @@ public class MetastorePlugin extends SentryMetastoreListenerPlugin {
}
private void notifySentryAndApplyLocal(PathsUpdate update) {
+ if(authzPaths == null) {
+ LOGGER.error(initializationFailureMsg);
+ return;
+ }
if (initComplete) {
processUpdate(update);
} else {