Esempio n. 1
0
            /// <returns>whether the migration requires next round</returns>
            private bool ProcessRecursively(string parent, HdfsFileStatus status)
            {
                string fullPath     = status.GetFullName(parent);
                bool   hasRemaining = false;

                if (status.IsDir())
                {
                    if (!fullPath.EndsWith(Path.Separator))
                    {
                        fullPath = fullPath + Path.Separator;
                    }
                    hasRemaining = this.ProcessPath(fullPath);
                    // process snapshots if this is a snapshottable directory
                    if (this.snapshottableDirs.Contains(fullPath))
                    {
                        string dirSnapshot = fullPath + HdfsConstants.DotSnapshotDir;
                        hasRemaining |= this.ProcessPath(dirSnapshot);
                    }
                }
                else
                {
                    if (!status.IsSymlink())
                    {
                        // file
                        try
                        {
                            if (!this.IsSnapshotPathInCurrent(fullPath))
                            {
                                // the full path is a snapshot path but it is also included in the
                                // current directory tree, thus ignore it.
                                hasRemaining = this.ProcessFile(fullPath, (HdfsLocatedFileStatus)status);
                            }
                        }
                        catch (IOException e)
                        {
                            Org.Apache.Hadoop.Hdfs.Server.Mover.Mover.Log.Warn("Failed to check the status of "
                                                                               + parent + ". Ignore it and continue.", e);
                            return(false);
                        }
                    }
                }
                return(hasRemaining);
            }
Esempio n. 2
0
 internal static FileStatus ToFileStatus(HdfsFileStatus f, string parent)
 {
     return(new FileStatus(f.GetLen(), f.IsDir(), f.GetReplication(), f.GetBlockSize()
                           , f.GetModificationTime(), f.GetAccessTime(), f.GetPermission(), f.GetOwner(), f
                           .GetGroup(), f.IsSymlink() ? new Path(f.GetSymlink()) : null, new Path(f.GetFullName
                                                                                                      (parent))));
 }