Author: szetszwo Date: Tue Nov 27 23:02:00 2012 New Revision: 1414456 URL: http://svn.apache.org/viewvc?rev=1414456&view=rev Log: Merge r1412283 through r1414454 from trunk.
Added: hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/PathAccessDeniedException.java - copied unchanged from r1414454, hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/PathAccessDeniedException.java hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/PathExistsException.java - copied unchanged from r1414454, hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/PathExistsException.java hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/PathIOException.java - copied unchanged from r1414454, hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/PathIOException.java hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/PathIsDirectoryException.java - copied unchanged from r1414454, hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/PathIsDirectoryException.java hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/PathIsNotDirectoryException.java - copied unchanged from r1414454, hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/PathIsNotDirectoryException.java hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/PathIsNotEmptyDirectoryException.java - copied unchanged from r1414454, hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/PathIsNotEmptyDirectoryException.java hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/PathNotFoundException.java - copied unchanged from r1414454, hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/PathNotFoundException.java hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/PathOperationException.java - copied unchanged from r1414454, hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/PathOperationException.java hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/PathPermissionException.java - copied unchanged from r1414454, hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/PathPermissionException.java hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestHarFileSystemBasics.java - copied unchanged from r1414454, hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestHarFileSystemBasics.java Removed: hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/PathExceptions.java Modified: hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/CHANGES.txt (contents, props changed) hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/dev-support/findbugsExcludeFile.xml hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/docs/ (props changed) hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/ (props changed) hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/DelegationTokenRenewer.java hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HarFileSystem.java hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/LocalDirAllocator.java hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Command.java hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/CommandWithDestination.java hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/CopyCommands.java hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Delete.java hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Display.java hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Mkdir.java hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/MoveCommands.java hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/PathData.java hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/SetReplication.java hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/SnapshotCommands.java hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Tail.java hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Test.java hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Touchz.java hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/test/core/ (props changed) hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestDelegationTokenRenewer.java hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalDirAllocator.java hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestPathExceptions.java Modified: hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/CHANGES.txt?rev=1414456&r1=1414455&r2=1414456&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/CHANGES.txt (original) +++ hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/CHANGES.txt Tue Nov 27 23:02:00 2012 @@ -138,6 +138,9 @@ Trunk (Unreleased) HADOOP-9075. FileContext#FSLinkResolver should be made static. (Arpit Agarwal via suresh) + HADOOP-9093. Move all the Exception in PathExceptions to o.a.h.fs package. + (suresh) + BUG FIXES HADOOP-8177. MBeans shouldn't try to register when it fails to create MBeanName. @@ -447,6 +450,9 @@ Release 2.0.3-alpha - Unreleased HADOOP-9049. DelegationTokenRenewer needs to be Singleton and FileSystems should register/deregister to/from. (Karthik Kambatla via tomwhite) + HADOOP-9064. Augment DelegationTokenRenewer API to cancel the tokens on + calls to removeRenewAction. (kkambatl via tucu) + Release 2.0.2-alpha - 2012-09-07 INCOMPATIBLE CHANGES @@ -1152,6 +1158,12 @@ Release 0.23.6 - UNRELEASED HADOOP-9072. Hadoop-Common-0.23-Build Fails to build in Jenkins (Robert Parker via tgraves) + HADOOP-8992. Enhance unit-test coverage of class HarFileSystem (Ivan A. + Veselovsky via bobby) + + HADOOP-9038. unit-tests for AllocatorPerContext.PathIterator (Ivan A. + Veselovsky via bobby) + Release 0.23.5 - UNRELEASED INCOMPATIBLE CHANGES Propchange: hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/CHANGES.txt ------------------------------------------------------------------------------ Merged /hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt:r1412283-1414454 Modified: hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/dev-support/findbugsExcludeFile.xml URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/dev-support/findbugsExcludeFile.xml?rev=1414456&r1=1414455&r2=1414456&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/dev-support/findbugsExcludeFile.xml (original) +++ hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/dev-support/findbugsExcludeFile.xml Tue Nov 27 23:02:00 2012 @@ -291,5 +291,13 @@ <Field name="previousSnapshot" /> <Bug pattern="IS2_INCONSISTENT_SYNC" /> </Match> - + <!-- + The method uses a generic type T that extends two other types + T1 and T2. Findbugs complains of a cast from T1 to T2. + --> + <Match> + <Class name="org.apache.hadoop.fs.DelegationTokenRenewer" /> + <Method name="removeRenewAction" /> + <Bug pattern="BC_UNCONFIRMED_CAST" /> + </Match> </FindBugsFilter> Propchange: hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/docs/ ------------------------------------------------------------------------------ Merged /hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/docs:r1412283-1414454 Propchange: hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/ ------------------------------------------------------------------------------ Merged /hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java:r1412283-1414454 Modified: hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/DelegationTokenRenewer.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/DelegationTokenRenewer.java?rev=1414456&r1=1414455&r2=1414456&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/DelegationTokenRenewer.java (original) +++ hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/DelegationTokenRenewer.java Tue Nov 27 23:02:00 2012 @@ -24,6 +24,8 @@ import java.util.concurrent.DelayQueue; import java.util.concurrent.Delayed; import java.util.concurrent.TimeUnit; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.security.token.Token; import org.apache.hadoop.security.token.TokenIdentifier; @@ -35,6 +37,9 @@ import org.apache.hadoop.util.Time; @InterfaceAudience.Private public class DelegationTokenRenewer extends Thread { + private static final Log LOG = LogFactory + .getLog(DelegationTokenRenewer.class); + /** The renewable interface used by the renewer. */ public interface Renewable { /** @return the renew token. */ @@ -168,11 +173,24 @@ public class DelegationTokenRenewer } } - /** Remove the associated renew action from the queue */ + /** + * Remove the associated renew action from the queue + * + * @throws IOException + */ public synchronized <T extends FileSystem & Renewable> void removeRenewAction( - final T fs) { + final T fs) throws IOException { for (RenewAction<?> action : queue) { if (action.weakFs.get() == fs) { + try { + fs.getRenewToken().cancel(fs.getConf()); + } catch (InterruptedException ie) { + LOG.error("Interrupted while canceling token for " + fs.getUri() + + "filesystem"); + if (LOG.isDebugEnabled()) { + LOG.debug(ie.getStackTrace()); + } + } queue.remove(action); return; } Modified: hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HarFileSystem.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HarFileSystem.java?rev=1414456&r1=1414455&r2=1414456&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HarFileSystem.java (original) +++ hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HarFileSystem.java Tue Nov 27 23:02:00 2012 @@ -584,13 +584,6 @@ public class HarFileSystem extends Filte public String getName() { return name; } - - public List<String> getChildren() { - return children; - } - public String getFileName() { - return name; - } public String getPartName() { return partName; } @@ -662,15 +655,6 @@ public class HarFileSystem extends Filte hstatus.getStartIndex(), hstatus.getLength(), bufferSize); } - /* - * create throws an exception in Har filesystem. - * The archive once created cannot be changed. - */ - public FSDataOutputStream create(Path f, int bufferSize) - throws IOException { - throw new IOException("Har: Create not allowed"); - } - @Override public FSDataOutputStream create(Path f, FsPermission permission, @@ -1106,4 +1090,11 @@ public class HarFileSystem extends Filte } } } + + /* + * testing purposes only: + */ + HarMetaData getMetadata() { + return metadata; + } } Modified: hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/LocalDirAllocator.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/LocalDirAllocator.java?rev=1414456&r1=1414455&r2=1414456&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/LocalDirAllocator.java (original) +++ hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/LocalDirAllocator.java Tue Nov 27 23:02:00 2012 @@ -481,12 +481,15 @@ public class LocalDirAllocator { @Override public Path next() { - Path result = next; + final Path result = next; try { advance(); } catch (IOException ie) { throw new RuntimeException("Can't check existance of " + next, ie); } + if (result == null) { + throw new NoSuchElementException(); + } return result; } Modified: hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Command.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Command.java?rev=1414456&r1=1414455&r2=1414456&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Command.java (original) +++ hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Command.java Tue Nov 27 23:02:00 2012 @@ -34,7 +34,7 @@ import org.apache.hadoop.classification. import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; import org.apache.hadoop.fs.Path; -import org.apache.hadoop.fs.shell.PathExceptions.PathNotFoundException; +import org.apache.hadoop.fs.PathNotFoundException; import org.apache.hadoop.util.StringUtils; /** Modified: hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/CommandWithDestination.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/CommandWithDestination.java?rev=1414456&r1=1414455&r2=1414456&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/CommandWithDestination.java (original) +++ hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/CommandWithDestination.java Tue Nov 27 23:02:00 2012 @@ -27,12 +27,12 @@ import org.apache.hadoop.fs.FSDataOutput import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.FilterFileSystem; import org.apache.hadoop.fs.Path; -import org.apache.hadoop.fs.shell.PathExceptions.PathExistsException; -import org.apache.hadoop.fs.shell.PathExceptions.PathIOException; -import org.apache.hadoop.fs.shell.PathExceptions.PathIsDirectoryException; -import org.apache.hadoop.fs.shell.PathExceptions.PathIsNotDirectoryException; -import org.apache.hadoop.fs.shell.PathExceptions.PathNotFoundException; -import org.apache.hadoop.fs.shell.PathExceptions.PathOperationException; +import org.apache.hadoop.fs.PathExistsException; +import org.apache.hadoop.fs.PathIOException; +import org.apache.hadoop.fs.PathIsDirectoryException; +import org.apache.hadoop.fs.PathIsNotDirectoryException; +import org.apache.hadoop.fs.PathNotFoundException; +import org.apache.hadoop.fs.PathOperationException; import org.apache.hadoop.io.IOUtils; /** Modified: hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/CopyCommands.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/CopyCommands.java?rev=1414456&r1=1414455&r2=1414456&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/CopyCommands.java (original) +++ hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/CopyCommands.java Tue Nov 27 23:02:00 2012 @@ -27,7 +27,7 @@ import org.apache.hadoop.classification. import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FSDataOutputStream; -import org.apache.hadoop.fs.shell.PathExceptions.PathIsDirectoryException; +import org.apache.hadoop.fs.PathIsDirectoryException; import org.apache.hadoop.io.IOUtils; /** Various commands for copy files */ Modified: hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Delete.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Delete.java?rev=1414456&r1=1414455&r2=1414456&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Delete.java (original) +++ hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Delete.java Tue Nov 27 23:02:00 2012 @@ -24,11 +24,11 @@ import java.util.LinkedList; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; +import org.apache.hadoop.fs.PathIOException; +import org.apache.hadoop.fs.PathIsDirectoryException; +import org.apache.hadoop.fs.PathIsNotDirectoryException; +import org.apache.hadoop.fs.PathIsNotEmptyDirectoryException; import org.apache.hadoop.fs.Trash; -import org.apache.hadoop.fs.shell.PathExceptions.PathIOException; -import org.apache.hadoop.fs.shell.PathExceptions.PathIsDirectoryException; -import org.apache.hadoop.fs.shell.PathExceptions.PathIsNotDirectoryException; -import org.apache.hadoop.fs.shell.PathExceptions.PathIsNotEmptyDirectoryException; /** * Classes that delete paths Modified: hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Display.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Display.java?rev=1414456&r1=1414455&r2=1414456&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Display.java (original) +++ hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Display.java Tue Nov 27 23:02:00 2012 @@ -38,7 +38,7 @@ import org.apache.hadoop.conf.Configurat import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.Path; -import org.apache.hadoop.fs.shell.PathExceptions.PathIsDirectoryException; +import org.apache.hadoop.fs.PathIsDirectoryException; import org.apache.hadoop.io.DataInputBuffer; import org.apache.hadoop.io.DataOutputBuffer; import org.apache.hadoop.io.IOUtils; Modified: hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Mkdir.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Mkdir.java?rev=1414456&r1=1414455&r2=1414456&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Mkdir.java (original) +++ hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Mkdir.java Tue Nov 27 23:02:00 2012 @@ -24,10 +24,10 @@ import java.util.LinkedList; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.fs.Path; -import org.apache.hadoop.fs.shell.PathExceptions.PathExistsException; -import org.apache.hadoop.fs.shell.PathExceptions.PathIOException; -import org.apache.hadoop.fs.shell.PathExceptions.PathIsNotDirectoryException; -import org.apache.hadoop.fs.shell.PathExceptions.PathNotFoundException; +import org.apache.hadoop.fs.PathExistsException; +import org.apache.hadoop.fs.PathIOException; +import org.apache.hadoop.fs.PathIsNotDirectoryException; +import org.apache.hadoop.fs.PathNotFoundException; /** * Create the given dir Modified: hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/MoveCommands.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/MoveCommands.java?rev=1414456&r1=1414455&r2=1414456&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/MoveCommands.java (original) +++ hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/MoveCommands.java Tue Nov 27 23:02:00 2012 @@ -23,8 +23,8 @@ import java.util.LinkedList; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; +import org.apache.hadoop.fs.PathIOException; import org.apache.hadoop.fs.shell.CopyCommands.CopyFromLocal; -import org.apache.hadoop.fs.shell.PathExceptions.PathIOException; /** Various commands for moving files */ @InterfaceAudience.Private Modified: hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/PathData.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/PathData.java?rev=1414456&r1=1414455&r2=1414456&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/PathData.java (original) +++ hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/PathData.java Tue Nov 27 23:02:00 2012 @@ -32,10 +32,10 @@ import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.LocalFileSystem; import org.apache.hadoop.fs.Path; -import org.apache.hadoop.fs.shell.PathExceptions.PathIOException; -import org.apache.hadoop.fs.shell.PathExceptions.PathIsDirectoryException; -import org.apache.hadoop.fs.shell.PathExceptions.PathIsNotDirectoryException; -import org.apache.hadoop.fs.shell.PathExceptions.PathNotFoundException; +import org.apache.hadoop.fs.PathIOException; +import org.apache.hadoop.fs.PathIsDirectoryException; +import org.apache.hadoop.fs.PathIsNotDirectoryException; +import org.apache.hadoop.fs.PathNotFoundException; /** * Encapsulates a Path (path), its FileStatus (stat), and its FileSystem (fs). Modified: hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/SetReplication.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/SetReplication.java?rev=1414456&r1=1414455&r2=1414456&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/SetReplication.java (original) +++ hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/SetReplication.java Tue Nov 27 23:02:00 2012 @@ -25,7 +25,7 @@ import java.util.List; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.fs.BlockLocation; -import org.apache.hadoop.fs.shell.PathExceptions.PathIOException; +import org.apache.hadoop.fs.PathIOException; /** * Modifies the replication factor Modified: hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/SnapshotCommands.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/SnapshotCommands.java?rev=1414456&r1=1414455&r2=1414456&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/SnapshotCommands.java (original) +++ hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/SnapshotCommands.java Tue Nov 27 23:02:00 2012 @@ -23,7 +23,7 @@ import java.util.LinkedList; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; -import org.apache.hadoop.fs.shell.PathExceptions.PathIsNotDirectoryException; +import org.apache.hadoop.fs.PathIsNotDirectoryException; /** * Snapshot related operations Modified: hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Tail.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Tail.java?rev=1414456&r1=1414455&r2=1414456&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Tail.java (original) +++ hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Tail.java Tue Nov 27 23:02:00 2012 @@ -25,7 +25,7 @@ import java.util.List; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.fs.FSDataInputStream; -import org.apache.hadoop.fs.shell.PathExceptions.PathIsDirectoryException; +import org.apache.hadoop.fs.PathIsDirectoryException; import org.apache.hadoop.io.IOUtils; /** Modified: hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Test.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Test.java?rev=1414456&r1=1414455&r2=1414456&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Test.java (original) +++ hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Test.java Tue Nov 27 23:02:00 2012 @@ -23,7 +23,6 @@ import java.util.LinkedList; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; -import org.apache.hadoop.fs.shell.PathExceptions.PathNotFoundException; /** * Perform shell-like file tests Modified: hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Touchz.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Touchz.java?rev=1414456&r1=1414455&r2=1414456&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Touchz.java (original) +++ hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Touchz.java Tue Nov 27 23:02:00 2012 @@ -23,9 +23,9 @@ import java.util.LinkedList; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; -import org.apache.hadoop.fs.shell.PathExceptions.PathIOException; -import org.apache.hadoop.fs.shell.PathExceptions.PathIsDirectoryException; -import org.apache.hadoop.fs.shell.PathExceptions.PathNotFoundException; +import org.apache.hadoop.fs.PathIOException; +import org.apache.hadoop.fs.PathIsDirectoryException; +import org.apache.hadoop.fs.PathNotFoundException; /** * Unix touch like commands Propchange: hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/test/core/ ------------------------------------------------------------------------------ Merged /hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/core:r1412283-1414454 Modified: hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestDelegationTokenRenewer.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestDelegationTokenRenewer.java?rev=1414456&r1=1414455&r2=1414456&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestDelegationTokenRenewer.java (original) +++ hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestDelegationTokenRenewer.java Tue Nov 27 23:02:00 2012 @@ -23,6 +23,7 @@ public class TestDelegationTokenRenewer @SuppressWarnings("rawtypes") static class TestToken extends Token { public volatile int renewCount = 0; + public volatile boolean cancelled = false; @Override public long renew(Configuration conf) { @@ -33,6 +34,11 @@ public class TestDelegationTokenRenewer } return renewCount; } + + @Override + public void cancel(Configuration conf) { + cancelled = true; + } } static class TestFileSystem extends FileSystem implements @@ -123,27 +129,12 @@ public class TestDelegationTokenRenewer } @Test - public void testAddRenewAction() throws IOException, InterruptedException { - TestFileSystem tfs = new TestFileSystem(); - renewer.addRenewAction(tfs); - - for (int i = 0; i < 10; i++) { - Thread.sleep(RENEW_CYCLE); - if (tfs.testToken.renewCount > 0) { - return; - } - } - - assertTrue("Token not renewed even after 10 seconds", - (tfs.testToken.renewCount > 0)); - } - - @Test - public void testRemoveRenewAction() throws IOException, InterruptedException { + public void testAddRemoveRenewAction() throws IOException, + InterruptedException { TestFileSystem tfs = new TestFileSystem(); renewer.addRenewAction(tfs); - for (int i = 0; i < 10; i++) { + for (int i = 0; i < 60; i++) { Thread.sleep(RENEW_CYCLE); if (tfs.testToken.renewCount > 0) { renewer.removeRenewAction(tfs); @@ -151,9 +142,9 @@ public class TestDelegationTokenRenewer } } - assertTrue("Token not renewed even once", + assertTrue("Token not renewed even after 1 minute", (tfs.testToken.renewCount > 0)); - assertTrue("Token not removed", - (tfs.testToken.renewCount < MAX_RENEWALS)); + assertTrue("Token not removed", (tfs.testToken.renewCount < MAX_RENEWALS)); + assertTrue("Token not cancelled", tfs.testToken.cancelled); } } Modified: hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalDirAllocator.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalDirAllocator.java?rev=1414456&r1=1414455&r2=1414456&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalDirAllocator.java (original) +++ hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalDirAllocator.java Tue Nov 27 23:02:00 2012 @@ -22,6 +22,8 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.util.Arrays; import java.util.Collection; +import java.util.Iterator; +import java.util.NoSuchElementException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.util.Shell; @@ -32,6 +34,7 @@ import org.junit.runners.Parameterized.P import org.junit.Test; import static org.junit.Assert.*; +import static org.junit.Assume.*; /** This test LocalDirAllocator works correctly; * Every test case uses different buffer dirs to @@ -318,7 +321,7 @@ public class TestLocalDirAllocator { */ @Test public void testNoSideEffects() throws IOException { - if (isWindows) return; + assumeTrue(!isWindows); String dir = buildBufferDir(ROOT, 0); try { conf.set(CONTEXT, dir); @@ -339,8 +342,7 @@ public class TestLocalDirAllocator { */ @Test public void testGetLocalPathToRead() throws IOException { - if (isWindows) - return; + assumeTrue(!isWindows); String dir = buildBufferDir(ROOT, 0); try { conf.set(CONTEXT, dir); @@ -354,7 +356,60 @@ public class TestLocalDirAllocator { Shell.execCommand(new String[] { "chmod", "u+w", BUFFER_DIR_ROOT }); rmBufferDirs(); } + } + + /** + * Test that {@link LocalDirAllocator#getAllLocalPathsToRead(String, Configuration)} + * returns correct filenames and "file" schema. + * + * @throws IOException + */ + @Test + public void testGetAllLocalPathsToRead() throws IOException { + assumeTrue(!isWindows); + + String dir0 = buildBufferDir(ROOT, 0); + String dir1 = buildBufferDir(ROOT, 1); + try { + conf.set(CONTEXT, dir0 + "," + dir1); + assertTrue(localFs.mkdirs(new Path(dir0))); + assertTrue(localFs.mkdirs(new Path(dir1))); + + localFs.create(new Path(dir0 + Path.SEPARATOR + FILENAME)); + localFs.create(new Path(dir1 + Path.SEPARATOR + FILENAME)); + + // check both the paths are returned as paths to read: + final Iterable<Path> pathIterable = dirAllocator.getAllLocalPathsToRead(FILENAME, conf); + int count = 0; + for (final Path p: pathIterable) { + count++; + assertEquals(FILENAME, p.getName()); + assertEquals("file", p.getFileSystem(conf).getUri().getScheme()); + } + assertEquals(2, count); + // test #next() while no element to iterate any more: + try { + Path p = pathIterable.iterator().next(); + assertFalse("NoSuchElementException must be thrown, but returned ["+p + +"] instead.", true); // exception expected + } catch (NoSuchElementException nsee) { + // okay + } + + // test modification not allowed: + final Iterable<Path> pathIterable2 = dirAllocator.getAllLocalPathsToRead(FILENAME, conf); + final Iterator<Path> it = pathIterable2.iterator(); + try { + it.remove(); + assertFalse(true); // exception expected + } catch (UnsupportedOperationException uoe) { + // okay + } + } finally { + Shell.execCommand(new String[] { "chmod", "u+w", BUFFER_DIR_ROOT }); + rmBufferDirs(); + } } @Test Modified: hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestPathExceptions.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestPathExceptions.java?rev=1414456&r1=1414455&r2=1414456&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestPathExceptions.java (original) +++ hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestPathExceptions.java Tue Nov 27 23:02:00 2012 @@ -23,7 +23,7 @@ import static org.junit.Assert.assertEqu import java.io.IOException; import org.apache.hadoop.fs.Path; -import org.apache.hadoop.fs.shell.PathExceptions.PathIOException; +import org.apache.hadoop.fs.PathIOException; import org.junit.Test; public class TestPathExceptions {