You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by rm...@apache.org on 2015/07/30 23:27:30 UTC

[1/3] incubator-ranger git commit: BUG-41359 : UserSync process performance issue due to user group cache inconsistency

Repository: incubator-ranger
Updated Branches:
  refs/heads/master f80cb1dd6 -> d8e322597


BUG-41359 : UserSync process performance issue due to user group cache inconsistency


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

Branch: refs/heads/master
Commit: dcd3ea0d8429516c7ef20eddce095fa9f7f9a9a1
Parents: f34eb3d
Author: rmani <rm...@hortonworks.com>
Authored: Tue Jul 28 10:54:49 2015 -0700
Committer: rmani <rm...@hortonworks.com>
Committed: Tue Jul 28 10:54:49 2015 -0700

----------------------------------------------------------------------
 .../ranger/unixusersync/model/XUserInfo.java    | 21 ++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/dcd3ea0d/ugsync/src/main/java/org/apache/ranger/unixusersync/model/XUserInfo.java
----------------------------------------------------------------------
diff --git a/ugsync/src/main/java/org/apache/ranger/unixusersync/model/XUserInfo.java b/ugsync/src/main/java/org/apache/ranger/unixusersync/model/XUserInfo.java
index 5a59fc7..ca22818 100644
--- a/ugsync/src/main/java/org/apache/ranger/unixusersync/model/XUserInfo.java
+++ b/ugsync/src/main/java/org/apache/ranger/unixusersync/model/XUserInfo.java
@@ -27,7 +27,8 @@ public class XUserInfo {
 	private String name ;
 	private String 	description ;
 	
-	private List<String>  groups = new ArrayList<String>() ;
+	private List<String>  	groupNameList = new ArrayList<String>() ;
+	private List<String>    groupIdList   = new ArrayList<String>() ;
 	
 	public String getId() {
 		return id;
@@ -48,8 +49,24 @@ public class XUserInfo {
 		this.description = description;
 	}
 	
+	public void setGroupNameList(List<String> groupNameList) {
+		this.groupNameList = groupNameList;
+	}
+	
+	public List<String> getGroupNameList() {
+		return groupNameList;
+	}
+	
+	public List<String> getGroupIdList() {
+		return groupIdList;
+	}
+	
+	public void setGroupIdList(List<String> groupIdList) {
+		this.groupIdList = groupIdList;
+	}
+
 	public List<String> getGroups() {
-		return groups;
+		return groupNameList;
 	}
 	
 }


[2/3] incubator-ranger git commit: RANGER-590: Escape spaces in the user and group names which are part of rest call uri in UserSync process

Posted by rm...@apache.org.
RANGER-590: Escape spaces in the user and group names which are part of rest call uri in UserSync process


Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/39fc361f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/39fc361f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/39fc361f

Branch: refs/heads/master
Commit: 39fc361f817da1cfaca1d21ed679134414bfda93
Parents: dcd3ea0
Author: rmani <rm...@hortonworks.com>
Authored: Thu Jul 30 14:20:29 2015 -0700
Committer: rmani <rm...@hortonworks.com>
Committed: Thu Jul 30 14:20:29 2015 -0700

----------------------------------------------------------------------
 .../process/PolicyMgrUserGroupBuilder.java      | 45 +++++++++++++-------
 .../ranger/usersync/util/UserSyncUtil.java      | 39 +++++++++++++++++
 2 files changed, 68 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/39fc361f/ugsync/src/main/java/org/apache/ranger/unixusersync/process/PolicyMgrUserGroupBuilder.java
----------------------------------------------------------------------
diff --git a/ugsync/src/main/java/org/apache/ranger/unixusersync/process/PolicyMgrUserGroupBuilder.java b/ugsync/src/main/java/org/apache/ranger/unixusersync/process/PolicyMgrUserGroupBuilder.java
index 5768f55..78e3e72 100644
--- a/ugsync/src/main/java/org/apache/ranger/unixusersync/process/PolicyMgrUserGroupBuilder.java
+++ b/ugsync/src/main/java/org/apache/ranger/unixusersync/process/PolicyMgrUserGroupBuilder.java
@@ -63,7 +63,7 @@ import org.apache.ranger.unixusersync.model.XUserGroupInfo;
 import org.apache.ranger.unixusersync.model.XUserInfo;
 import org.apache.ranger.unixusersync.model.UserGroupInfo;
 import org.apache.ranger.usergroupsync.UserGroupSink;
-import org.mortbay.log.Log;
+import org.apache.ranger.usersync.util.UserSyncUtil;
 
 public class PolicyMgrUserGroupBuilder implements UserGroupSink {
 	
@@ -603,25 +603,38 @@ public class PolicyMgrUserGroupBuilder implements UserGroupSink {
 	}
 
 	private void delXUserGroupInfo(XUserInfo aUserInfo, XGroupInfo aGroupInfo) {
-		
-		Client c = getClient() ;
-	    
-	    String uri = PM_DEL_USER_GROUP_LINK_URI.replaceAll(Pattern.quote("${groupName}"), aGroupInfo.getName()).replaceAll(Pattern.quote("${userName}"), aUserInfo.getName()) ;
-	    
-	    WebResource r = c.resource(getURL(uri)) ;
-	    
-	    ClientResponse response = r.delete(ClientResponse.class) ;
-	    
-	    LOG.debug("RESPONSE: [" + response.toString() + "]") ;
+	
+		String groupName = aGroupInfo.getName();
 
-	    
-	    if (response.getStatus() == 200) {
-	    	delUserGroupFromList(aUserInfo, aGroupInfo) ;
-	    }
+		String userName  = aUserInfo.getName();
 		
+		try {
+
+			Client c = getClient() ;
+
+			String uri = PM_DEL_USER_GROUP_LINK_URI.replaceAll(Pattern.quote("${groupName}"), 
+					   UserSyncUtil.encodeURIParam(groupName)).replaceAll(Pattern.quote("${userName}"), UserSyncUtil.encodeURIParam(userName));
+
+			WebResource r = c.resource(getURL(uri)) ;
+
+		    ClientResponse response = r.delete(ClientResponse.class) ;
+
+		    if ( LOG.isDebugEnabled() ) {
+		    	LOG.debug("RESPONSE: [" + response.toString() + "]") ;
+		    }
+
+		    if (response.getStatus() == 200) {
+		    	delUserGroupFromList(aUserInfo, aGroupInfo) ;
+		    }
+ 
+		} catch (Exception e) {
+
+			LOG.warn( "ERROR: Unable to delete GROUP: " + groupName  + " from USER:" + userName , e) ;
+		}
+
 	}
 	
-	
+
 	private MUserInfo addMUser(String aUserName) {
 		
 		MUserInfo ret = null ;

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/39fc361f/ugsync/src/main/java/org/apache/ranger/usersync/util/UserSyncUtil.java
----------------------------------------------------------------------
diff --git a/ugsync/src/main/java/org/apache/ranger/usersync/util/UserSyncUtil.java b/ugsync/src/main/java/org/apache/ranger/usersync/util/UserSyncUtil.java
new file mode 100644
index 0000000..050419d
--- /dev/null
+++ b/ugsync/src/main/java/org/apache/ranger/usersync/util/UserSyncUtil.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ranger.usersync.util;
+
+import org.apache.commons.httpclient.URIException;
+import org.apache.commons.httpclient.util.URIUtil;
+
+public class UserSyncUtil {
+
+	public static String encodeURIParam(String s) throws URIException {
+
+		String ret = null;
+
+		try {
+			ret = URIUtil.encodeQuery(s);
+		} catch (URIException e) {
+			throw e;
+		}
+
+		return ret;
+	}
+}


[3/3] incubator-ranger git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-ranger

Posted by rm...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-ranger


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

Branch: refs/heads/master
Commit: d8e3225974fb2b7b47ca5d80bc691e3bdd4b09f6
Parents: 39fc361 f80cb1d
Author: rmani <rm...@hortonworks.com>
Authored: Thu Jul 30 14:27:20 2015 -0700
Committer: rmani <rm...@hortonworks.com>
Committed: Thu Jul 30 14:27:20 2015 -0700

----------------------------------------------------------------------
 .../model/validation/RangerPolicyValidator.java | 265 +++++++++++++++----
 .../model/validation/RangerValidator.java       |  42 ++-
 .../validation/ValidationFailureDetails.java    |  38 ++-
 .../ValidationFailureDetailsBuilder.java        |  19 +-
 .../validation/TestRangerPolicyValidator.java   |  22 +-
 .../TestValidationFailureDetails.java           |  58 ++++
 .../hbase/XaSecureAuthorizationCoprocessor.java |   4 +-
 7 files changed, 367 insertions(+), 81 deletions(-)
----------------------------------------------------------------------