sentry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ak...@apache.org
Subject sentry git commit: SENTRY-1376: Fix alter property case correctly - Deletes ACLS on the table (Sravya Tirukkovalur, Reviewed by: Hao Hao)
Date Sat, 11 Mar 2017 01:57:07 GMT
Repository: sentry
Updated Branches:
  refs/heads/sentry-ha-redesign b850bbb0c -> 51209d98f


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


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

Branch: refs/heads/sentry-ha-redesign
Commit: 51209d98f50bf63522162427858c29eb24870b0f
Parents: b850bbb
Author: Alexander Kolbasov <akolb@cloudera.com>
Authored: Fri Mar 10 17:56:57 2017 -0800
Committer: Alexander Kolbasov <akolb@cloudera.com>
Committed: Fri Mar 10 17:56:57 2017 -0800

----------------------------------------------------------------------
 .../sentry/hdfs/UpdateableAuthzPaths.java       | 23 ++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sentry/blob/51209d98/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