-
Notifications
You must be signed in to change notification settings - Fork 2.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
NIFI-11255 Allowable value for 'Use s3.region Attribute' #7051
NIFI-11255 Allowable value for 'Use s3.region Attribute' #7051
Conversation
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.
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.
...s-abstract-processors/src/main/java/org/apache/nifi/processors/aws/AbstractAWSProcessor.java
Outdated
Show resolved
Hide resolved
...abstract-processors/src/main/java/org/apache/nifi/processors/aws/s3/AbstractS3Processor.java
Outdated
Show resolved
Hide resolved
...abstract-processors/src/main/java/org/apache/nifi/processors/aws/s3/AbstractS3Processor.java
Outdated
Show resolved
Hide resolved
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); |
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 think resolveRegion should be called here.
...abstract-processors/src/main/java/org/apache/nifi/processors/aws/s3/AbstractS3Processor.java
Outdated
Show resolved
Hide resolved
...abstract-processors/src/main/java/org/apache/nifi/processors/aws/s3/AbstractS3Processor.java
Outdated
Show resolved
Hide resolved
...-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/PutS3Object.java
Outdated
Show resolved
Hide resolved
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.
@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 fromAbstractAWSProcessor
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
...i-aws-abstract-processors/src/main/java/org/apache/nifi/processors/aws/AwsClientFactory.java
Outdated
Show resolved
Hide resolved
...i-aws-abstract-processors/src/main/java/org/apache/nifi/processors/aws/AwsClientFactory.java
Outdated
Show resolved
Hide resolved
...i-aws-abstract-processors/src/main/java/org/apache/nifi/processors/aws/AwsClientFactory.java
Outdated
Show resolved
Hide resolved
...s-abstract-processors/src/main/java/org/apache/nifi/processors/aws/AbstractAWSProcessor.java
Outdated
Show resolved
Hide resolved
...s-abstract-processors/src/main/java/org/apache/nifi/processors/aws/AbstractAWSProcessor.java
Outdated
Show resolved
Hide resolved
...s-abstract-processors/src/main/java/org/apache/nifi/processors/aws/AbstractAWSProcessor.java
Outdated
Show resolved
Hide resolved
...-aws-abstract-processors/src/main/java/org/apache/nifi/processors/aws/AwsClientProvider.java
Outdated
Show resolved
Hide resolved
...i-aws-abstract-processors/src/main/java/org/apache/nifi/processors/aws/AwsClientFactory.java
Outdated
Show resolved
Hide resolved
d12f3e1
to
5c669a7
Compare
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.
@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.
...ifi-aws-abstract-processors/src/main/java/org/apache/nifi/processors/aws/AwsClientCache.java
Show resolved
Hide resolved
...s-abstract-processors/src/main/java/org/apache/nifi/processors/aws/AbstractAWSProcessor.java
Outdated
Show resolved
Hide resolved
...s-abstract-processors/src/main/java/org/apache/nifi/processors/aws/AbstractAWSProcessor.java
Outdated
Show resolved
Hide resolved
...dle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/TestAwsClientCache.java
Outdated
Show resolved
Hide resolved
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.
@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.
This closes #7051. Signed-off-by: Peter Turcsanyi <turcsanyi@apache.org>
Summary
NIFI-11255
Tracking
Please complete the following tracking steps prior to pull request creation.
Issue Tracking
Pull Request Tracking
NIFI-00000
NIFI-00000
Pull Request Formatting
main
branchVerification
Please indicate the verification steps performed prior to pull request creation.
Build
mvn clean install -P contrib-check
Licensing
LICENSE
andNOTICE
filesDocumentation