svn merge -c 1581183 from trunk for HADOOP-10425. LocalFileSystem.getContentSummary should not count crc files.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1581186 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Tsz-wo Sze 2014-03-25 02:05:03 +00:00
parent e51fbb6a9e
commit 70a254314a
4 changed files with 18 additions and 9 deletions

View File

@ -141,6 +141,9 @@ Release 2.4.0 - UNRELEASED
HADOOP-10422. Remove redundant logging of RPC retry attempts. (cnauroth) 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 BREAKDOWN OF HADOOP-10184 SUBTASKS AND RELATED JIRAS
HADOOP-10185. FileSystem API for ACLs. (cnauroth) HADOOP-10185. FileSystem API for ACLs. (cnauroth)

View File

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

View File

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

View File

@ -33,6 +33,7 @@ import static org.junit.Assert.*;
import static org.junit.Assume.assumeTrue; import static org.junit.Assume.assumeTrue;
import org.junit.After; import org.junit.After;
import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -203,12 +204,22 @@ public class TestLocalFileSystem {
} }
@Test(timeout = 1000) @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_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)); 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 // creating dir over a file
Path bad_dir = new Path(test_file, "another_dir"); Path bad_dir = new Path(test_file, "another_dir");