[ 
https://issues.apache.org/jira/browse/HADOOP-7682?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13648585#comment-13648585
 ] 

Matt Giroux commented on HADOOP-7682:
-------------------------------------

I'm using 1.0.4...

This issue is coming from the org.apache.hadoop.fs.FileUtil class.  There is a 
static setPermission method that uses the standard java.io.File setPermission 
method which will always fail on Windows.  The quickest and least destructive 
way to resolve this is just create three new classes:

org.apache.hadoop.fs.Win32LocalFileSystem
org.apache.hadoop.fs.Win32RawLocalFileSystem
org.apache.hadoop.fs.Win32FileUtil

They obviously extend the classes of the same name without the "Win32".  Here 
is the code for each:

<begin Win32FileUtil>

package org.apache.hadoop.fs;

import java.io.File;
import java.io.IOException;
import org.apache.hadoop.fs.permission.FsPermission;

/**
 * A collection of file-processing util methods
 */
public class Win32FileUtil extends FileUtil {

        
        /* override setPermission */
        public static void setPermission(File f, FsPermission permission
                                   ) throws IOException {
                /* assume can't set permissions on win32 */
                /* do nothing */
        }
}

<end Win32FileUtil>

<begin Win32RawLocalFileSystem>

package org.apache.hadoop.fs;

import java.io.IOException;
import org.apache.hadoop.fs.permission.FsPermission;

/****************************************************************
 * Implement the FileSystem API for the raw local filesystem.
 *
 *****************************************************************/
public class Win32RawLocalFileSystem extends RawLocalFileSystem {
  
  public Win32RawLocalFileSystem() {
    super();
  }
   
  @Override
  public void setPermission(Path p, FsPermission permission
                            ) throws IOException {
    Win32FileUtil.setPermission(pathToFile(p), permission);
  }
}

<end Win32RawLocalFileSystem>


<begin Win32LocalFileSystem>

package org.apache.hadoop.fs;


/****************************************************************
 * Implement the FileSystem API for the checksumed local filesystem.
 *
 *****************************************************************/
public class Win32LocalFileSystem extends LocalFileSystem {

        public Win32LocalFileSystem() {
                this(new Win32RawLocalFileSystem());
        }
        
        public Win32LocalFileSystem(FileSystem rawLocalFileSystem) {
                super(rawLocalFileSystem);
                rfs = rawLocalFileSystem;
        }

        
}

<end Win32LocalFileSystem>


For a quickest compile, just manually compile and add these classes into the 
hadoop-core-1.0.4.jar (with this jar on the classpath) in the same order as 
above (backup your jar file first to be safe).  Then edit the core-site.xml 
configuration file with the following entry:

<property>
    <name>fs.file.impl</name>
    <value>org.apache.hadoop.fs.Win32LocalFileSystem</value>
</property>

All done - should work now.
                
> taskTracker could not start because "Failed to set permissions" to "ttprivate 
> to 0700"
> --------------------------------------------------------------------------------------
>
>                 Key: HADOOP-7682
>                 URL: https://issues.apache.org/jira/browse/HADOOP-7682
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: fs
>    Affects Versions: 1.0.1
>         Environment: OS:WindowsXP SP3 , Filesystem :NTFS, cygwin 1.7.9-1, 
> jdk1.6.0_05
>            Reporter: Magic Xie
>
> ERROR org.apache.hadoop.mapred.TaskTracker:Can not start task tracker because 
> java.io.IOException:Failed to set permissions of 
> path:/tmp/hadoop-cyg_server/mapred/local/ttprivate to 0700
>     at 
> org.apache.hadoop.fs.RawLocalFileSystem.checkReturnValue(RawLocalFileSystem.java:525)
>     at 
> org.apache.hadoop.fs.RawLocalFileSystem.setPermission(RawLocalFileSystem.java:499)
>     at 
> org.apache.hadoop.fs.RawLocalFileSystem.mkdirs(RawLocalFileSystem.java:318)
>     at org.apache.hadoop.fs.FilterFileSystem.mkdirs(FilterFileSystem.java:183)
>     at org.apache.hadoop.mapred.TaskTracker.initialize(TaskTracker.java:635)
>     at org.apache.hadoop.mapred.TaskTracker.(TaskTracker.java:1328)
>     at org.apache.hadoop.mapred.TaskTracker.main(TaskTracker.java:3430)
> Since hadoop0.20.203 when the TaskTracker initialize, it checks the 
> permission(TaskTracker Line 624) of 
> (org.apache.hadoop.mapred.TaskTracker.TT_LOG_TMP_DIR,org.apache.hadoop.mapred.TaskTracker.TT_PRIVATE_DIR,
>  
> org.apache.hadoop.mapred.TaskTracker.TT_PRIVATE_DIR).RawLocalFileSystem(http://svn.apache.org/viewvc/hadoop/common/tags/release-0.20.203.0/src/core/org/apache/hadoop/fs/RawLocalFileSystem.java?view=markup)
>  call setPermission(Line 481) to deal with it, setPermission works fine on 
> *nx, however,it dose not alway works on windows.
> setPermission call setReadable of Java.io.File in the line 498, but according 
> to the Table1 below provided by oracle,setReadable(false) will always return 
> false on windows, the same as setExecutable(false).
> http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/enhancements/
> is it cause the task tracker "Failed to set permissions" to "ttprivate to 
> 0700"?
> Hadoop 0.20.202 works fine in the same environment. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to