HADOOP-10425. LocalFileSystem.getContentSummary should not count crc files.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1581183 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Tsz-wo Sze 2014-03-25 02:03:07 +00:00
parent 6015e95941
commit 9db6f98e0b
4 changed files with 18 additions and 9 deletions

View File

@ -444,6 +444,9 @@ Release 2.4.0 - UNRELEASED
HADOOP-10422. Remove redundant logging of RPC retry attempts. (cnauroth)
HADOOP-10425. LocalFileSystem.getContentSummary should not count crc files.
(szetszwo)
BREAKDOWN OF HADOOP-10184 SUBTASKS AND RELATED JIRAS
HADOOP-10185. FileSystem API for ACLs. (cnauroth)

View File

@ -374,11 +374,6 @@ public class FilterFileSystem extends FileSystem {
}
// path variants delegate to underlying filesystem
@Override
public ContentSummary getContentSummary(Path f) throws IOException {
return fs.getContentSummary(f);
}
@Override
public long getDefaultBlockSize(Path f) {
return fs.getDefaultBlockSize(f);

View File

@ -320,7 +320,7 @@ class ChRootedFileSystem extends FilterFileSystem {
@Override
public ContentSummary getContentSummary(Path f) throws IOException {
return super.getContentSummary(fullPath(f));
return fs.getContentSummary(fullPath(f));
}

View File

@ -34,6 +34,7 @@ import static org.junit.Assert.*;
import static org.junit.Assume.assumeTrue;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@ -204,12 +205,22 @@ public class TestLocalFileSystem {
}
@Test(timeout = 1000)
public void testMkdirs() throws IOException {
public void testCreateFileAndMkdirs() throws IOException {
Path test_dir = new Path(TEST_ROOT_DIR, "test_dir");
Path test_file = new Path(TEST_ROOT_DIR, "file1");
Path test_file = new Path(test_dir, "file1");
assertTrue(fileSys.mkdirs(test_dir));
writeFile(fileSys, test_file, 1);
final int fileSize = new Random().nextInt(1 << 20) + 1;
writeFile(fileSys, test_file, fileSize);
{
//check FileStatus and ContentSummary
final FileStatus status = fileSys.getFileStatus(test_file);
Assert.assertEquals(fileSize, status.getLen());
final ContentSummary summary = fileSys.getContentSummary(test_dir);
Assert.assertEquals(fileSize, summary.getLength());
}
// creating dir over a file
Path bad_dir = new Path(test_file, "another_dir");