HDFS-6528. Add XAttrs to TestOfflineImageViewer. Contributed by Stephen Chu.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1603020 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
45c52ef924
commit
f4b1c44415
@ -447,6 +447,8 @@ Release 2.5.0 - UNRELEASED
|
|||||||
take FSN read lock when accessing pendingCached list.
|
take FSN read lock when accessing pendingCached list.
|
||||||
(wang)
|
(wang)
|
||||||
|
|
||||||
|
HDFS-6528. Add XAttrs to TestOfflineImageViewer. (Stephen Chu via wang)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
HDFS-6214. Webhdfs has poor throughput for files >2GB (daryn)
|
HDFS-6214. Webhdfs has poor throughput for files >2GB (daryn)
|
||||||
|
@ -138,6 +138,13 @@ public class TestOfflineImageViewer {
|
|||||||
hdfs.mkdirs(new Path("/snapshot/1"));
|
hdfs.mkdirs(new Path("/snapshot/1"));
|
||||||
hdfs.delete(snapshot, true);
|
hdfs.delete(snapshot, true);
|
||||||
|
|
||||||
|
// Set XAttrs so the fsimage contains XAttr ops
|
||||||
|
final Path xattr = new Path("/xattr");
|
||||||
|
hdfs.mkdirs(xattr);
|
||||||
|
hdfs.setXAttr(xattr, "user.a1", new byte[]{ 0x31, 0x32, 0x33 });
|
||||||
|
hdfs.setXAttr(xattr, "user.a2", new byte[]{ 0x37, 0x38, 0x39 });
|
||||||
|
writtenFiles.put(xattr.toString(), hdfs.getFileStatus(xattr));
|
||||||
|
|
||||||
// Write results to the fsimage file
|
// Write results to the fsimage file
|
||||||
hdfs.setSafeMode(SafeModeAction.SAFEMODE_ENTER, false);
|
hdfs.setSafeMode(SafeModeAction.SAFEMODE_ENTER, false);
|
||||||
hdfs.saveNamespace();
|
hdfs.saveNamespace();
|
||||||
@ -210,8 +217,8 @@ public class TestOfflineImageViewer {
|
|||||||
matcher = p.matcher(output.getBuffer());
|
matcher = p.matcher(output.getBuffer());
|
||||||
assertTrue(matcher.find() && matcher.groupCount() == 1);
|
assertTrue(matcher.find() && matcher.groupCount() == 1);
|
||||||
int totalDirs = Integer.parseInt(matcher.group(1));
|
int totalDirs = Integer.parseInt(matcher.group(1));
|
||||||
// totalDirs includes root directory and empty directory
|
// totalDirs includes root directory, empty directory, and xattr directory
|
||||||
assertEquals(NUM_DIRS + 2, totalDirs);
|
assertEquals(NUM_DIRS + 3, totalDirs);
|
||||||
|
|
||||||
FileStatus maxFile = Collections.max(writtenFiles.values(),
|
FileStatus maxFile = Collections.max(writtenFiles.values(),
|
||||||
new Comparator<FileStatus>() {
|
new Comparator<FileStatus>() {
|
||||||
@ -264,7 +271,7 @@ public class TestOfflineImageViewer {
|
|||||||
|
|
||||||
// verify the number of directories
|
// verify the number of directories
|
||||||
FileStatus[] statuses = webhdfs.listStatus(new Path("/"));
|
FileStatus[] statuses = webhdfs.listStatus(new Path("/"));
|
||||||
assertEquals(NUM_DIRS + 1, statuses.length); // contains empty directory
|
assertEquals(NUM_DIRS + 2, statuses.length); // contains empty and xattr directory
|
||||||
|
|
||||||
// verify the number of files in the directory
|
// verify the number of files in the directory
|
||||||
statuses = webhdfs.listStatus(new Path("/dir0"));
|
statuses = webhdfs.listStatus(new Path("/dir0"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user