Commit graph

475 commits

Author SHA1 Message Date
Mike Watters
9074864027 [Issue 210] - Allow unexpected child shards to be ignored (#240)
Allow unexpected child shards to be ignored

now instead of always throwing an assertion if a child shard has an
open parent, consider worker configuration before doing so.  if
configured to ignore such shards, do not create leases for them during
shard sync.  this is intended to mitigate failing worker init when
processing dynamodb streams with many thousands of shards (which can
happen for tables with thousands of partitions).

this new behavior can be enabled by adding the following to a
configuration/properties file:

```
ignoreUnexpectedChildShards = true
```
2018-01-04 08:29:44 -08:00
Justin Pfifer
85d6c059c2
Merge pull request #269 from pfifer/release-1.8.8
Release 1.8.8 of the Amazon Kinesis Client for Java
2017-11-15 10:57:48 -08:00
Pfifer, Justin
47e6206e8d Release 1.8.8 of the Amazon Kinesis Client for Java
Release 1.8.8
* Fixed issues with leases losses due to `ExpiredIteratorException` in `PrefetchGetRecordsCache` and `AsynchronousFetchingStrategy`.
  PrefetchGetRecordsCache will request for a new iterator and start fetching data again.
  * PR#263
* Added warning message for long running tasks.
  * PR#259
* Handling spurious lease renewal failures gracefully.
  Added better handling of DynamoDB failures when updating leases.  These failures would occur when a request to DynamoDB appeared to fail, but was actually successful.
  * PR#247
* ShutdownTask gets retried if the previous attempt on the ShutdownTask fails.
  * PR#267
* Fix for using maxRecords from `KinesisClientLibConfiguration` in `GetRecordsCache` for fetching records.
  * PR#264
2017-11-15 10:44:49 -08:00
Sahil Palvia
3c705300b5 Adding release notes and updating the KCL version to 1.8.8. (#268) 2017-11-15 10:44:10 -08:00
Sahil Palvia
09b312028a Unit test fixes for retrying when requesting a shutdown. (#267)
* Shutdown that throws an exception will be retried.

Without this change a transient error on shutdown with reason terminate prevents
child shards from starting.

* Fixing the tests for the Shutdown fix.
2017-11-13 09:45:40 -08:00
Sahil Palvia
1abb41dbdb Correctly Send MaxRecords to SingleRecordsFetcherFactory Fixed #262
Fixes #262 

Changing the signture of SingleRecordsFetcherFactory to no longer take maxRecords as the parameter to the constructor. Changed the createRecordsFetcher signature to take maxRecords as a parameter. (#264)
2017-11-10 06:32:16 -08:00
Sahil Palvia
5c3ff2b31e Handle Expired Iterators Correctly
Fix for the lease losses in the PrefetchCache and AsyncGetRecordsStrategy caused due to ExpiredIteratorException. (#263)
2017-11-08 12:03:09 -08:00
Sahil Palvia
3de901ea93 Adding logging for long running tasks. (#259)
Allow enabling logging for long running tasks.
2017-10-25 15:38:45 -07:00
Sahil Palvia
7032ea67ec Spurious update fix (#247)
* Handle spurious lease renewal failures gracefully.

If the request to conditionally update a lease counter in DynamoDB fails, it's
considered a failure to renew the lease. This is a good thing, except if the
request failure was just because of connectivity problems. In this case the
counter *did* update in DynamoDB, but the Dynamo client retries the request
which then fails the update condition (since the lease counter no longer
matches expected value).

To handle this gracefully we opt to get the lease record from Dynamo and
examine the lease owner and counter. If it matches what we were expecting,
then we consider renewal a success.
2017-10-25 08:11:20 -07:00
Sahil Palvia
cbcc898d71 Updating version to 1.8.8-SNAPSHOT. (#258) 2017-10-25 08:09:44 -07:00
Justin Pfifer
821b0cbd0f Release Notes for 1.8.7 of the Amazon Kinesis Client Library for Java (#257)
Don't add a delay for synchronous requests to Kinesis
Removes a delay that had been added for synchronous GetRecords calls to Kinesis
2017-10-24 09:38:49 -07:00
Sahil Palvia
73426bd733 Don't Sleep for During Retrieval for the BlockingGetRecordsCache
The BlockingGetRecordsCache shouldn't sleep when retrieving records as backoff is provided in other parts of the ShardConumer.
2017-10-24 09:13:19 -07:00
Justin Pfifer
cc7e329e2f Release Note for Release 1.8.6 of the Amazon Kinesis Client for Java (#254) 2017-10-23 12:30:08 -07:00
Justin Pfifer
90d4cb78c5 Update the AWS SDK Version to 1.11.218 (#253) 2017-10-23 10:16:25 -07:00
Justin Pfifer
046e160e24 Block Fetch Thread When Retrieval Should be Paused (#252)
Block the fetching thread when the queue is considered to be full.
This ensures that the thread won't spin the CPU when it can't retrieve
more records or bytes.
2017-10-23 10:16:03 -07:00
Justin Pfifer
8ed6c81cea Revert "Shutdown that throws an exception will be retried. (#238)" (#251)
This reverts commit 44437f1361.

Reverted due to Build Failures
2017-10-19 11:40:44 -07:00
jmooreoliva
44437f1361 Shutdown that throws an exception will be retried. (#238)
Without this change a transient error on shutdown with reason terminate prevents
child shards from starting.
2017-10-18 14:16:54 -07:00
Sahil Palvia
ee3a6c24e6 Support Prefetching of Records
This adds that ability for the KCL to fetch records while the record processor is busy.  This can help smooth out delays in record process, or retrieving data from Kinesis.  Enabling this does require extra threads for background retrieval.

Settings
* dataFetchingStrategy: Which strategy to use to retrieve records.  This can be either DEFAULT or PREFETCH_CACHED
* maxCacheByteSize: Retrieval will be paused when the total number of bytes in the cache exceeds this value
* maxRecordsCount: Retrieval will be paused when the total number of records in the cache exceeds this value
* maxPendingProcessRecordsInput: Retrieval will be paused when the total number of fulfilled requests in the cache exceeds this value
2017-10-17 13:05:43 -07:00
Justin Pfifer
9720b1b249 Release 1.8.5 of the Amazon Kinesis Client for Java (#232)
* Release 1.8.5 of the Amazon Kinesis Client for Java

Release 1.8.5 (September 26, 2017)
* Only advance the shard iterator for the accepted response.  
  This fixes a race condition in the `KinesisDataFetcher` when it's being used to make asynchronous requests.  The shard iterator is now only advanced when the retriever calls `DataFetcherResult#accept()`.
  * PR #230
  * Issue #231
2017-09-26 14:31:59 -07:00
Justin Pfifer
6b25de917b Merge pull request #230 from pfifer/data-fetcher-accept
Only advance the shard iterator when we accept a result to return
2017-09-26 13:47:57 -07:00
Pfifer, Justin
4b20556f37 Only advance the shard iterator when we accept a result to return
This changes the retriever strategy to only accept the shard iterator
when we have accepted a result to return.  This is for the
asynchronous retriever where multiple threads may contend for the same
iterator slot.  This ensures only the one selected for the response will
advance the shard iterator.
2017-09-26 12:39:53 -07:00
Justin Pfifer
23c46267cf Merge pull request #228 from pfifer/release-1.8.4
Release 1.8.4 of the Amazon Kinesis Client for Java
2017-09-22 16:32:19 -07:00
Pfifer, Justin
c1df703d67 Release 1.8.4 of the Amazon Kinesis Client for Java
* Create a new completion service for each request.
  This ensures that canceled tasks are discarded.  This will prevent a cancellation exception causing issues processing records.
  * PR #227
  * Issue #226
2017-09-22 16:23:20 -07:00
Justin Pfifer
e8039b31ae Merge pull request #227 from pfifer/cancel-fix
Recreate the completion service instead of reusing them.
2017-09-22 16:18:52 -07:00
Pfifer, Justin
b1c27bd386 Recreate the completion service instead of reusing them.
This prevents cancelled tasks from being polled in subsequent calls.
2017-09-22 14:45:54 -07:00
Justin Pfifer
5558449043 Release 1.8.3 of the Amazon Kinesis Client for Java (#224)
* Call shutdown on the retriever when the record processor is being shutdown
  This fixes a bug that could leak threads if using the
  AsynchronousGetRecordsRetrievalStrategy is being used.
  The asynchronous retriever is only used when
  KinesisClientLibConfiguration#retryGetRecordsInSeconds, and
  KinesisClientLibConfiguration#maxGetRecordsThreadPool are set.
  * PR #222
2017-09-22 12:25:52 -07:00
Sahil Palvia
4dd9423170 Calling shutdown on the RetrievalStrategy (#222)
Fixes a bug where the retriever wasn't being shutdown when a record processor was being shutdown.
2017-09-22 11:43:34 -07:00
Justin Pfifer
9a82b6bd05 Release 1.8.2 of the Amazon Kinesis Client for Java (#218)
* Add support for two phase checkpoints
  Applications can now set a pending checkpoint, before completing the checkpoint operation. Once the application has completed its checkpoint steps, the final checkpoint will clear the pending checkpoint.
  Should the checkpoint fail the attempted sequence number is provided in the InitializationInput#getPendingCheckpointSequenceNumber otherwise the value will be null.
  * PR #188
* Support timeouts, and retry for GetRecords calls.
  Applications can now set timeouts for GetRecord calls to Kinesis.  As part of setting the timeout, the application must also provide a thread pool size for concurrent requests.
  * PR #214
* Notification when the lease table is throttled
  When writes, or reads, to the lease table are throttled a warning will be emitted.  If you're seeing this warning you should increase the IOPs for your lease table to prevent processing delays.
  * PR #212
* Support configuring the graceful shutdown timeout for MultiLang Clients
  This adds support for setting the timeout that the Java process will wait for the MutliLang client to complete graceful shutdown.  The timeout can be configured by adding shutdownGraceMillis to the properties file set to the number of milliseconds to wait.
  * PR #204
2017-09-20 08:52:36 -07:00
Alex Charlton
01d2688bc6 MultiLangDaemon: Make shutdown grace configurable (#204)
Allow configuring the amount of time that the graceful shutdown process will wait for the client to complete its shutdown.
2017-09-19 08:52:31 -07:00
Sahil Palvia
244da44d29 Allow Configuring GetRecords Calls to Timeout. (#214)
It's now possible to configure GetRecords calls to timeout if they
take to long.  This can be used to terminate a long running request to
ensure that record processors continue to make progress

This feature was added with contributions from @pfifer, @sahilpalvia,
and @BtXin.
2017-09-18 10:58:16 -07:00
Sahil Palvia
656b17ceaa Adding logging for DynamoDB ProvisionedThroughputExceededExcpetion (#212)
* Adding logging to ProvisionedThroughputExceededException.

* Addressing CR comments and changing log level from error to warn

* Updated the comments as per cr comments.
2017-09-15 11:04:30 -07:00
Walid Baruni
1ec0b656c9 Add Support for Two Phase Commit (#188)
Adds support for making two phase commits.  When a checkpoint is started, but fails to complete the next instance of the record processor will receive the attempted checkpoint position at initialization time.
2017-08-15 12:56:32 -07:00
Justin Pfifer
cdbbff31e8 Advance to 1.8.2-SNAPSHOT (#203)
Advanced the version to 1.8.2
2017-08-14 09:05:12 -07:00
Justin Pfifer
79296dad2e Release 1.8.1 of the Amazon Kinesis Client (#198)
Support timeouts for calls to the MultiLang Daemon
This adds support for setting a timeout when dispatching records to
the client record processor. If the record processor doesn't respond
within the timeout the parent Java process will be terminated. This
is a temporary fix to handle cases where the KCL becomes blocked
while waiting for a client record processor.

The timeout for the this can be set by adding
  `timeoutInSeconds = <timeout value>`.
The default for this is no timeout.

Setting this can cause the KCL to exit suddenly, before using this
ensure that you have an automated restart for your application

Related #195
Related #185
2017-08-02 10:41:14 -07:00
Pfifer, Justin
526a1fa0df Updated AWS SDK to 1.11.171 2017-08-02 10:33:23 -07:00
Sahil Palvia
e8f9ad3f0a Adding support for timeout for multilang protocol, related to issue 185 (#195)
* Adding timeout to waitForStatusMessage future call. Introducing new config properties timeoutEnabled and timeoutInSeconds. Halting the JVM if timeout is reached.

* Adding test cases for halt jvm code. Made the configuration objects for timeout optional.

* Addressing code review comments and making appropriate changes.
2017-08-01 11:37:39 -07:00
Justin Pfifer
7d56c4aef1 Advance Version to 1.8.1-SNAPSHOT (#194)
Advance version of the amazon-kinesis-client to 1.8.1-SNAPSHOT in
preparation of next release cycle.
2017-07-25 14:19:34 -07:00
Justin Pfifer
af51312307 Release 1.8.0 (#193)
* Execute graceful shutdown on its own thread
  * PR #191
  * Issue #167
* Added support for controlling the size of the lease renewer thread pool
  * PR #177
  * Issue #171
* Require Java 8 and later
  Java 8 is now required for versions 1.8.0 of the amazon-kinesis-client and later.
  * PR #176
2017-07-25 09:22:48 -07:00
Justin Pfifer
c067cefa1f Make Graceful Shutdown Run On Its Own Thread (#191)
* Initial start of fix for requested shutdown

* Execute the requested shutdown in a separate thread.

Fix for Issue #167

* Reworked some of the shutdown logic to make the relationships clearer.

* Added/Updated Copyright Statements

* Add Missing License Statements
2017-07-21 08:30:26 -07:00
Justin Pfifer
f697a094d9 Make the lease renewer thread pool size configurable (#177)
Allow configuration of the lease renewer thread pool size.  Users can
now control the size of the pool.  Additionally core threads are now
a quarter of the thread pool size, and aren't allowed to timeout.
2017-07-20 12:07:21 -07:00
Justin Pfifer
14e2413c13 Advance version, and drop Java 7 support (#176)
* Advance version, and drop Java 7 support

Advanced the version to 1.8.0 as Java 7 support is being removed.

* Remove build settings for Java 7

Removed the configuration for Java 7, and switched to trusty for access
to openjdk8.
2017-07-20 12:03:34 -07:00
Justin Pfifer
4c839a9d43 Release 1.7.6 of the Amazon Kinesis Client (#184)
* Added support for graceful shutdown in MultiLang Clients
  * PR #174
  * PR #182
* Updated documentation for `v2.IRecordProcessor#shutdown`, and `KinesisClientLibConfiguration#idleTimeBetweenReadsMillis`
  * PR #170
* Updated to version 1.11.151 of the AWS Java SDK
  * PR #183
2017-06-22 06:56:42 -07:00
Justin Pfifer
dabdc29822 Update to the Newest Version of the AWS Java SDK (#183) 2017-06-21 08:54:18 -07:00
Justin Pfifer
d7ed56d4d0 Added ShutdownRequestedMessage to the subtypes for Message (#182)
Added the ShutdownRequestedMessage to the subtypes for Message.  This ensures that the action value of the message will be correctly set.
2017-06-21 08:36:41 -07:00
Muhammad Ikramul Haq
5a8bac23c6 Trigger Graceful Shutdown for MultiLang Daemon Clients on SIGTERM (#174)
When the parent Java process receives a SIGTERM it will now trigger a graceful shutdown of the worker, which dispatches a ShutdownRequestedMessage to all of the record processors.  This will allow record processors a final chance to checkpoint before the lease is terminated.

This changes is incompatible with current versions of the MultiLang Clients.  A future change will allow older versions MultiLang clients to use newer versions of the Java KCL.
2017-06-21 07:52:30 -07:00
Pfifer, Justin
198f8afce7 Advance Version to 1.7.6 for Next Release 2017-06-21 07:46:06 -07:00
Pfifer, Justin
e121691ac2 Cleanup the Writing of the IdleTimeBetweenMillis Documentation 2017-06-01 08:26:16 -07:00
Pfifer, Justin
e12ff541f7 Enable Building Both Source, and JavaDoc jars 2017-06-01 08:26:16 -07:00
Pfifer, Justin
ddfd64e40a Update the Documentation for Shutdown to List Checkpoint Requirements
When the KCL calls shutdown with the reason TERMINATE the customer's
application must checkpoint, or the KCL will not make progress.
2017-06-01 08:26:16 -07:00
Pfifer, Justin
f0557179f1 Improved Documentation for IdleTimeBetweenReadsMillis
Updated the documentation to indicates that it is only used when
GetRecords returns an empty set of records.
2017-06-01 08:26:16 -07:00