From b5df324d32d3d74d6b812d8f76b172d9e0ba4620 Mon Sep 17 00:00:00 2001 From: Aaron Myers Date: Tue, 11 Feb 2014 02:49:07 +0000 Subject: [PATCH] HADOOP-10326. M/R jobs can not access S3 if Kerberos is enabled. Contributed by bc Wong. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1566966 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../main/java/org/apache/hadoop/fs/s3/S3FileSystem.java | 6 ++++++ .../apache/hadoop/fs/s3native/NativeS3FileSystem.java | 6 ++++++ .../hadoop/fs/s3/S3FileSystemContractBaseTest.java | 7 ++++++- .../fs/s3native/NativeS3FileSystemContractBaseTest.java | 9 +++++++-- 5 files changed, 28 insertions(+), 3 deletions(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 03d1761ccca..f6a49e43a5d 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -33,6 +33,9 @@ Release 2.4.0 - UNRELEASED HADOOP-10330. TestFrameDecoder fails if it cannot bind port 12345. (Arpit Agarwal) + HADOOP-10326. M/R jobs can not access S3 if Kerberos is enabled. (bc Wong + via atm) + Release 2.3.0 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/s3/S3FileSystem.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/s3/S3FileSystem.java index 81ef31446e5..44fd0fa8d71 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/s3/S3FileSystem.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/s3/S3FileSystem.java @@ -350,6 +350,12 @@ public class S3FileSystem extends FileSystem { return getConf().getLong("fs.s3.block.size", 64 * 1024 * 1024); } + @Override + public String getCanonicalServiceName() { + // Does not support Token + return null; + } + // diagnostic methods void dump() throws IOException { diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/s3native/NativeS3FileSystem.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/s3native/NativeS3FileSystem.java index 2ea31d85a65..0782feb9088 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/s3native/NativeS3FileSystem.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/s3native/NativeS3FileSystem.java @@ -699,4 +699,10 @@ public class NativeS3FileSystem extends FileSystem { public Path getWorkingDirectory() { return workingDir; } + + @Override + public String getCanonicalServiceName() { + // Does not support Token + return null; + } } diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/s3/S3FileSystemContractBaseTest.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/s3/S3FileSystemContractBaseTest.java index d1770d3b889..d704b006bef 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/s3/S3FileSystemContractBaseTest.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/s3/S3FileSystemContractBaseTest.java @@ -54,5 +54,10 @@ public abstract class S3FileSystemContractBaseTest assertEquals("Double default block size", newBlockSize, fs.getFileStatus(file).getBlockSize()); } - + + public void testCanonicalName() throws Exception { + assertNull("s3 doesn't support security token and shouldn't have canonical name", + fs.getCanonicalServiceName()); + } + } diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/s3native/NativeS3FileSystemContractBaseTest.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/s3native/NativeS3FileSystemContractBaseTest.java index 60010e43644..ac6b9ec3251 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/s3native/NativeS3FileSystemContractBaseTest.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/s3native/NativeS3FileSystemContractBaseTest.java @@ -48,7 +48,12 @@ public abstract class NativeS3FileSystemContractBaseTest store.purge("test"); super.tearDown(); } - + + public void testCanonicalName() throws Exception { + assertNull("s3n doesn't support security token and shouldn't have canonical name", + fs.getCanonicalServiceName()); + } + public void testListStatusForRoot() throws Exception { FileStatus[] paths = fs.listStatus(path("/")); assertEquals(0, paths.length); @@ -60,7 +65,7 @@ public abstract class NativeS3FileSystemContractBaseTest assertEquals(1, paths.length); assertEquals(path("/test"), paths[0].getPath()); } - + public void testNoTrailingBackslashOnBucket() throws Exception { assertTrue(fs.getFileStatus(new Path(fs.getUri().toString())).isDirectory()); }