Author: szetszwo
Date: Tue Jul 29 00:49:14 2014
New Revision: 1614234
URL: http://svn.apache.org/r1614234
Log:
Merge r1609845 through r1614231 from trunk.
Added:
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/DirectBufferPool.java
- copied unchanged from r1614231,
hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/DirectBufferPool.java
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestDirectBufferPool.java
- copied unchanged from r1614231,
hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestDirectBufferPool.java
Modified:
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/CHANGES.txt
(contents, props changed)
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/
(props changed)
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/KeyProviderCryptoExtension.java
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/ChecksumFileSystem.java
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileContext.java
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/Path.java
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ChRootedFs.java
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFs.java
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/alias/JavaKeyStoreProvider.java
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/ToolRunner.java
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/site/apt/Compatibility.apt.vm
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestDFVariations.java
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestPath.java
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestPathData.java
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFileSystemBaseTest.java
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFsBaseTest.java
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/NfsExports.java
Modified:
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/CHANGES.txt?rev=1614234&r1=1614233&r2=1614234&view=diff
==============================================================================
---
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/CHANGES.txt
(original)
+++
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/CHANGES.txt
Tue Jul 29 00:49:14 2014
@@ -189,6 +189,9 @@ Trunk (Unreleased)
HADOOP-10720. KMS: Implement generateEncryptedKey and decryptEncryptedKey
in the REST API. (asuresh via tucu)
+ HADOOP-10891. Add EncryptedKeyVersion factory method to
+ KeyProviderCryptoExtension. (wang)
+
BUG FIXES
HADOOP-9451. Fault single-layer config if node group topology is enabled.
@@ -452,6 +455,11 @@ Release 2.6.0 - UNRELEASED
HADOOP-10855. Allow Text to be read with a known Length. (todd)
+ HADOOP-10887. Add XAttrs to ViewFs and make XAttrs + ViewFileSystem
+ internal dir behavior consistent. (Stephen Chu via wang)
+
+ HADOOP-10882. Move DirectBufferPool into common util. (todd)
+
OPTIMIZATIONS
BUG FIXES
@@ -480,6 +488,12 @@ Release 2.6.0 - UNRELEASED
command when the format of the stat command uses non-curly quotes (yzhang
via cmccabe)
+ HADOOP-10830. Missing lock in JavaKeyStoreProvider.createCredentialEntry.
+ (Benoy Antony via umamahesh)
+
+ HADOOP-10876. The constructor of Path should not take an empty URL as a
+ parameter. (Zhihai Xu via wang)
+
Release 2.5.0 - UNRELEASED
INCOMPATIBLE CHANGES
@@ -492,6 +506,9 @@ Release 2.5.0 - UNRELEASED
HADOOP-8943. Support multiple group mapping providers. (Kai Zheng via
brandonli)
+ HADOOP-9361 Strictly define the expected behavior of filesystem APIs and
+ write tests to verify compliance (stevel)
+
IMPROVEMENTS
HADOOP-10451. Remove unused field and imports from SaslRpcServer.
@@ -586,9 +603,6 @@ Release 2.5.0 - UNRELEASED
HADOOP-10747. Support configurable retries on SASL connection failures in
RPC client. (cnauroth)
- HADOOP-10674. Improve PureJavaCrc32 performance and use java.util.zip.CRC32
- for Java 7 and above. (szetszwo)
-
HADOOP-10754. Reenable several HA ZooKeeper-related tests on Windows.
(cnauroth)
@@ -600,9 +614,6 @@ Release 2.5.0 - UNRELEASED
HADOOP-10767. Clean up unused code in Ls shell command. (cnauroth)
- HADOOP-9361 Strictly define the expected behavior of filesystem APIs and
- write tests to verify compliance (stevel)
-
HADOOP-9651 Filesystems to throw FileAlreadyExistsException in
createFile(path, overwrite=false) when the file exists (stevel)
@@ -613,8 +624,14 @@ Release 2.5.0 - UNRELEASED
HADOOP-10782. Fix typo in DataChecksum class. (Jingguo Yao via suresh)
+ HADOOP-10896. Update compatibility doc to capture visibility of
+ un-annotated classes/ methods. (kasha)
+
OPTIMIZATIONS
+ HADOOP-10674. Improve PureJavaCrc32 performance and use java.util.zip.CRC32
+ for Java 7 and above. (szetszwo)
+
BUG FIXES
HADOOP-10378. Typo in help printed by hdfs dfs -help.
@@ -769,6 +786,30 @@ Release 2.5.0 - UNRELEASED
HADOOP-10801 dead link in site.xml (Akira AJISAKA via stevel)
+ HADOOP-10590. ServiceAuthorizationManager is not threadsafe. (Benoy Antony
via vinayakumarb)
+
+ HADOOP-10711. Cleanup some extra dependencies from hadoop-auth. (rkanter
via tucu)
+
+ HADOOP-10479. Fix new findbugs warnings in hadoop-minikdc.
+ (Swarnim Kulkarni via wheat9)
+
+ HADOOP-10715. Remove public GraphiteSink#setWriter (Babak Behzad via
raviprak)
+
+ HADOOP-10710. hadoop.auth cookie is not properly constructed according to
+ RFC2109. (Juan Yu via tucu)
+
+ HADOOP-10864. Tool documentenation is broken. (Akira Ajisaka
+ via Arpit Agarwal)
+
+ HADOOP-10872. TestPathData fails intermittently with "Mkdirs failed
+ to create d1". (Yongjun Zhang via Arpit Agarwal)
+
+ HADOOP-10890. TestDFVariations.testMount fails intermittently. (Yongjun
+ Zhang via Arpit Agarwal)
+
+ HADOOP-10894. Fix dead link in ToolRunner documentation. (Akira Ajisaka
+ via Arpit Agarwal)
+
BREAKDOWN OF HADOOP-10514 SUBTASKS AND RELATED JIRAS
HADOOP-10520. Extended attributes definition and FileSystem APIs for
@@ -790,21 +831,6 @@ Release 2.5.0 - UNRELEASED
HADOOP-10561. Copy command with preserve option should handle Xattrs.
(Yi Liu via cnauroth)
- HADOOP-10590. ServiceAuthorizationManager is not threadsafe. (Benoy Antony
via vinayakumarb)
-
- HADOOP-10711. Cleanup some extra dependencies from hadoop-auth. (rkanter
via tucu)
-
- HADOOP-10479. Fix new findbugs warnings in hadoop-minikdc.
- (Swarnim Kulkarni via wheat9)
-
- HADOOP-10715. Remove public GraphiteSink#setWriter (Babak Behzad via
raviprak)
-
- HADOOP-10710. hadoop.auth cookie is not properly constructed according to
- RFC2109. (Juan Yu via tucu)
-
- HADOOP-10864. Tool documentenation is broken. (Akira Ajisaka
- via Arpit Agarwal)
-
Release 2.4.1 - 2014-06-23
INCOMPATIBLE CHANGES
Propchange:
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/CHANGES.txt
------------------------------------------------------------------------------
Merged
/hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt:r1612881-1614231
Propchange:
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/
------------------------------------------------------------------------------
Merged
/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java:r1612881-1614231
Modified:
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/KeyProviderCryptoExtension.java
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/KeyProviderCryptoExtension.java?rev=1614234&r1=1614233&r2=1614234&view=diff
==============================================================================
---
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/KeyProviderCryptoExtension.java
(original)
+++
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/KeyProviderCryptoExtension.java
Tue Jul 29 00:49:14 2014
@@ -80,6 +80,30 @@ public class KeyProviderCryptoExtension
}
/**
+ * Factory method to create a new EncryptedKeyVersion that can then be
+ * passed into {@link #decryptEncryptedKey}. Note that the fields of the
+ * returned EncryptedKeyVersion will only partially be populated; it is not
+ * necessarily suitable for operations besides decryption.
+ *
+ * @param encryptionKeyVersionName Version name of the encryption key used
+ * to encrypt the encrypted key.
+ * @param encryptedKeyIv Initialization vector of the encrypted
+ * key. The IV of the encryption key used
to
+ * encrypt the encrypted key is derived
from
+ * this IV.
+ * @param encryptedKeyMaterial Key material of the encrypted key.
+ * @return EncryptedKeyVersion suitable for decryption.
+ */
+ public static EncryptedKeyVersion createForDecryption(String
+ encryptionKeyVersionName, byte[] encryptedKeyIv,
+ byte[] encryptedKeyMaterial) {
+ KeyVersion encryptedKeyVersion = new KeyVersion(null, null,
+ encryptedKeyMaterial);
+ return new EncryptedKeyVersion(null, encryptionKeyVersionName,
+ encryptedKeyIv, encryptedKeyVersion);
+ }
+
+ /**
* @return Name of the encryption key used to encrypt the encrypted key.
*/
public String getEncryptionKeyName() {
Modified:
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/ChecksumFileSystem.java
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/ChecksumFileSystem.java?rev=1614234&r1=1614233&r2=1614234&view=diff
==============================================================================
---
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/ChecksumFileSystem.java
(original)
+++
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/ChecksumFileSystem.java
Tue Jul 29 00:49:14 2014
@@ -437,7 +437,9 @@ public abstract class ChecksumFileSystem
throw new FileNotFoundException("Parent directory doesn't exist: "
+ parent);
} else if (!mkdirs(parent)) {
- throw new IOException("Mkdirs failed to create " + parent);
+ throw new IOException("Mkdirs failed to create " + parent
+ + " (exists=" + exists(parent) + ", cwd=" + getWorkingDirectory()
+ + ")");
}
}
final FSDataOutputStream out;
Modified:
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileContext.java
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileContext.java?rev=1614234&r1=1614233&r2=1614234&view=diff
==============================================================================
---
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileContext.java
(original)
+++
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileContext.java
Tue Jul 29 00:49:14 2014
@@ -2484,4 +2484,33 @@ public final class FileContext {
}
}.resolve(this, absF);
}
+
+ /**
+ * Get all of the xattr names for a file or directory.
+ * Only those xattr names which the logged-in user has permissions to view
+ * are returned.
+ * <p/>
+ * A regular user can only get xattr names for the "user" namespace.
+ * The super user can only get xattr names for "user" and "trusted"
+ * namespaces.
+ * The xattrs of the "security" and "system" namespaces are only
+ * used/exposed internally by/to the FS impl.
+ * <p/>
+ * @see <a href="http://en.wikipedia.org/wiki/Extended_file_attributes">
+ * http://en.wikipedia.org/wiki/Extended_file_attributes</a>
+ *
+ * @param path Path to get extended attributes
+ * @return List<String> of the XAttr names of the file or directory
+ * @throws IOException
+ */
+ public List<String> listXAttrs(Path path) throws IOException {
+ final Path absF = fixRelativePart(path);
+ return new FSLinkResolver<List<String>>() {
+ @Override
+ public List<String> next(final AbstractFileSystem fs, final Path p)
+ throws IOException {
+ return fs.listXAttrs(p);
+ }
+ }.resolve(this, absF);
+ }
}
Modified:
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java?rev=1614234&r1=1614233&r2=1614234&view=diff
==============================================================================
---
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java
(original)
+++
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java
Tue Jul 29 00:49:14 2014
@@ -2509,7 +2509,7 @@ public abstract class FileSystem extends
* http://en.wikipedia.org/wiki/Extended_file_attributes</a>
*
* @param path Path to get extended attributes
- * @return Map<String, byte[]> describing the XAttrs of the file or directory
+ * @return List<String> of the XAttr names of the file or directory
* @throws IOException
*/
public List<String> listXAttrs(Path path) throws IOException {
Modified:
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/Path.java
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/Path.java?rev=1614234&r1=1614233&r2=1614234&view=diff
==============================================================================
---
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/Path.java
(original)
+++
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/Path.java
Tue Jul 29 00:49:14 2014
@@ -128,7 +128,20 @@ public class Path implements Comparable
"Can not create a Path from an empty string");
}
}
-
+
+ /** check URI parameter of Path constructor. */
+ private void checkPathArg(URI aUri) throws IllegalArgumentException {
+ // disallow construction of a Path from an empty URI
+ if (aUri == null) {
+ throw new IllegalArgumentException(
+ "Can not create a Path from a null URI");
+ }
+ if (aUri.toString().isEmpty()) {
+ throw new IllegalArgumentException(
+ "Can not create a Path from an empty URI");
+ }
+ }
+
/** Construct a path from a String. Path strings are URIs, but with
* unescaped elements and some additional normalization. */
public Path(String pathString) throws IllegalArgumentException {
@@ -176,6 +189,7 @@ public class Path implements Comparable
* Construct a path from a URI
*/
public Path(URI aUri) {
+ checkPathArg(aUri);
uri = aUri.normalize();
}
Modified:
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ChRootedFs.java
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ChRootedFs.java?rev=1614234&r1=1614233&r2=1614234&view=diff
==============================================================================
---
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ChRootedFs.java
(original)
+++
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ChRootedFs.java
Tue Jul 29 00:49:14 2014
@@ -22,6 +22,7 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.util.EnumSet;
import java.util.List;
+import java.util.Map;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
@@ -37,6 +38,7 @@ import org.apache.hadoop.fs.FsStatus;
import org.apache.hadoop.fs.Options.ChecksumOpt;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.UnresolvedLinkException;
+import org.apache.hadoop.fs.XAttrSetFlag;
import org.apache.hadoop.fs.permission.AclEntry;
import org.apache.hadoop.fs.permission.AclStatus;
import org.apache.hadoop.fs.permission.FsPermission;
@@ -314,6 +316,38 @@ class ChRootedFs extends AbstractFileSys
}
@Override
+ public void setXAttr(Path path, String name, byte[] value,
+ EnumSet<XAttrSetFlag> flag) throws IOException {
+ myFs.setXAttr(fullPath(path), name, value, flag);
+ }
+
+ @Override
+ public byte[] getXAttr(Path path, String name) throws IOException {
+ return myFs.getXAttr(fullPath(path), name);
+ }
+
+ @Override
+ public Map<String, byte[]> getXAttrs(Path path) throws IOException {
+ return myFs.getXAttrs(fullPath(path));
+ }
+
+ @Override
+ public Map<String, byte[]> getXAttrs(Path path, List<String> names)
+ throws IOException {
+ return myFs.getXAttrs(fullPath(path), names);
+ }
+
+ @Override
+ public List<String> listXAttrs(Path path) throws IOException {
+ return myFs.listXAttrs(fullPath(path));
+ }
+
+ @Override
+ public void removeXAttr(Path path, String name) throws IOException {
+ myFs.removeXAttr(fullPath(path), name);
+ }
+
+ @Override
public void setVerifyChecksum(final boolean verifyChecksum)
throws IOException, UnresolvedLinkException {
myFs.setVerifyChecksum(verifyChecksum);
Modified:
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java?rev=1614234&r1=1614233&r2=1614234&view=diff
==============================================================================
---
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java
(original)
+++
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java
Tue Jul 29 00:49:14 2014
@@ -913,5 +913,39 @@ public class ViewFileSystem extends File
.addEntries(AclUtil.getMinimalAcl(PERMISSION_555))
.stickyBit(false).build();
}
+
+ @Override
+ public void setXAttr(Path path, String name, byte[] value,
+ EnumSet<XAttrSetFlag> flag) throws IOException {
+ checkPathIsSlash(path);
+ throw readOnlyMountTable("setXAttr", path);
+ }
+
+ @Override
+ public byte[] getXAttr(Path path, String name) throws IOException {
+ throw new NotInMountpointException(path, "getXAttr");
+ }
+
+ @Override
+ public Map<String, byte[]> getXAttrs(Path path) throws IOException {
+ throw new NotInMountpointException(path, "getXAttrs");
+ }
+
+ @Override
+ public Map<String, byte[]> getXAttrs(Path path, List<String> names)
+ throws IOException {
+ throw new NotInMountpointException(path, "getXAttrs");
+ }
+
+ @Override
+ public List<String> listXAttrs(Path path) throws IOException {
+ throw new NotInMountpointException(path, "listXAttrs");
+ }
+
+ @Override
+ public void removeXAttr(Path path, String name) throws IOException {
+ checkPathIsSlash(path);
+ throw readOnlyMountTable("removeXAttr", path);
+ }
}
}
Modified:
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFs.java
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFs.java?rev=1614234&r1=1614233&r2=1614234&view=diff
==============================================================================
---
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFs.java
(original)
+++
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFs.java
Tue Jul 29 00:49:14 2014
@@ -26,6 +26,7 @@ import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
+import java.util.Map;
import java.util.Map.Entry;
import org.apache.hadoop.classification.InterfaceAudience;
@@ -48,6 +49,7 @@ import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.RemoteIterator;
import org.apache.hadoop.fs.UnresolvedLinkException;
import org.apache.hadoop.fs.UnsupportedFileSystemException;
+import org.apache.hadoop.fs.XAttrSetFlag;
import org.apache.hadoop.fs.local.LocalConfigKeys;
import org.apache.hadoop.fs.permission.AclEntry;
import org.apache.hadoop.fs.permission.AclUtil;
@@ -651,6 +653,50 @@ public class ViewFs extends AbstractFile
fsState.resolve(getUriPath(path), true);
return res.targetFileSystem.getAclStatus(res.remainingPath);
}
+
+ @Override
+ public void setXAttr(Path path, String name, byte[] value,
+ EnumSet<XAttrSetFlag> flag) throws IOException {
+ InodeTree.ResolveResult<AbstractFileSystem> res =
+ fsState.resolve(getUriPath(path), true);
+ res.targetFileSystem.setXAttr(res.remainingPath, name, value, flag);
+ }
+
+ @Override
+ public byte[] getXAttr(Path path, String name) throws IOException {
+ InodeTree.ResolveResult<AbstractFileSystem> res =
+ fsState.resolve(getUriPath(path), true);
+ return res.targetFileSystem.getXAttr(res.remainingPath, name);
+ }
+
+ @Override
+ public Map<String, byte[]> getXAttrs(Path path) throws IOException {
+ InodeTree.ResolveResult<AbstractFileSystem> res =
+ fsState.resolve(getUriPath(path), true);
+ return res.targetFileSystem.getXAttrs(res.remainingPath);
+ }
+
+ @Override
+ public Map<String, byte[]> getXAttrs(Path path, List<String> names)
+ throws IOException {
+ InodeTree.ResolveResult<AbstractFileSystem> res =
+ fsState.resolve(getUriPath(path), true);
+ return res.targetFileSystem.getXAttrs(res.remainingPath, names);
+ }
+
+ @Override
+ public List<String> listXAttrs(Path path) throws IOException {
+ InodeTree.ResolveResult<AbstractFileSystem> res =
+ fsState.resolve(getUriPath(path), true);
+ return res.targetFileSystem.listXAttrs(res.remainingPath);
+ }
+
+ @Override
+ public void removeXAttr(Path path, String name) throws IOException {
+ InodeTree.ResolveResult<AbstractFileSystem> res =
+ fsState.resolve(getUriPath(path), true);
+ res.targetFileSystem.removeXAttr(res.remainingPath, name);
+ }
/*
@@ -921,5 +967,39 @@ public class ViewFs extends AbstractFile
.addEntries(AclUtil.getMinimalAcl(PERMISSION_555))
.stickyBit(false).build();
}
+
+ @Override
+ public void setXAttr(Path path, String name, byte[] value,
+ EnumSet<XAttrSetFlag> flag) throws IOException {
+ checkPathIsSlash(path);
+ throw readOnlyMountTable("setXAttr", path);
+ }
+
+ @Override
+ public byte[] getXAttr(Path path, String name) throws IOException {
+ throw new NotInMountpointException(path, "getXAttr");
+ }
+
+ @Override
+ public Map<String, byte[]> getXAttrs(Path path) throws IOException {
+ throw new NotInMountpointException(path, "getXAttrs");
+ }
+
+ @Override
+ public Map<String, byte[]> getXAttrs(Path path, List<String> names)
+ throws IOException {
+ throw new NotInMountpointException(path, "getXAttrs");
+ }
+
+ @Override
+ public List<String> listXAttrs(Path path) throws IOException {
+ throw new NotInMountpointException(path, "listXAttrs");
+ }
+
+ @Override
+ public void removeXAttr(Path path, String name) throws IOException {
+ checkPathIsSlash(path);
+ throw readOnlyMountTable("removeXAttr", path);
+ }
}
}
Modified:
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/alias/JavaKeyStoreProvider.java
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/alias/JavaKeyStoreProvider.java?rev=1614234&r1=1614233&r2=1614234&view=diff
==============================================================================
---
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/alias/JavaKeyStoreProvider.java
(original)
+++
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/alias/JavaKeyStoreProvider.java
Tue Jul 29 00:49:14 2014
@@ -194,15 +194,18 @@ public class JavaKeyStoreProvider extend
@Override
public CredentialEntry createCredentialEntry(String alias, char[] credential)
throws IOException {
+ writeLock.lock();
try {
if (keyStore.containsAlias(alias) || cache.containsKey(alias)) {
throw new IOException("Credential " + alias + " already exists in " +
this);
}
+ return innerSetCredential(alias, credential);
} catch (KeyStoreException e) {
throw new IOException("Problem looking up credential " + alias + " in "
+ this,
e);
+ } finally {
+ writeLock.unlock();
}
- return innerSetCredential(alias, credential);
}
@Override
Modified:
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/ToolRunner.java
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/ToolRunner.java?rev=1614234&r1=1614233&r2=1614234&view=diff
==============================================================================
---
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/ToolRunner.java
(original)
+++
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/ToolRunner.java
Tue Jul 29 00:49:14 2014
@@ -30,7 +30,7 @@ import org.apache.hadoop.conf.Configurat
* <p><code>ToolRunner</code> can be used to run classes implementing
* <code>Tool</code> interface. It works in conjunction with
* {@link GenericOptionsParser} to parse the
- * <a
href="{@docRoot}/org/apache/hadoop/util/GenericOptionsParser.html#GenericOptions">
+ * <a
href="{@docRoot}/../hadoop-project-dist/hadoop-common/CommandsManual.html#Generic_Options">
* generic hadoop command line arguments</a> and modifies the
* <code>Configuration</code> of the <code>Tool</code>. The
* application-specific options are passed along without being modified.
Modified:
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/site/apt/Compatibility.apt.vm
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/site/apt/Compatibility.apt.vm?rev=1614234&r1=1614233&r2=1614234&view=diff
==============================================================================
---
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/site/apt/Compatibility.apt.vm
(original)
+++
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/site/apt/Compatibility.apt.vm
Tue Jul 29 00:49:14 2014
@@ -72,10 +72,13 @@ Apache Hadoop Compatibility
* Private-Stable APIs can change across major releases,
but not within a major release.
+ * Classes not annotated are implicitly "Private". Class members not
+ annotated inherit the annotations of the enclosing class.
+
* Note: APIs generated from the proto files need to be compatible for
-rolling-upgrades. See the section on wire-compatibility for more details. The
-compatibility policies for APIs and wire-communication need to go
-hand-in-hand to address this.
+ rolling-upgrades. See the section on wire-compatibility for more details.
+ The compatibility policies for APIs and wire-communication need to go
+ hand-in-hand to address this.
** Semantic compatibility
Modified:
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestDFVariations.java
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestDFVariations.java?rev=1614234&r1=1614233&r2=1614234&view=diff
==============================================================================
---
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestDFVariations.java
(original)
+++
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestDFVariations.java
Tue Jul 29 00:49:14 2014
@@ -29,14 +29,33 @@ import java.util.Random;
import org.apache.hadoop.test.GenericTestUtils;
import org.apache.hadoop.util.Shell;
+import org.junit.After;
+import org.junit.Before;
import org.junit.Test;
+
import static org.junit.Assert.*;
public class TestDFVariations {
-
+ private static final String TEST_ROOT_DIR =
+ System.getProperty("test.build.data","build/test/data") +
"/TestDFVariations";
+ private static File test_root = null;
+
+ @Before
+ public void setup() throws IOException {
+ test_root = new File(TEST_ROOT_DIR);
+ test_root.mkdirs();
+ }
+
+ @After
+ public void after() throws IOException {
+ FileUtil.setWritable(test_root, true);
+ FileUtil.fullyDelete(test_root);
+ assertTrue(!test_root.exists());
+ }
+
public static class XXDF extends DF {
public XXDF() throws IOException {
- super(new File(System.getProperty("test.build.data","/tmp")), 0L);
+ super(test_root, 0L);
}
@Override
Modified:
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestPath.java
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestPath.java?rev=1614234&r1=1614233&r2=1614234&view=diff
==============================================================================
---
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestPath.java
(original)
+++
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestPath.java
Tue Jul 29 00:49:14 2014
@@ -26,11 +26,13 @@ import java.util.Arrays;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.AvroTestUtil;
+import org.apache.hadoop.test.GenericTestUtils;
import org.apache.hadoop.util.Shell;
import com.google.common.base.Joiner;
import junit.framework.TestCase;
+import static org.junit.Assert.fail;
public class TestPath extends TestCase {
/**
@@ -305,6 +307,28 @@ public class TestPath extends TestCase {
// if the child uri is absolute path
assertEquals("foo://bar/fud#boo", new Path(new Path(new URI(
"foo://bar/baz#bud")), new Path(new URI("/fud#boo"))).toString());
+
+ // empty URI
+ URI uri3 = new URI("");
+ assertEquals("", uri3.toString());
+ try {
+ path = new Path(uri3);
+ fail("Expected exception for empty URI");
+ } catch (IllegalArgumentException e) {
+ // expect to receive an IllegalArgumentException
+ GenericTestUtils.assertExceptionContains("Can not create a Path"
+ + " from an empty URI", e);
+ }
+ // null URI
+ uri3 = null;
+ try {
+ path = new Path(uri3);
+ fail("Expected exception for null URI");
+ } catch (IllegalArgumentException e) {
+ // expect to receive an IllegalArgumentException
+ GenericTestUtils.assertExceptionContains("Can not create a Path"
+ + " from a null URI", e);
+ }
}
/** Test URIs created from Path objects */
Modified:
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestPathData.java
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestPathData.java?rev=1614234&r1=1614233&r2=1614234&view=diff
==============================================================================
---
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestPathData.java
(original)
+++
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestPathData.java
Tue Jul 29 00:49:14 2014
@@ -35,19 +35,22 @@ import org.junit.Before;
import org.junit.Test;
public class TestPathData {
+ private static final String TEST_ROOT_DIR =
+ System.getProperty("test.build.data","build/test/data") + "/testPD";
protected Configuration conf;
protected FileSystem fs;
protected Path testDir;
-
+
@Before
public void initialize() throws Exception {
conf = new Configuration();
fs = FileSystem.getLocal(conf);
- testDir = new Path(
- System.getProperty("test.build.data", "build/test/data") + "/testPD"
- );
+ testDir = new Path(TEST_ROOT_DIR);
+
// don't want scheme on the path, just an absolute path
testDir = new Path(fs.makeQualified(testDir).toUri().getPath());
+ fs.mkdirs(testDir);
+
FileSystem.setDefaultUri(conf, fs.getUri());
fs.setWorkingDirectory(testDir);
fs.mkdirs(new Path("d1"));
@@ -60,6 +63,7 @@ public class TestPathData {
@After
public void cleanup() throws Exception {
+ fs.delete(testDir, true);
fs.close();
}
Modified:
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFileSystemBaseTest.java
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFileSystemBaseTest.java?rev=1614234&r1=1614233&r2=1614234&view=diff
==============================================================================
---
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFileSystemBaseTest.java
(original)
+++
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFileSystemBaseTest.java
Tue Jul 29 00:49:14 2014
@@ -773,4 +773,34 @@ public class ViewFileSystemBaseTest {
assertFalse(aclStatus.isStickyBit());
}
+ @Test(expected=AccessControlException.class)
+ public void testInternalSetXAttr() throws IOException {
+ fsView.setXAttr(new Path("/internalDir"), "xattrName", null);
+ }
+
+ @Test(expected=NotInMountpointException.class)
+ public void testInternalGetXAttr() throws IOException {
+ fsView.getXAttr(new Path("/internalDir"), "xattrName");
+ }
+
+ @Test(expected=NotInMountpointException.class)
+ public void testInternalGetXAttrs() throws IOException {
+ fsView.getXAttrs(new Path("/internalDir"));
+ }
+
+ @Test(expected=NotInMountpointException.class)
+ public void testInternalGetXAttrsWithNames() throws IOException {
+ fsView.getXAttrs(new Path("/internalDir"), new ArrayList<String>());
+ }
+
+ @Test(expected=NotInMountpointException.class)
+ public void testInternalListXAttr() throws IOException {
+ fsView.listXAttrs(new Path("/internalDir"));
+ }
+
+ @Test(expected=AccessControlException.class)
+ public void testInternalRemoveXAttr() throws IOException {
+ fsView.removeXAttr(new Path("/internalDir"), "xattrName");
+ }
+
}
Modified:
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFsBaseTest.java
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFsBaseTest.java?rev=1614234&r1=1614233&r2=1614234&view=diff
==============================================================================
---
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFsBaseTest.java
(original)
+++
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFsBaseTest.java
Tue Jul 29 00:49:14 2014
@@ -747,4 +747,34 @@ public class ViewFsBaseTest {
AclUtil.getMinimalAcl(PERMISSION_555));
assertFalse(aclStatus.isStickyBit());
}
+
+ @Test(expected=AccessControlException.class)
+ public void testInternalSetXAttr() throws IOException {
+ fcView.setXAttr(new Path("/internalDir"), "xattrName", null);
+ }
+
+ @Test(expected=NotInMountpointException.class)
+ public void testInternalGetXAttr() throws IOException {
+ fcView.getXAttr(new Path("/internalDir"), "xattrName");
+ }
+
+ @Test(expected=NotInMountpointException.class)
+ public void testInternalGetXAttrs() throws IOException {
+ fcView.getXAttrs(new Path("/internalDir"));
+ }
+
+ @Test(expected=NotInMountpointException.class)
+ public void testInternalGetXAttrsWithNames() throws IOException {
+ fcView.getXAttrs(new Path("/internalDir"), new ArrayList<String>());
+ }
+
+ @Test(expected=NotInMountpointException.class)
+ public void testInternalListXAttr() throws IOException {
+ fcView.listXAttrs(new Path("/internalDir"));
+ }
+
+ @Test(expected=AccessControlException.class)
+ public void testInternalRemoveXAttr() throws IOException {
+ fcView.removeXAttr(new Path("/internalDir"), "xattrName");
+ }
}
Modified:
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/NfsExports.java
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/NfsExports.java?rev=1614234&r1=1614233&r2=1614234&view=diff
==============================================================================
---
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/NfsExports.java
(original)
+++
hadoop/common/branches/HDFS-6584/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/NfsExports.java
Tue Jul 29 00:49:14 2014
@@ -53,7 +53,12 @@ public class NfsExports {
long expirationPeriodNano = conf.getLong(
Nfs3Constant.NFS_EXPORTS_CACHE_EXPIRYTIME_MILLIS_KEY,
Nfs3Constant.NFS_EXPORTS_CACHE_EXPIRYTIME_MILLIS_DEFAULT) * 1000 *
1000;
- exports = new NfsExports(cacheSize, expirationPeriodNano, matchHosts);
+ try {
+ exports = new NfsExports(cacheSize, expirationPeriodNano, matchHosts);
+ } catch (IllegalArgumentException e) {
+ LOG.error("Invalid NFS Exports provided: ", e);
+ return exports;
+ }
}
return exports;
}