You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by om...@apache.org on 2011/03/04 05:50:01 UTC
svn commit: r1077737 -
/hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/TaskLog.java
Author: omalley
Date: Fri Mar 4 04:50:00 2011
New Revision: 1077737
URL: http://svn.apache.org/viewvc?rev=1077737&view=rev
Log:
commit e31e94e94fa8b162d4081477101539681a40f599
Author: Devaraj Das <dd...@yahoo-inc.com>
Date: Wed Oct 13 19:34:34 2010 -0700
Fixes an issue to do with TaskLog's static initializer causing NPEs when called from Streaming tasks.
+++ b/YAHOO-CHANGES.txt
+ Fixes an issue to do with TaskLog's static initializer
+ causing NPEs when called from Streaming tasks. (ddas)
+
Modified:
hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/TaskLog.java
Modified: hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/TaskLog.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/TaskLog.java?rev=1077737&r1=1077736&r2=1077737&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/TaskLog.java (original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/TaskLog.java Fri Mar 4 04:50:00 2011
@@ -74,11 +74,6 @@ public class TaskLog {
if (!LOG_DIR.exists()) {
LOG_DIR.mkdirs();
}
- try {
- localFS = FileSystem.getLocal(new Configuration());
- } catch (IOException ie) {
- throw new RuntimeException(ie);
- }
}
public static File getTaskLogFile(TaskAttemptID taskid, boolean isCleanup,
@@ -167,6 +162,9 @@ public class TaskLog {
* determined by checking the job's log directory.
*/
static String obtainLogDirOwner(TaskAttemptID taskid) throws IOException {
+ if (localFS == null) {
+ localFS = FileSystem.getLocal(new Configuration());
+ }
FileSystem raw = localFS.getRaw();
Path jobLogDir = new Path(getJobDir(taskid.getJobID()).getAbsolutePath());
FileStatus jobStat = raw.getFileStatus(jobLogDir);
@@ -237,6 +235,9 @@ public class TaskLog {
Path indexFilePath = new Path(indexFile.getAbsolutePath());
Path tmpIndexFilePath = new Path(tmpIndexFile.getAbsolutePath());
+ if (localFS == null) {// set localFS once
+ localFS = FileSystem.getLocal(new Configuration());
+ }
localFS.rename (tmpIndexFilePath, indexFilePath);
}