ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject [4/9] git commit: ARGUS-5
Date Fri, 19 Sep 2014 21:32:55 GMT
ARGUS-5

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

Branch: refs/heads/master
Commit: 5c29ec203fab50f8a2ad037185bd89d7db33a7aa
Parents: 84c2244
Author: rmani <rmani@hortonworks.com>
Authored: Fri Sep 12 23:22:20 2014 -0700
Committer: rmani <rmani@hortonworks.com>
Committed: Fri Sep 12 23:22:20 2014 -0700

----------------------------------------------------------------------
 .../hadoop/log/HdfsFileAppender.java            | 34 ++++++++++----------
 1 file changed, 17 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/5c29ec20/agents-common/src/main/java/com/xasecure/authorization/hadoop/log/HdfsFileAppender.java
----------------------------------------------------------------------
diff --git a/agents-common/src/main/java/com/xasecure/authorization/hadoop/log/HdfsFileAppender.java
b/agents-common/src/main/java/com/xasecure/authorization/hadoop/log/HdfsFileAppender.java
index 86a9bb1..1beb016 100644
--- a/agents-common/src/main/java/com/xasecure/authorization/hadoop/log/HdfsFileAppender.java
+++ b/agents-common/src/main/java/com/xasecure/authorization/hadoop/log/HdfsFileAppender.java
@@ -952,8 +952,7 @@ class HdfsSink {
 
 	  private static final String DS_REPLICATION_VAL = "1";
 	  private static final String DS_REPLICATION_KEY = "dfs.replication";
-	  private static final String FS_DEFAULT_NAME_KEY = "ds.default.name";
-	  
+	  private static final String FS_DEFAULT_NAME_KEY = "fs.default.name";
 	  private Configuration conf = null;
 	  private FileSystem fs= null;
       private Path pt = null;
@@ -985,8 +984,8 @@ class HdfsSink {
 		return hdfssink.get();
 	 }
   
-	  public void init(String fileSystemName, String fileName, String fileCache,boolean append,
boolean bufferedIO, int bufferSize, Layout layout, String encoding, String scheduledCacheFile,
Writer cacheWriter, boolean hdfsUpdateAllowed, String processUser) throws IOException, InterruptedException{
-		   this.conf= new Configuration();
+	 public void init(String fileSystemName, String fileName, String fileCache,boolean append,
boolean bufferedIO, int bufferSize, Layout layout, String encoding, String scheduledCacheFile,
Writer cacheWriter, boolean hdfsUpdateAllowed, String processUser) throws Exception{
+		   
 		   this.fsName=fileSystemName;
 		   this.fileName=fileName;
 		   this.layout=layout;
@@ -996,20 +995,21 @@ class HdfsSink {
 		   this.fileCache=fileCache;
 		   this.hdfsUpdateAllowed=hdfsUpdateAllowed;
 		   this.processUser=processUser;
-		  
+		   
+		   final Configuration conf= new Configuration();
+      	   conf.set(DS_REPLICATION_KEY,DS_REPLICATION_VAL);
+      	   conf.set(FS_DEFAULT_NAME_KEY, fsName);
+      	   
            try {
-        	   
-        	   conf.set(DS_REPLICATION_KEY,DS_REPLICATION_VAL);
-        	   conf.set(FS_DEFAULT_NAME_KEY, this.fsName);
-        	   
-        	   if ( fs == null) {
+        	    if ( fs == null) {
         		 LogLog.debug("Opening Connection to hdfs Sytem" + this.fsName);
         		         		        		 
         		 UserGroupInformation ugi = UserGroupInformation.createProxyUser(this.processUser,
UserGroupInformation.getLoginUser());
-    		     ugi.doAs( new PrivilegedExceptionAction<Void>() {
-    		    	 public Void run() throws IOException {
-    		    		 fs = FileSystem.get(conf);
-    		    		 return null;
+        		 fs = ugi.doAs( new PrivilegedExceptionAction<FileSystem>() {
+    		    	  public FileSystem run() throws Exception {
+    		    		 FileSystem filesystem = FileSystem.get(conf); 
+    		    		 LogLog.debug("Inside UGI.."  + fsName + " " + filesystem);
+    		    		 return filesystem;
     		    	 }
     		     });
         		 
@@ -1024,7 +1024,7 @@ class HdfsSink {
         	     
         	    }
         	   
-	           } catch(IOException ie) {
+	           } catch(Exception ie) {
 	        	 
             	 LogLog.error("Unable to Create hdfs logfile:" + ie.getMessage());  
             	 throw ie;
@@ -1054,14 +1054,14 @@ class HdfsSink {
 	    	  pt = new Path(this.fileName);
 	    	  // if file Exist append it
 	    	  if(fs.exists(pt)) {
-	        	  LogLog.debug("Appending File: "+ this.fsName+":"+this.fileName);  
+	        	  LogLog.debug("Appending File: "+ this.fsName+":"+this.fileName+fs);  
 		      	  if (hdfsostream !=null) {
 		      		  hdfsostream.close();
 		          }
 		      	  hdfsostream=fs.append(pt);	
 		      	  
 	           } else {
-	        	   LogLog.debug("Creating File directories in hdfs if not present.."+ this.fsName+":"+this.fileName);
 
+	        	   LogLog.debug("Creating File directories in hdfs if not present.."+ this.fsName+":"+this.fileName
+ fs);  
 		           String parentName = new Path(this.fileName).getParent().toString();
 		           if(parentName != null) {
 		              Path parentDir = new Path(parentName);


Mime
View raw message