-
Notifications
You must be signed in to change notification settings - Fork 8.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HADOOP-18382. SDK upgrade prerequisites #4698
Changes from 11 commits
21b8741
5c56159
952bbcc
e877e68
36c1f6e
8b7ae99
eb95a0a
5f81bce
f20831f
fa3775c
fe5e2e3
4c652b1
b385452
ca3150f
8ded46f
71ac6f8
bd80a4f
15fe8d9
9619ceb
eb0666a
3b87159
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,7 @@ | |
import com.amazonaws.services.s3.model.MultiObjectDeleteException; | ||
import com.amazonaws.services.s3.model.S3ObjectSummary; | ||
import org.apache.hadoop.classification.VisibleForTesting; | ||
import org.apache.hadoop.fs.store.LogExactlyOnce; | ||
import org.apache.hadoop.util.Preconditions; | ||
|
||
import org.apache.commons.lang3.StringUtils; | ||
|
@@ -44,7 +45,6 @@ | |
import org.apache.hadoop.fs.RemoteIterator; | ||
import org.apache.hadoop.util.functional.RemoteIterators; | ||
import org.apache.hadoop.fs.s3a.auth.delegation.EncryptionSecrets; | ||
import org.apache.hadoop.fs.s3a.auth.IAMInstanceCredentialsProvider; | ||
import org.apache.hadoop.fs.s3a.impl.NetworkBinding; | ||
import org.apache.hadoop.fs.s3native.S3xLoginHelper; | ||
import org.apache.hadoop.net.ConnectTimeoutException; | ||
|
@@ -86,6 +86,7 @@ | |
import static org.apache.hadoop.fs.s3a.Constants.*; | ||
import static org.apache.hadoop.fs.s3a.impl.ErrorTranslation.isUnknownBucket; | ||
import static org.apache.hadoop.fs.s3a.impl.InternalConstants.CSE_PADDING_LENGTH; | ||
import static org.apache.hadoop.fs.s3a.impl.InternalConstants.SDK_V2_UPGRADE_LOG_NAME; | ||
import static org.apache.hadoop.fs.s3a.impl.MultiObjectDeleteSupport.translateDeleteException; | ||
import static org.apache.hadoop.io.IOUtils.cleanupWithLogger; | ||
import static org.apache.hadoop.util.functional.RemoteIterators.filteringRemoteIterator; | ||
|
@@ -141,6 +142,11 @@ public final class S3AUtils { | |
|
||
private static final String BUCKET_PATTERN = FS_S3A_BUCKET_PREFIX + "%s.%s"; | ||
|
||
public static final Logger SDK_V2_UPGRADE_LOG = LoggerFactory.getLogger(SDK_V2_UPGRADE_LOG_NAME); | ||
|
||
private static final LogExactlyOnce WARN_OF_DIRECTLY_REFERENCED_CREDENTIAL_PROVIDER = | ||
new LogExactlyOnce(SDK_V2_UPGRADE_LOG); | ||
|
||
/** | ||
* Error message when the AWS provider list built up contains a forbidden | ||
* entry. | ||
|
@@ -551,13 +557,14 @@ public static long dateToLong(final Date date) { | |
/** | ||
* The standard AWS provider list for AWS connections. | ||
*/ | ||
@SuppressWarnings("deprecation") | ||
public static final List<Class<?>> | ||
STANDARD_AWS_PROVIDERS = Collections.unmodifiableList( | ||
Arrays.asList( | ||
TemporaryAWSCredentialsProvider.class, | ||
SimpleAWSCredentialsProvider.class, | ||
EnvironmentVariableCredentialsProvider.class, | ||
IAMInstanceCredentialsProvider.class)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. using fully qualified class names to avoid deprecation warnings that happen on importing a deprecated class. not sure if there is a better way to suppress import warnings? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we just ignore them if there's no way to avoid |
||
org.apache.hadoop.fs.s3a.auth.IAMInstanceCredentialsProvider.class)); | ||
|
||
/** | ||
* Create the AWS credentials from the providers, the URI and | ||
|
@@ -568,6 +575,7 @@ public static long dateToLong(final Date date) { | |
* @throws IOException Problems loading the providers (including reading | ||
* secrets from credential files). | ||
*/ | ||
@SuppressWarnings("deprecation") | ||
public static AWSCredentialProviderList createAWSCredentialProviderSet( | ||
@Nullable URI binding, | ||
Configuration conf) throws IOException { | ||
|
@@ -615,6 +623,7 @@ public static List<Class<?>> loadAWSProviderClasses(Configuration conf, | |
* @return the list of classes, possibly empty | ||
* @throws IOException on a failure to load the list. | ||
*/ | ||
@SuppressWarnings("deprecation") | ||
public static AWSCredentialProviderList buildAWSProviderList( | ||
@Nullable final URI binding, | ||
final Configuration conf, | ||
|
@@ -637,6 +646,12 @@ public static AWSCredentialProviderList buildAWSProviderList( | |
AWSCredentialProviderList providers = new AWSCredentialProviderList(); | ||
for (Class<?> aClass : awsClasses) { | ||
|
||
if (aClass.getName().contains(AWS_AUTH_CLASS_PREFIX)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. again, log through the proposed LogOnce log |
||
WARN_OF_DIRECTLY_REFERENCED_CREDENTIAL_PROVIDER.warn( | ||
"Directly referencing AWS SDK V1 credential provider {}. AWS SDK V1 credential " | ||
+ "providers will be removed once S3A is upgraded to SDK V2", aClass.getName()); | ||
} | ||
|
||
if (forbidden.contains(aClass)) { | ||
throw new IOException(E_FORBIDDEN_AWS_PROVIDER | ||
+ " in option " + key + ": " + aClass); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am proposing the class does implement the v2 api. so no need to deprecate or break the delegation token binding
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have removed this deprecation. Since this means DT bindings will not break, and custom cred providers there can continue to use V1 cred providers, do we want to remove the warning on use of DT's? I guess we still want to encourage people to update these credential providers so might be worth leaving in.