Skip to content
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

NIFI-11255 Allowable value for 'Use s3.region Attribute' #7051

Conversation

krisztina-zsihovszki
Copy link
Contributor

Summary

NIFI-11255

Tracking

Please complete the following tracking steps prior to pull request creation.

Issue Tracking

Pull Request Tracking

  • Pull Request title starts with Apache NiFi Jira issue number, such as NIFI-00000
  • Pull Request commit message starts with Apache NiFi Jira issue number, as such NIFI-00000

Pull Request Formatting

  • Pull Request based on current revision of the main branch
  • Pull Request refers to a feature branch with one commit containing changes

Verification

Please indicate the verification steps performed prior to pull request creation.

Build

  • Build completed using mvn clean install -P contrib-check
    • JDK 11
    • JDK 17

Licensing

  • New dependencies are compatible with the Apache License 2.0 according to the License Policy
  • New dependencies are documented in applicable LICENSE and NOTICE files

Documentation

  • Documentation formatting appears as expected in rendered files

Copy link
Contributor

@Lehel44 Lehel44 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @krisztina-zsihovszki for the contribution. I checked if overloading methods that is supposed to be overriden can be avoided but doesn't seem like an option here. I left a few comments.

Comment on lines 244 to 248
String regionValue = context.getProperty(S3_CUSTOM_REGION).getValue();

if (ATTRIBUTE_DRIVEN_REGION.getValue().equals(regionValue)) {
regionValue = attributes.get(S3_REGION_ATTRIBUTE);
Region region = parseRegionValue(regionValue);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think resolveRegion should be called here.

Copy link
Contributor

@turcsanyip turcsanyip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@krisztina-zsihovszki Thanks for adding the caching!

I have a few notes regarding the cache key (AwsClientDetails class):

  • it does not contain the ClientType so clients with different type but same credentials, region, etc. would be mapped to the same key
  • AwsClientDetails contains the common config from AbstractAWSProcessor only but some processor implementations add some extra config (like signer in S3) which may affect the shared clients (these should be reflected in the key in order to create distinct clients)
  • AwsClientDetails needs to be created by the caller and kept consistent with the other parameters which is not straightforward

Just an idea but it may solve all the problems above: add new method AwsClientProvider.getClientCacheKey() with the same parameters as createClient()

  • => the processor implementations are responsible for providing the right key
  • => different key types mean different client types
  • => the implementation is local to the client type and it is based on the same parameters the client will be built from

Copy link
Contributor

@turcsanyip turcsanyip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@krisztina-zsihovszki Thanks for the changes! The concept and code look good to me now.
I found 2 bugs but I think they could be fixed easily.
The other 2 comments are nice to have but very small changes.

Copy link
Contributor

@turcsanyip turcsanyip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@krisztina-zsihovszki Thanks for adding this new feature and for all the review changes!
@Lehel44 Thanks for your review!

+1 LGTM
Merging to main and 1.x.

@asfgit asfgit closed this in 9a002d9 Apr 18, 2023
asfgit pushed a commit that referenced this pull request Apr 18, 2023
This closes #7051.

Signed-off-by: Peter Turcsanyi <turcsanyi@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants