[ 
https://issues.apache.org/jira/browse/FLINK-10316?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16638284#comment-16638284
 ] 

ASF GitHub Bot commented on FLINK-10316:
----------------------------------------

tweise commented on a change in pull request #6789: [FLINK-10316][kinesis] bug 
was preventing FlinkKinesisProducer to connect to Kinesalite
URL: https://github.com/apache/flink/pull/6789#discussion_r222691000
 
 

 ##########
 File path: 
flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/util/KinesisConfigUtil.java
 ##########
 @@ -266,10 +266,18 @@ public static void validateAwsConfiguration(Properties 
config) {
                        }
                }
 
-               if (!(config.containsKey(AWSConfigConstants.AWS_REGION) ^ 
config.containsKey(ConsumerConfigConstants.AWS_ENDPOINT))) {
-                       // per validation in AwsClientBuilder
-                       throw new 
IllegalArgumentException(String.format("Either AWS region ('%s') or AWS 
endpoint ('%s') must be set in the config.",
-                               AWSConfigConstants.AWS_REGION, 
AWSConfigConstants.AWS_REGION));
+               if (isProducer) {
 
 Review comment:
   Since it isn't common, respective code should be moved into 
`validateConsumerConfiguration` and `getValidatedProducerConfiguration`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Kinesalite bug fix (FLINK-9402) doesn't fully fix the problem.
> --------------------------------------------------------------
>
>                 Key: FLINK-10316
>                 URL: https://issues.apache.org/jira/browse/FLINK-10316
>             Project: Flink
>          Issue Type: Bug
>          Components: Kinesis Connector
>    Affects Versions: 1.5.0, 1.6.0, 1.7.0
>            Reporter: Joseph Sims
>            Priority: Minor
>              Labels: pull-request-available
>
> Related to: https://issues.apache.org/jira/browse/FLINK-9402
> A fix (Flink-9402) was introduced to force the configurations to have 
> *exactly* one of "aws.region" or "aws.endpoint", but the underlying problem 
> wasn't entirely fixed.
> If "aws.endpoint" is set and "aws.region" is unset, a different exception is 
> thrown, instead.
> In *KinesisConfigUtil.java*, *getValidatedProducerConfiguration()* calls:
> {code:java}
>     validateAwsConfiguration(config)
> {code}
> Where the original fix was introduced ("aws.region" XOR "aws.endpoint")
>  But a couple of lines later, *getValidatedProducerConfiguration()* then 
> calls:
> {code:java}
>     kpc.setRegion(config.getProperty(AWSConfigConstants.AWS_REGION));
> {code}
> Which explicitly checks for the existence of "aws.region", and throws an 
> exception if it is not set.
>  Thus, this class needs to be fixed such that "aws.region" is only required 
> if "aws.endpoint" is unset, as the original ticket indicated.
> Also, *validateAwsConfiguration()* has a minor bug where is labels the 
> "aws.endpoint" incorrectly.
>  Current:
> {code:java}
> if (!(config.containsKey(AWSConfigConstants.AWS_REGION) ^ 
> config.containsKey(ConsumerConfigConstants.AWS_ENDPOINT))) {
>    // per validation in AwsClientBuilder
>    throw new IllegalArgumentException(String.format("Either AWS region ('%s') 
> or AWS endpoint ('%s') must be set in the config.",
>       AWSConfigConstants.AWS_REGION, AWSConfigConstants.AWS_REGION));
> }
> {code}
> But should be:
> {code:java}
> if (!(config.containsKey(AWSConfigConstants.AWS_REGION) ^ 
> config.containsKey(ConsumerConfigConstants.AWS_ENDPOINT))) {
>    // per validation in AwsClientBuilder
>    throw new IllegalArgumentException(String.format("Either AWS region ('%s') 
> or AWS endpoint ('%s') must be set in the config.",
>       AWSConfigConstants.AWS_REGION, ConsumerConfigConstants.AWS_ENDPOINT));
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to