Revert HADOOP-9877 because of breakage reported in HADOOP-9912
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1520713 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6cfcd39165
commit
efc1048ffe
|
@ -357,8 +357,6 @@ Release 2.3.0 - UNRELEASED
|
||||||
HADOOP-9865. FileContext#globStatus has a regression with respect to
|
HADOOP-9865. FileContext#globStatus has a regression with respect to
|
||||||
relative path. (Chuan Lin via Colin Patrick McCabe)
|
relative path. (Chuan Lin via Colin Patrick McCabe)
|
||||||
|
|
||||||
HADOOP-9877. Fix listing of snapshot directories in globStatus.
|
|
||||||
(Binglin Chang via Andrew Wang)
|
|
||||||
|
|
||||||
HADOOP-9909. org.apache.hadoop.fs.Stat should permit other LANG.
|
HADOOP-9909. org.apache.hadoop.fs.Stat should permit other LANG.
|
||||||
(Shinichi Yamashita via Andrew Wang)
|
(Shinichi Yamashita via Andrew Wang)
|
||||||
|
|
|
@ -62,18 +62,6 @@ class Globber {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private FileStatus getFileLinkStatus(Path path) {
|
|
||||||
try {
|
|
||||||
if (fs != null) {
|
|
||||||
return fs.getFileLinkStatus(path);
|
|
||||||
} else {
|
|
||||||
return fc.getFileLinkStatus(path);
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private FileStatus[] listStatus(Path path) {
|
private FileStatus[] listStatus(Path path) {
|
||||||
try {
|
try {
|
||||||
if (fs != null) {
|
if (fs != null) {
|
||||||
|
@ -134,18 +122,6 @@ class Globber {
|
||||||
return authority ;
|
return authority ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The glob filter builds a regexp per path component. If the component
|
|
||||||
* does not contain a shell metachar, then it falls back to appending the
|
|
||||||
* raw string to the list of built up paths. This raw path needs to have
|
|
||||||
* the quoting removed. Ie. convert all occurrences of "\X" to "X"
|
|
||||||
* @param name of the path component
|
|
||||||
* @return the unquoted path component
|
|
||||||
*/
|
|
||||||
private static String unquotePathComponent(String name) {
|
|
||||||
return name.replaceAll("\\\\(.)", "$1");
|
|
||||||
}
|
|
||||||
|
|
||||||
public FileStatus[] glob() throws IOException {
|
public FileStatus[] glob() throws IOException {
|
||||||
// First we get the scheme and authority of the pattern that was passed
|
// First we get the scheme and authority of the pattern that was passed
|
||||||
// in.
|
// in.
|
||||||
|
@ -210,14 +186,6 @@ class Globber {
|
||||||
resolvedCandidate.isDirectory() == false) {
|
resolvedCandidate.isDirectory() == false) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// For components without pattern, we get its FileStatus directly
|
|
||||||
// using getFileLinkStatus for two reasons:
|
|
||||||
// 1. It should be faster to only get FileStatus needed rather than
|
|
||||||
// get all children.
|
|
||||||
// 2. Some special filesystem directories (e.g. HDFS snapshot
|
|
||||||
// directories) are not returned by listStatus, but do exist if
|
|
||||||
// checked explicitly via getFileLinkStatus.
|
|
||||||
if (globFilter.hasPattern()) {
|
|
||||||
FileStatus[] children = listStatus(candidate.getPath());
|
FileStatus[] children = listStatus(candidate.getPath());
|
||||||
for (FileStatus child : children) {
|
for (FileStatus child : children) {
|
||||||
// Set the child path based on the parent path.
|
// Set the child path based on the parent path.
|
||||||
|
@ -228,14 +196,6 @@ class Globber {
|
||||||
newCandidates.add(child);
|
newCandidates.add(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Path p = new Path(candidate.getPath(), unquotePathComponent(component));
|
|
||||||
FileStatus s = getFileLinkStatus(p);
|
|
||||||
if (s != null) {
|
|
||||||
s.setPath(p);
|
|
||||||
newCandidates.add(s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
candidates = newCandidates;
|
candidates = newCandidates;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,6 @@ import org.apache.hadoop.fs.Options.Rename;
|
||||||
import org.apache.hadoop.fs.permission.FsPermission;
|
import org.apache.hadoop.fs.permission.FsPermission;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Assume;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -633,20 +632,6 @@ public abstract class FileContextMainOperationsBaseTest {
|
||||||
filteredPaths));
|
filteredPaths));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Path getHiddenPathForTest() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testGlobStatusFilterWithHiddenPathTrivialFilter()
|
|
||||||
throws Exception {
|
|
||||||
Path hidden = getHiddenPathForTest();
|
|
||||||
Assume.assumeNotNull(hidden);
|
|
||||||
FileStatus[] filteredPaths = fc.util().globStatus(hidden, DEFAULT_FILTER);
|
|
||||||
Assert.assertNotNull(filteredPaths);
|
|
||||||
Assert.assertEquals(1, filteredPaths.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWriteReadAndDeleteEmptyFile() throws Exception {
|
public void testWriteReadAndDeleteEmptyFile() throws Exception {
|
||||||
writeReadAndDelete(0);
|
writeReadAndDelete(0);
|
||||||
|
|
|
@ -517,26 +517,6 @@ public class TestFsShellReturnCode {
|
||||||
}
|
}
|
||||||
return stat;
|
return stat;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public FileStatus getFileLinkStatus(Path p) throws IOException {
|
|
||||||
String f = makeQualified(p).toString();
|
|
||||||
FileStatus stat = super.getFileLinkStatus(p);
|
|
||||||
|
|
||||||
stat.getPermission();
|
|
||||||
if (owners.containsKey(f)) {
|
|
||||||
stat.setOwner("STUB-"+owners.get(f));
|
|
||||||
} else {
|
|
||||||
stat.setOwner("REAL-"+stat.getOwner());
|
|
||||||
}
|
|
||||||
if (groups.containsKey(f)) {
|
|
||||||
stat.setGroup("STUB-"+groups.get(f));
|
|
||||||
} else {
|
|
||||||
stat.setGroup("REAL-"+stat.getGroup());
|
|
||||||
}
|
|
||||||
return stat;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static class MyFsShell extends FsShell {
|
static class MyFsShell extends FsShell {
|
||||||
|
|
|
@ -59,9 +59,6 @@ public class TestHDFSFileContextMainOperations extends
|
||||||
defaultWorkingDirectory = fc.makeQualified( new Path("/user/" +
|
defaultWorkingDirectory = fc.makeQualified( new Path("/user/" +
|
||||||
UserGroupInformation.getCurrentUser().getShortUserName()));
|
UserGroupInformation.getCurrentUser().getShortUserName()));
|
||||||
fc.mkdir(defaultWorkingDirectory, FileContext.DEFAULT_PERM, true);
|
fc.mkdir(defaultWorkingDirectory, FileContext.DEFAULT_PERM, true);
|
||||||
// Make defaultWorkingDirectory snapshottable to enable
|
|
||||||
// testGlobStatusFilterWithHiddenPathTrivialFilter
|
|
||||||
cluster.getFileSystem().allowSnapshot(defaultWorkingDirectory);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void restartCluster() throws IOException, LoginException {
|
private static void restartCluster() throws IOException, LoginException {
|
||||||
|
@ -76,9 +73,6 @@ public class TestHDFSFileContextMainOperations extends
|
||||||
defaultWorkingDirectory = fc.makeQualified( new Path("/user/" +
|
defaultWorkingDirectory = fc.makeQualified( new Path("/user/" +
|
||||||
UserGroupInformation.getCurrentUser().getShortUserName()));
|
UserGroupInformation.getCurrentUser().getShortUserName()));
|
||||||
fc.mkdir(defaultWorkingDirectory, FileContext.DEFAULT_PERM, true);
|
fc.mkdir(defaultWorkingDirectory, FileContext.DEFAULT_PERM, true);
|
||||||
// Make defaultWorkingDirectory snapshottable to enable
|
|
||||||
// testGlobStatusFilterWithHiddenPathTrivialFilter
|
|
||||||
cluster.getFileSystem().allowSnapshot(defaultWorkingDirectory);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
|
@ -98,11 +92,6 @@ public class TestHDFSFileContextMainOperations extends
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Path getHiddenPathForTest() {
|
|
||||||
return new Path(defaultWorkingDirectory, ".snapshot");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Path getDefaultWorkingDirectory() {
|
protected Path getDefaultWorkingDirectory() {
|
||||||
return defaultWorkingDirectory;
|
return defaultWorkingDirectory;
|
||||||
|
|
Loading…
Reference in New Issue