Author: arp Date: Thu Sep 26 03:41:09 2013 New Revision: 1526366 URL: http://svn.apache.org/r1526366 Log: Merging r1525759 through r1526365 from trunk to branch HDFS-2832
Added: hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs-nfs/src/test/resources/ - copied from r1526365, hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs-nfs/src/test/resources/ hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs-nfs/src/test/resources/core-site.xml - copied unchanged from r1526365, hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs-nfs/src/test/resources/core-site.xml Modified: hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/ (props changed) hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/mount/RpcProgramMountd.java hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/Nfs3.java hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/OpenFileCtx.java hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/main/java/ (props changed) hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/main/native/ (props changed) hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/datanode/ (props changed) hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/ (props changed) hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/secondary/ (props changed) hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/test/hdfs/ (props changed) hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestGlobPaths.java hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDistributedFileSystem.java hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeJspHelper.java Propchange: hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/ ------------------------------------------------------------------------------ Merged /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs:r1525759-1526365 Modified: hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/mount/RpcProgramMountd.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/mount/RpcProgramMountd.java?rev=1526366&r1=1526365&r2=1526366&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/mount/RpcProgramMountd.java (original) +++ hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/mount/RpcProgramMountd.java Thu Sep 26 03:41:09 2013 @@ -76,7 +76,8 @@ public class RpcProgramMountd extends Rp public RpcProgramMountd(List<String> exports, Configuration config) throws IOException { // Note that RPC cache is not enabled - super("mountd", "localhost", PORT, PROGRAM, VERSION_1, VERSION_3, 0); + super("mountd", "localhost", config.getInt("nfs3.mountd.port", PORT), + PROGRAM, VERSION_1, VERSION_3, 0); this.hostsMatcher = NfsExports.getInstance(config); this.mounts = Collections.synchronizedList(new ArrayList<MountEntry>()); Modified: hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/Nfs3.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/Nfs3.java?rev=1526366&r1=1526365&r2=1526366&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/Nfs3.java (original) +++ hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/Nfs3.java Thu Sep 26 03:41:09 2013 @@ -42,7 +42,7 @@ public class Nfs3 extends Nfs3Base { } public Nfs3(List<String> exports, Configuration config) throws IOException { - super(new Mountd(exports, config), new RpcProgramNfs3(config)); + super(new Mountd(exports, config), new RpcProgramNfs3(config), config); } public static void main(String[] args) throws IOException { Modified: hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/OpenFileCtx.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/OpenFileCtx.java?rev=1526366&r1=1526365&r2=1526366&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/OpenFileCtx.java (original) +++ hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/OpenFileCtx.java Thu Sep 26 03:41:09 2013 @@ -199,9 +199,9 @@ class OpenFileCtx { try { synchronized (this) { // check if alive again - Preconditions.checkState(dumpFile.createNewFile(), - "The dump file should not exist: %s", dumpFilePath); - dumpOut = new FileOutputStream(dumpFile); + Preconditions.checkState(dumpFile.createNewFile(), + "The dump file should not exist: %s", dumpFilePath); + dumpOut = new FileOutputStream(dumpFile); } } catch (IOException e) { LOG.error("Got failure when creating dump stream " + dumpFilePath, e); @@ -239,6 +239,10 @@ class OpenFileCtx { && nonSequentialWriteInMemory.get() > 0) { OffsetRange key = it.next(); WriteCtx writeCtx = pendingWrites.get(key); + if (writeCtx == null) { + // This write was just deleted + continue; + } try { long dumpedDataSize = writeCtx.dumpData(dumpOut, raf); if (dumpedDataSize > 0) { @@ -262,16 +266,30 @@ class OpenFileCtx { @Override public void run() { while (activeState && enabledDump) { - if (nonSequentialWriteInMemory.get() >= DUMP_WRITE_WATER_MARK) { - dump(); - } - synchronized (OpenFileCtx.this) { - if (nonSequentialWriteInMemory.get() < DUMP_WRITE_WATER_MARK) { - try { - OpenFileCtx.this.wait(); - } catch (InterruptedException e) { + try { + if (nonSequentialWriteInMemory.get() >= DUMP_WRITE_WATER_MARK) { + dump(); + } + synchronized (OpenFileCtx.this) { + if (nonSequentialWriteInMemory.get() < DUMP_WRITE_WATER_MARK) { + try { + OpenFileCtx.this.wait(); + if (LOG.isDebugEnabled()) { + LOG.debug("Dumper woke up"); + } + } catch (InterruptedException e) { + LOG.info("Dumper is interrupted, dumpFilePath= " + + OpenFileCtx.this.dumpFilePath); + } } } + if (LOG.isDebugEnabled()) { + LOG.debug("Dumper checking OpenFileCtx activeState: " + activeState + + " enabledDump: " + enabledDump); + } + } catch (Throwable t) { + LOG.info("Dumper get Throwable: " + t + ". dumpFilePath: " + + OpenFileCtx.this.dumpFilePath); } } } Modified: hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1526366&r1=1526365&r2=1526366&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt (original) +++ hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt Thu Sep 26 03:41:09 2013 @@ -325,8 +325,26 @@ Release 2.2.0 - UNRELEASED BUG FIXES +Release 2.1.2 - UNRELEASED + + INCOMPATIBLE CHANGES + + NEW FEATURES + + IMPROVEMENTS + + OPTIMIZATIONS + + HDFS-5246. Make Hadoop nfs server port and mount daemon port + configurable. (Jinghui Wang via brandonli) + + BUG FIXES + HDFS-5139. Remove redundant -R option from setrep. + HDFS-5251. Race between the initialization of NameNode and the http + server. (Haohui Mai via suresh) + Release 2.1.1-beta - 2013-09-23 INCOMPATIBLE CHANGES @@ -494,6 +512,8 @@ Release 2.1.1-beta - 2013-09-23 HDFS-5231. Fix broken links in the document of HDFS Federation. (Haohui Mai via jing9) + HDFS-5249. Fix dumper thread which may die silently. (brandonli) + Release 2.1.0-beta - 2013-08-22 INCOMPATIBLE CHANGES @@ -947,6 +967,9 @@ Release 2.1.0-beta - 2013-08-22 HDFS-5016. Deadlock in pipeline recovery causes Datanode to be marked dead. (suresh) + HDFS-5228. The RemoteIterator returned by DistributedFileSystem.listFiles + may throw NullPointerException. (szetszwo and cnauroth via szetszwo) + BREAKDOWN OF HDFS-347 SUBTASKS AND RELATED JIRAS HDFS-4353. Encapsulate connections to peers in Peer and PeerServer classes. Propchange: hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/main/java/ ------------------------------------------------------------------------------ Merged /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java:r1525759-1526365 Modified: hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java?rev=1526366&r1=1526365&r2=1526366&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java (original) +++ hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java Thu Sep 26 03:41:09 2013 @@ -713,6 +713,7 @@ public class DistributedFileSystem exten protected RemoteIterator<LocatedFileStatus> listLocatedStatus(final Path p, final PathFilter filter) throws IOException { + final Path absF = fixRelativePart(p); return new RemoteIterator<LocatedFileStatus>() { private DirectoryListing thisListing; private int i; @@ -722,7 +723,7 @@ public class DistributedFileSystem exten { // initializer // Fully resolve symlinks in path first to avoid additional resolution // round-trips as we fetch more batches of listings - src = getPathName(resolvePath(p)); + src = getPathName(resolvePath(absF)); // fetch the first batch of entries in the directory thisListing = dfs.listPaths(src, HdfsFileStatus.EMPTY_NAME, true); statistics.incrementReadOps(1); @@ -736,7 +737,7 @@ public class DistributedFileSystem exten while (curStat == null && hasNextNoFilter()) { LocatedFileStatus next = ((HdfsLocatedFileStatus)thisListing.getPartialListing()[i++]) - .makeQualifiedLocated(getUri(), p); + .makeQualifiedLocated(getUri(), absF); if (filter.accept(next.getPath())) { curStat = next; } Modified: hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java?rev=1526366&r1=1526365&r2=1526366&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java (original) +++ hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java Thu Sep 26 03:41:09 2013 @@ -102,6 +102,10 @@ class NamenodeJspHelper { } static String getRollingUpgradeText(FSNamesystem fsn) { + if (fsn == null) { + return ""; + } + DatanodeManager dm = fsn.getBlockManager().getDatanodeManager(); Map<String, Integer> list = dm.getDatanodesSoftwareVersions(); if(list.size() > 1) { Propchange: hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/main/native/ ------------------------------------------------------------------------------ Merged /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native:r1525759-1526365 Propchange: hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/datanode/ ------------------------------------------------------------------------------ Merged /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/datanode:r1525759-1526365 Propchange: hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/ ------------------------------------------------------------------------------ Merged /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs:r1525759-1526365 Propchange: hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/secondary/ ------------------------------------------------------------------------------ Merged /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/secondary:r1525759-1526365 Propchange: hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/test/hdfs/ ------------------------------------------------------------------------------ Merged /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/hdfs:r1525759-1526365 Modified: hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestGlobPaths.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestGlobPaths.java?rev=1526366&r1=1526365&r2=1526366&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestGlobPaths.java (original) +++ hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestGlobPaths.java Thu Sep 26 03:41:09 2013 @@ -28,6 +28,7 @@ import org.apache.hadoop.conf.Configurat import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.hdfs.HdfsConfiguration; import org.apache.hadoop.hdfs.MiniDFSCluster; +import org.apache.hadoop.hdfs.server.namenode.INodeId; import org.apache.hadoop.security.AccessControlException; import org.apache.hadoop.security.UserGroupInformation; import org.junit.*; @@ -361,17 +362,6 @@ public class TestGlobPaths { status = fs.globStatus(new Path(USER_DIR+"{/dir*}")); checkStatus(status, d1, d2, d3, d4); - /* - * true filter - */ - - PathFilter trueFilter = new PathFilter() { - @Override - public boolean accept(Path path) { - return true; - } - }; - status = fs.globStatus(new Path(Path.SEPARATOR), trueFilter); checkStatus(status, new Path(Path.SEPARATOR)); @@ -843,6 +833,8 @@ public class TestGlobPaths { } } + private static final PathFilter trueFilter = new AcceptAllPathFilter(); + /** * Accept only paths ending in Z. */ @@ -893,11 +885,13 @@ public class TestGlobPaths { } } + @Ignore @Test public void testGlobWithSymlinksOnFS() throws Exception { testOnFileSystem(new TestGlobWithSymlinks()); } + @Ignore @Test public void testGlobWithSymlinksOnFC() throws Exception { testOnFileContext(new TestGlobWithSymlinks()); @@ -970,11 +964,13 @@ public class TestGlobPaths { } } + @Ignore @Test public void testGlobWithSymlinksToSymlinksOnFS() throws Exception { testOnFileSystem(new TestGlobWithSymlinksToSymlinks()); } + @Ignore @Test public void testGlobWithSymlinksToSymlinksOnFC() throws Exception { testOnFileContext(new TestGlobWithSymlinksToSymlinks()); @@ -1019,11 +1015,13 @@ public class TestGlobPaths { } } + @Ignore @Test public void testGlobSymlinksWithCustomPathFilterOnFS() throws Exception { testOnFileSystem(new TestGlobSymlinksWithCustomPathFilter()); } + @Ignore @Test public void testGlobSymlinksWithCustomPathFilterOnFC() throws Exception { testOnFileContext(new TestGlobSymlinksWithCustomPathFilter()); @@ -1044,7 +1042,7 @@ public class TestGlobPaths { new Path(USER_DIR + "/alphaLink"), new AcceptAllPathFilter()); Assert.assertEquals(1, statuses.length); Path path = statuses[0].getPath(); - Assert.assertEquals(USER_DIR + "/alphaLink", path.toUri().getPath()); + Assert.assertEquals(USER_DIR + "/alpha", path.toUri().getPath()); Assert.assertEquals("hdfs", path.toUri().getScheme()); if (fc != null) { // If we're using FileContext, then we can list a file:/// URI. @@ -1150,4 +1148,31 @@ public class TestGlobPaths { public void testGlobAccessDeniedOnFC() throws Exception { testOnFileContext(new TestGlobAccessDenied()); } + + /** + * Test that trying to list a reserved path on HDFS via the globber works. + **/ + private static class TestReservedHdfsPaths implements FSTestWrapperGlobTest { + public void run(FSTestWrapper wrap, FSTestWrapper unprivilegedWrap, + FileSystem fs, FileContext fc) throws Exception { + String reservedRoot = "/.reserved/.inodes/" + INodeId.ROOT_INODE_ID; + Assert.assertEquals(reservedRoot, + TestPath.mergeStatuses(unprivilegedWrap. + globStatus(new Path(reservedRoot), new AcceptAllPathFilter()))); + // These inodes don't show up via listStatus. + Assert.assertEquals("", + TestPath.mergeStatuses(unprivilegedWrap. + globStatus(new Path("/.reserved/*"), new AcceptAllPathFilter()))); + } + } + + @Test + public void testReservedHdfsPathsOnFS() throws Exception { + testOnFileSystem(new TestReservedHdfsPaths()); + } + + @Test + public void testReservedHdfsPathsOnFC() throws Exception { + testOnFileContext(new TestReservedHdfsPaths()); + } } Modified: hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDistributedFileSystem.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDistributedFileSystem.java?rev=1526366&r1=1526365&r2=1526366&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDistributedFileSystem.java (original) +++ hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDistributedFileSystem.java Thu Sep 26 03:41:09 2013 @@ -31,8 +31,10 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.net.URI; import java.security.PrivilegedExceptionAction; +import java.util.ArrayList; import java.util.Arrays; import java.util.EnumSet; +import java.util.List; import java.util.Random; import org.apache.commons.lang.ArrayUtils; @@ -47,9 +49,11 @@ import org.apache.hadoop.fs.FSDataOutput import org.apache.hadoop.fs.FileChecksum; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.fs.LocatedFileStatus; import org.apache.hadoop.fs.MD5MD5CRC32FileChecksum; import org.apache.hadoop.fs.Options.ChecksumOpt; import org.apache.hadoop.fs.Path; +import org.apache.hadoop.fs.RemoteIterator; import org.apache.hadoop.fs.VolumeId; import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.hdfs.web.WebHdfsFileSystem; @@ -226,7 +230,7 @@ public class TestDistributedFileSystem { final long millis = Time.now(); { - DistributedFileSystem dfs = (DistributedFileSystem)cluster.getFileSystem(); + final DistributedFileSystem dfs = cluster.getFileSystem(); dfs.dfs.getLeaseRenewer().setGraceSleepPeriod(grace); assertFalse(dfs.dfs.getLeaseRenewer().isRunning()); @@ -326,7 +330,7 @@ public class TestDistributedFileSystem { } { - DistributedFileSystem dfs = (DistributedFileSystem)cluster.getFileSystem(); + final DistributedFileSystem dfs = cluster.getFileSystem(); assertFalse(dfs.dfs.getLeaseRenewer().isRunning()); //open and check the file @@ -835,4 +839,25 @@ public class TestDistributedFileSystem { } } + @Test(timeout=60000) + public void testListFiles() throws IOException { + Configuration conf = new HdfsConfiguration(); + MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).build(); + + try { + DistributedFileSystem fs = cluster.getFileSystem(); + + final Path relative = new Path("relative"); + fs.create(new Path(relative, "foo")).close(); + + final List<LocatedFileStatus> retVal = new ArrayList<LocatedFileStatus>(); + final RemoteIterator<LocatedFileStatus> iter = fs.listFiles(relative, true); + while (iter.hasNext()) { + retVal.add(iter.next()); + } + System.out.println("retVal = " + retVal); + } finally { + cluster.shutdown(); + } + } } Modified: hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeJspHelper.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeJspHelper.java?rev=1526366&r1=1526365&r2=1526366&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeJspHelper.java (original) +++ hadoop/common/branches/HDFS-2832/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeJspHelper.java Thu Sep 26 03:41:09 2013 @@ -18,8 +18,13 @@ package org.apache.hadoop.hdfs.server.namenode; -import static org.apache.hadoop.hdfs.server.namenode.startupprogress.Phase.*; -import static org.mockito.Mockito.*; +import static org.apache.hadoop.hdfs.server.namenode.startupprogress.Phase.LOADING_EDITS; +import static org.apache.hadoop.hdfs.server.namenode.startupprogress.Phase.LOADING_FSIMAGE; +import static org.apache.hadoop.hdfs.server.namenode.startupprogress.Phase.SAFEMODE; +import static org.apache.hadoop.hdfs.server.namenode.startupprogress.Phase.SAVING_CHECKPOINT; +import static org.mockito.Mockito.atLeastOnce; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; import java.io.IOException; import java.util.List; @@ -107,6 +112,11 @@ public class TestNameNodeJspHelper { Assert.assertTrue(containsMatch(contents, SAFEMODE.getDescription())); } + @Test + public void testGetRollingUpgradeText() { + Assert.assertEquals("", NamenodeJspHelper.getRollingUpgradeText(null)); + } + /** * Checks if the list contains any string that partially matches the regex. *