sentry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sra...@apache.org
Subject sentry git commit: SENTRY-1376: Fix alter property case correctly - Deletes ACLS on the table (Sravya Tirukkovalur, Reviewed by: Hao Hao) [Forced Update!]
Date Thu, 30 Jun 2016 21:51:59 GMT
Repository: sentry
Updated Branches:
  refs/heads/master eee2ea1b4 -> 312ed27fe (forced update)


SENTRY-1376: Fix alter property case correctly - Deletes ACLS on the table (Sravya Tirukkovalur,
Reviewed by: Hao Hao)

Change-Id: I6ea6aba2aad688519a8ca60b1ec93ee8a4abcf90


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

Branch: refs/heads/master
Commit: 312ed27fe2d892b4225d30cc763b5800c36cff6c
Parents: 6fbff11
Author: Sravya Tirukkovalur <sravya@apache.org>
Authored: Thu Jun 30 14:29:05 2016 -0700
Committer: Sravya Tirukkovalur <sravya@apache.org>
Committed: Thu Jun 30 14:50:58 2016 -0700

----------------------------------------------------------------------
 .../SentryMetastorePostEventListener.java       |  4 +---
 .../sentry/hdfs/UpdateableAuthzPaths.java       | 23 ++++++++++++++++----
 2 files changed, 20 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sentry/blob/312ed27f/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/metastore/SentryMetastorePostEventListener.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/metastore/SentryMetastorePostEventListener.java
b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/metastore/SentryMetastorePostEventListener.java
index 8d8f5ce..9844c33 100644
--- a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/metastore/SentryMetastorePostEventListener.java
+++ b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/metastore/SentryMetastorePostEventListener.java
@@ -391,10 +391,8 @@ public class SentryMetastorePostEventListener extends MetaStoreEventListener
{
     }
     // The HDFS plugin needs to know if it's a path change (set location)
     for (SentryMetastoreListenerPlugin plugin : sentryPlugins) {
-      if(!oldPath.equals(newPath)) {
-        plugin.renameAuthzObject(oldDbName + "." + oldTabName, oldPath,
+      plugin.renameAuthzObject(oldDbName + "." + oldTabName, oldPath,
                 newDbName + "." + newTabName, newPath);
-      }
     }
   }
 

http://git-wip-us.apache.org/repos/asf/sentry/blob/312ed27f/sentry-hdfs/sentry-hdfs-common/src/main/java/org/apache/sentry/hdfs/UpdateableAuthzPaths.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs/sentry-hdfs-common/src/main/java/org/apache/sentry/hdfs/UpdateableAuthzPaths.java
b/sentry-hdfs/sentry-hdfs-common/src/main/java/org/apache/sentry/hdfs/UpdateableAuthzPaths.java
index 4264a21..ad7f8c9 100644
--- a/sentry-hdfs/sentry-hdfs-common/src/main/java/org/apache/sentry/hdfs/UpdateableAuthzPaths.java
+++ b/sentry-hdfs/sentry-hdfs-common/src/main/java/org/apache/sentry/hdfs/UpdateableAuthzPaths.java
@@ -17,6 +17,7 @@
  */
 package org.apache.sentry.hdfs;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicLong;
@@ -109,19 +110,33 @@ public class UpdateableAuthzPaths implements AuthzPaths, Updateable<PathsUpdate>
         return;
       }
     }
+
+    List<TPathChanges> deletePathChanges = new ArrayList<TPathChanges>();
+    List<TPathChanges> addPathChanges = new ArrayList<TPathChanges>();
+
     for (TPathChanges pathChanges : update.getPathChanges()) {
-      paths.addPathsToAuthzObject(pathChanges.getAuthzObj(), pathChanges
-          .getAddPaths(), true);
+      if (pathChanges.getDelPaths() != null && pathChanges.getDelPaths().size() !=
0) {
+        deletePathChanges.add(pathChanges);
+      }
+      if (pathChanges.getAddPaths() != null && pathChanges.getAddPaths().size() !=
0) {
+        addPathChanges.add(pathChanges);
+      }
+    }
+    for (TPathChanges pathChanges : deletePathChanges) {
       List<List<String>> delPaths = pathChanges.getDelPaths();
       if (delPaths.size() == 1 && delPaths.get(0).size() == 1
-          && delPaths.get(0).get(0).equals(PathsUpdate.ALL_PATHS)) {
+              && delPaths.get(0).get(0).equals(PathsUpdate.ALL_PATHS)) {
         // Remove all paths.. eg. drop table
         paths.deleteAuthzObject(pathChanges.getAuthzObj());
       } else {
         paths.deletePathsFromAuthzObject(pathChanges.getAuthzObj(), pathChanges
-            .getDelPaths());
+                .getDelPaths());
       }
     }
+    for (TPathChanges pathChanges : addPathChanges) {
+      paths.addPathsToAuthzObject(pathChanges.getAuthzObj(), pathChanges
+          .getAddPaths(), true);
+    }
   }
 
   @Override


Mime
View raw message