hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yhema...@apache.org
Subject svn commit: r754645 - in /hadoop/core/trunk: CHANGES.txt src/mapred/org/apache/hadoop/mapred/JobHistory.java src/test/org/apache/hadoop/mapred/TestJobHistory.java
Date Sun, 15 Mar 2009 10:27:37 GMT
Author: yhemanth
Date: Sun Mar 15 10:27:36 2009
New Revision: 754645

URL: http://svn.apache.org/viewvc?rev=754645&view=rev
Log:
HADOOP-4783. Change permissions on history files on the jobtracker to be only group readable
instead of world readable. Contributed by Amareshwari Sriramadasu.

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JobHistory.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestJobHistory.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=754645&r1=754644&r2=754645&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Sun Mar 15 10:27:36 2009
@@ -362,6 +362,10 @@
     WebUI if there are such blocks. '-report' and '-metaSave' have extra
     info to track such blocks. (Raghu Angadi)
 
+    HADOOP-4783. Change permissions on history files on the jobtracker
+    to be only group readable instead of world readable.
+    (Amareshwari Sriramadasu via yhemanth)
+
   NEW FEATURES
 
     HADOOP-4575. Add a proxy service for relaying HsftpFileSystem requests.

Modified: hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JobHistory.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JobHistory.java?rev=754645&r1=754644&r2=754645&view=diff
==============================================================================
--- hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JobHistory.java (original)
+++ hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JobHistory.java Sun Mar 15 10:27:36
2009
@@ -98,6 +98,10 @@
   private static final String SECONDARY_FILE_SUFFIX = ".recover";
   private static long jobHistoryBlockSize = 0;
   private static String jobtrackerHostname;
+  final static FsPermission HISTORY_DIR_PERMISSION =
+    FsPermission.createImmutable((short) 0750); // rwxr-x---
+  final static FsPermission HISTORY_FILE_PERMISSION =
+    FsPermission.createImmutable((short) 0740); // rwxr-----
   private static JobConf jtConf;
   /**
    * Record types are identifiers for each line of log in history files. 
@@ -151,7 +155,7 @@
       Path logDir = new Path(LOG_DIR);
       FileSystem fs = logDir.getFileSystem(conf);
       if (!fs.exists(logDir)){
-        if (!fs.mkdirs(logDir)){
+        if (!fs.mkdirs(logDir, new FsPermission(HISTORY_DIR_PERMISSION))) {
           throw new IOException("Mkdirs failed to create " + logDir.toString());
         }
       }
@@ -826,7 +830,9 @@
             
             int defaultBufferSize = 
               fs.getConf().getInt("io.file.buffer.size", 4096);
-            out = fs.create(logFile, FsPermission.getDefault(), true, 
+            out = fs.create(logFile, 
+                            new FsPermission(HISTORY_FILE_PERMISSION),
+                            true, 
                             defaultBufferSize, 
                             fs.getDefaultReplication(), 
                             jobHistoryBlockSize, null);
@@ -902,8 +908,15 @@
       try {
         if (LOG_DIR != null) {
           fs = new Path(LOG_DIR).getFileSystem(jobConf);
+          int defaultBufferSize = 
+              fs.getConf().getInt("io.file.buffer.size", 4096);
           if (!fs.exists(jobFilePath)) {
-            jobFileOut = fs.create(jobFilePath);
+            jobFileOut = fs.create(jobFilePath, 
+                                   new FsPermission(HISTORY_FILE_PERMISSION),
+                                   true, 
+                                   defaultBufferSize, 
+                                   fs.getDefaultReplication(), 
+                                   fs.getDefaultBlockSize(), null);
             jobConf.writeXml(jobFileOut);
             jobFileOut.close();
           }

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestJobHistory.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestJobHistory.java?rev=754645&r1=754644&r2=754645&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestJobHistory.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestJobHistory.java Sun Mar 15 10:27:36
2009
@@ -33,6 +33,7 @@
 
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.permission.FsPermission;
 import org.apache.hadoop.mapred.JobHistory.*;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -933,7 +934,11 @@
     // Check if the history file exists
     assertTrue("History file does not exist", fileSys.exists(logFile));
 
-
+    // check history file permission
+    assertTrue("History file permissions does not match", 
+    fileSys.getFileStatus(logFile).getPermission().equals(
+       new FsPermission(JobHistory.HISTORY_FILE_PERMISSION)));
+    
     // check if the history file is parsable
     String[] jobDetails = JobHistory.JobInfo.decodeJobHistoryFileName(
     		                                   logFileName).split("_");



Mime
View raw message