From 01e61044f9219f63340786f3aec50b752d2a654d Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Tue, 26 Jan 2021 15:31:29 +0000 Subject: [PATCH 1/2] HADOOP-17497. refactoring the signature of S3ClientFactory breaks hboss compile. Change the S3ClientFactory to restore/invoke the previous method, if the new one has not been invoked. Change-Id: I858d62fb34b8d4b4d0f864f33ee809357299d8c1 --- .../apache/hadoop/fs/s3a/S3ClientFactory.java | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3ClientFactory.java b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3ClientFactory.java index e04d3b5cbd269..08a2823b44a8e 100644 --- a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3ClientFactory.java +++ b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3ClientFactory.java @@ -30,6 +30,9 @@ /** * Factory for creation of {@link AmazonS3} client instances. + * Important: HBase's HBoss module implements this interface in its + * test. If changing the signature use default implementations to avoid + * breaking things. */ @InterfaceAudience.Private @InterfaceStability.Unstable @@ -46,10 +49,32 @@ public interface S3ClientFactory { * @return S3 client * @throws IOException IO problem */ - AmazonS3 createS3Client(URI name, + default AmazonS3 createS3Client(URI name, String bucket, AWSCredentialsProvider credentialSet, String userAgentSuffix, - StatisticsFromAwsSdk statisticsFromAwsSdk) throws IOException; + StatisticsFromAwsSdk statisticsFromAwsSdk) throws IOException { + return createS3Client(name, bucket, credentialSet, userAgentSuffix); + } + + /** + * Creates a new {@link AmazonS3} client. + * Obsolete and never directly called in the s3 code. + * It exists to keep HBoss builds compiling: they do implement it + * and want to build/run across Hadoop versions. + * @param name raw input S3A file system URI + * @param bucket Optional bucket to use to look up per-bucket proxy secrets + * @param credentialSet credentials to use + * @param userAgentSuffix optional suffix for the UA field. + * @return S3 client + * @throws IOException IO problem + * @deprecated this is only here to stop hboss builds breaking. + */ + default AmazonS3 createS3Client(URI name, + String bucket, + AWSCredentialsProvider credentialSet, + String userAgentSuffix) throws IOException { + throw new UnsupportedOperationException("Not implemented"); + } } From 7c61984d06e3c00932048fad04571875f88aa594 Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Mon, 8 Feb 2021 18:18:17 +0000 Subject: [PATCH 2/2] HADOOP-17497. javadoc tuning Change-Id: If8d83fbd98411f0b66996077e68efdefe658d2e4 --- .../main/java/org/apache/hadoop/fs/s3a/S3ClientFactory.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3ClientFactory.java b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3ClientFactory.java index 08a2823b44a8e..7bec15f96c310 100644 --- a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3ClientFactory.java +++ b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3ClientFactory.java @@ -31,8 +31,9 @@ /** * Factory for creation of {@link AmazonS3} client instances. * Important: HBase's HBoss module implements this interface in its - * test. If changing the signature use default implementations to avoid - * breaking things. + * test. + * Take care when updating this interface to ensure that a client + * implementing only the deprecated method will work. */ @InterfaceAudience.Private @InterfaceStability.Unstable @@ -70,6 +71,7 @@ default AmazonS3 createS3Client(URI name, * @throws IOException IO problem * @deprecated this is only here to stop hboss builds breaking. */ + @Deprecated default AmazonS3 createS3Client(URI name, String bucket, AWSCredentialsProvider credentialSet,