You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/11/03 16:17:08 UTC

[GitHub] [flink] elphastori opened a new pull request, #21237: [FLINK-26890][Connector/Kinesis] Handle invalid shards in DynamoDB

elphastori opened a new pull request, #21237:
URL: https://github.com/apache/flink/pull/21237

   ## What is the purpose of the change
   
   This pull request makes the Kinesis DynamoDB Streams Consumer close shards that are no longer valid rather than throwing an irrecoverable exceptions. This is because the `DescribeStream` API can return shards that are no longer valid and expects the client to handle them.
   
   
   ## Brief change log
   
     - `ResourceNotFoundException` thrown in `getShardIterator` for DynamoDB streams consumer is now swallowed
     - A `null` `shardIterator` is returned which is an existing signal to close a shard
     - Added  an `INFO` log to explain that the shard has been closed
   
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
   
     - Added a unit test that validates that a `ResourceNotFoundException` thrown in `getShardIterator` is caught and a `null` is returned
     - Manually verified the change by running the ConsumeFromDyanamoDB example, updating records in a DDB table every 10 ms and pausing for updates to re-produce a shard that is no longer valid. Shards that threw a `NoResourceFoundException` were closed.
   
   ```python
   dyn_resource = boto3.resource('dynamodb')
   users = Users(dyn_resource)
   users.table = dyn_resource.Table("UsersExample")
   while True:
   	users.update_user(random.randint(0, 999), names.get_first_name())
   	time.sleep(1)
   ```
   
     - Manually introduced random failures by changing the last digit of a `shardId` to a 0 and this also resulted in a `NoResourceFoundException` that was handled correctly
   
   ```java
   public String getShardIterator(
   		StreamShardHandle shard, String shardIteratorType, @Nullable Object startingMarker)
   		throws InterruptedException {
   	...
   	if (random.nextInt(10) == 0) {
   		char[] shardIdChars = shard.getShard().getShardId().toCharArray();
   		shardIdChars[shardIdChars.length - 1] = '0';
   		shard =
   				new StreamShardHandle(
   						shard.getStreamName(),
   						new Shard().withShardId(new String(shardIdChars)));
   	}
   	...
   }
   ```
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (no)
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (no)
     - The serializers: (no)
     - The runtime per-record code paths (performance sensitive): (no)
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (no)
     - The S3 file system connector: (no)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (no)
     - If yes, how is the feature documented? (not applicable)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] flinkbot commented on pull request #21237: [FLINK-26890][Connector/Kinesis] Handle invalid shards in DynamoDB

Posted by GitBox <gi...@apache.org>.
flinkbot commented on PR #21237:
URL: https://github.com/apache/flink/pull/21237#issuecomment-1302353972

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "0ef76bda9fd7ed6fd0b872b2d66442aec9a14f74",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "0ef76bda9fd7ed6fd0b872b2d66442aec9a14f74",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 0ef76bda9fd7ed6fd0b872b2d66442aec9a14f74 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] dannycranmer merged pull request #21237: [FLINK-26890][Connector/Kinesis] Handle invalid shards in DynamoDB

Posted by GitBox <gi...@apache.org>.
dannycranmer merged PR #21237:
URL: https://github.com/apache/flink/pull/21237


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org