-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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-18579. Warn when no region configured. #5230
base: trunk
Are you sure you want to change the base?
Conversation
💔 -1 overall
This message was automatically generated. |
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.
Left a couple of comments
public static void regionNotConfigured() { | ||
WARN_ON_REGION_NOT_CONFIGURED.warn("A region has not been configured. Cross region support " | ||
+ "will be removed as part of upgrading S3A to AWS SDK V2. To avoid errors, set the " | ||
+ "bucket's region in {}.", AWS_REGION); | ||
} |
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.
Since the method just logs and it is conditional by nature (as opposed to majority of logging methods in this class), to improve the readability, how about passing region name to the method and let it decide whether to warn?
public static void warnIfRegionNotConfigured(String regionName) {
if (StringUtils.isBlank(regionName)) {
WARN_ON_REGION_NOT_CONFIGURED.warn("A region has not been configured. Cross region support "
+ "will be removed as part of upgrading S3A to AWS SDK V2. To avoid errors, set the "
+ "bucket's region in {}.", AWS_REGION);
}
}
if (StringUtils.isBlank(region)) { | ||
V2Migration.regionNotConfigured(); | ||
} | ||
|
||
// endpoint set up is a PITA | ||
AwsClientBuilder.EndpointConfiguration epr | ||
= createEndpointConfiguration(parameters.getEndpoint(), |
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.
nit: getConf().getTrimmed(AWS_REGION)
passed to createEndpointConfiguration()
can be replaced with region
Description of PR
Jira
Warn when no region has been configured
fs.s3a.endpoint.region
. This is to prepare for the SDK V2 upgrade, in which requests to S3 will fail if the client is configured with an incorrect region.How was this patch tested?
Did not set
fs.s3a.endpoint.region
, and checked that warning is logged when running an integration test. Set the property, and checked that warning is not logged.Also tested in
eu-west-1
by runningmvn -Dparallel-tests -DtestsThreadCount=16 clean verify
.