Commit graph

629 commits

Author SHA1 Message Date
Sahil Palvia
3b3998a59e Fixing exception log messaging with Prefetching (#497)
* Changed Prefetch to catch `SdkException` instead of `SdkClientException`
  * With SDK 2.x service exceptions are of the type `SdkServiceException`
* Adding `*.iml` to .gitignore
2019-02-08 15:49:53 -08:00
Justin Pfifer
fd0cb8e98f Capability of restarting the subscription from last processed batch (#492)
* Started to play around with restarting from last processed

After a failure the KCL would instead restart from what the
ShardConsumer says it last processed.

* Extracted the InternalSubscriber to its own class

Extracted the InternalSubscriber to ShardConsumerSubscriber to make
testing easier. Added tests for the ShardConsumerSubscriber that
verifies error handling and other components of the class.

Added tests that verify the restart from behavior.

* Moved the ProcessRecordsInputMatcher to its own class

* Initial changes to for restarting of the PrefetchRecordsPublisher

* Remove code coverage configuration

* Switched to using explicit locks to deal with blocking queue

When the blocking queue is full it would normally enter into a fully
parked state, but would continue to hold the lock.

This changes the process to only block for a second when attempting to
enqueue a response, and if it doesn't succeed check to see if it's
been reset before attempting again.

* Changed locking around the restart, and how fetcher gets updated

Changed the locking around the restart to use a reader/writer lock
instead of single lock with a yield.

Changed how the fetcher is reset to not restart from an
advanceIteratorTo which would retrieve a new shard iterator.  Instead
the resetIterator method takes both the iterator to start from, the
last accepted sequence number, and the initial position.

* Changed test to ensure that PositionResetException is thrown

Changed the test to wait for the queue to reach capacity before
restarting the PrefetchRecordsPublisher.  This should mostly ensure
that calling restartFrom will trigger a throw of a
PositionResetException.

Added @VisibleFortest on the queue since it was already being used in testing.

* Move to snapshot

* Ensure that only one thread can be sending data at a time

In the test the TestPublisher is accessed from two threads: the test
thread, and the dispatch thread.  Both have the possibility of calling
send() under certain conditions.  This changes it so that only one of
the threads can actively be sending data at a time.

TestPublisher#requested was changed to volatile to ensure that calling
cancel can correctly set it to zero.

* Block the test until the blocking thread is in control

This test is somewhat of an odd case as it intends to test what
happens when nothing is dispatched to the ShardConsumerSubcriber for
some amount of time, but data is queued for dispatch.  To do this we
block the single thread of the executor with a lock to ensure that
items pile up in the queue so that should the restart work incorrectly
we will see lost data.
2019-02-07 12:50:41 -08:00
Justin Pfifer
b2751f09d5
Advance version to 2.1.2-SNAPSHOT (#496) 2019-02-07 07:59:37 -08:00
Sahil Palvia
5ff227c2c2
Release 2.1.1 (#494)
* Updating the versions to 2.1.1
* Updating release notes and CHANGELOG
* Updating the user agent version number
2019-02-06 15:03:56 -08:00
Sahil Palvia
7f5bd73c0b * Upgrading the SDK (#493)
* Changing KCL version to 2.1.1-SNAPSHOT
2019-02-06 11:41:53 -08:00
Justin Pfifer
a15713911c Set the region for test runs (#488)
The AWS SDK depends on being able to find which region it should
operate in.  In many cases this is either explicitly set or retrieved
from a variety of sources.  For these test cases we don't actually
care what the region. To ensure that the tests operate as expected the
region is set before the test runs, and reset upon completion.
2019-01-29 18:53:54 -08:00
Tony Wang
d79691cb3f fix wrong parameter order for session creds (#486) 2019-01-28 07:17:24 -08:00
jiaxul
8d9427e06c Add a WorkerState of SHUT_DOWN_STARTED (#457)
Added a new WorkerState that indicates when a shutdown has started
2019-01-24 12:53:39 -08:00
Sahil Palvia
03c15eb275
Introducing MultiLangDaemon support: (#483)
* Introducing MultiLangDaemon support for Enhanced Fan-Out.
* MultiLangDaemon now supports the following command line options.
  * `--properties-file`: Properties file that the KCL should use to set up the Scheduler.
  * `--log-configuration`: logback.xml that the KCL should use for logging.
* Updated AWS SDK dependency to 2.2.0.
* MultiLangDaemon now uses logback for logging.
2019-01-14 17:35:35 -08:00
Justin Pfifer
a05e22f782
Release 2.0.5 of the Amazon Kinesis Client for Java (#465) 2018-11-12 08:54:04 -08:00
Justin Pfifer
f52f2559ed Remove a possible deadlock on polling queue fill (#462)
* Remove a possible deadlock on polling queue fill

Adding new items to the receive queue for the PrefetchRecordsPublisher
when at capacity would deadlock retrievals as it was already holding
a lock on this.

The method addArrivedRecordsInput did not need to be synchronized on
this as it didn't change any of the protected
state (requestedResponses).  There is a call to drainQueueForRequests
immediately after the addArrivedRecordsInput that will ensure newly
arrived data is dispatched.

This fixes #448

* Small fix on the reasoning comment

* Adjust the test to act more like the ShardConsumer

The ShardConsuemr, which is the principal user of the
PrefetchRecordsPublisher, uses RxJava to consume from publisher. This
test uses RxJava to consume, and notifies the test thread once
MAX_ITEMS * 3 have been received. This ensures that we cycle through
the queue at least 3 times.

* Removed the upper limit on the retrievals

The way RxJava's request management makes it possible that more
requests than we might expect can happen.
2018-11-07 16:33:49 -08:00
Sahil Palvia
b83a32b492
Making configurations consistent in entire package (#453) 2018-10-25 10:40:35 -07:00
Sahil Palvia
9f9620354e Adding travis and codebuild badges to readme for v2.x branch (#456) 2018-10-25 08:00:16 -07:00
Sahil Palvia
6bd63f70dd
Updating BuildStatus badge (#452)
* Adding new BuildStatus badges.

* Updating to show single build status
2018-10-23 12:32:31 -07:00
Sahil Palvia
df6d25a201 Updating version to 2.0.5-SNAPSHOT (#450) 2018-10-23 08:09:59 -07:00
Sahil Palvia
eb7b3fd1bb Release 2.0.4 of the Amazon Kinesis Client for Java (#447)
Release 2.0.4 of the Amazon Kinesis Client for Java
2018-10-18 10:32:23 -07:00
Justin Pfifer
f2fb9ead0d
Added a sequence number validator to ensure safer checkpoints (#432)
Added the SequenceNumberValidator that will be used in the checkpoint
process to ensure that the sequence number is valid for the shard
being checkpointed.
2018-10-10 13:02:15 -07:00
akhani18
2609e1ce46 Add a listener to capture task execution in shardConsumer (#417)
* Add a listener to capture when tasks are executed in the ShardConsumer
2018-10-10 13:01:41 -07:00
xiaoyu meng
14c68296f0 Introducing HierarchicalShardSyncer inorder to run multiple Schedulers in a JVM (#395)
* Run multiple instance of scheduler on one JVM

* handling creation of shardSyncer in DynamoDBLeaseManagementFactory and LeaseManagementConfig

* remove multi-threading unit test and do some small refactorings

* refectoring

* deprecate ShardSyncer and use HierarchichalShardSyncer instead; change the order for metricsFactory and HierarchichalShardSyncer in ShardConsumerArgument

* fix typos and use mock object of shardSyncer

* delete improper comments

* fix comments

* remove duplicated comments
2018-10-09 17:29:59 -07:00
Sahil Palvia
854e316b83 Quick fix for shutdown race issue (#439)
* Added a synchronized lock in the initialize and shutdown methods
2018-10-09 13:30:35 -07:00
Sahil Palvia
0326e217f6
Updating version to 2.0.4-SNAPSHOT (#438) 2018-10-09 11:55:50 -07:00
shask-amazon
31ab0af901 Added an API on LeaseCoordinator and LeaseTaker to get all leases for… (#428)
* Added an API on LeaseCoordinator and LeaseTaker to get all leases for the application
2018-10-09 07:56:13 -07:00
Justin Pfifer
e972617bfc
Release note for release 2.0.3 (#436)
Added release notes, and changelog for the 2.0.3 changes.

Made the warning clearer that it only affects the 2.0 version of the
Amazon Kinesis Client
2018-10-08 15:51:06 -07:00
Justin Pfifer
8e6a8c7da3 Advance version of the AWS SDK to 2.0.6 (#434)
Fixes a bug when making SubscribeToShard requests over HTTP 1.1.
Using HTTP 1.1 for SubscribeToShard isn't supported, and may be
break at any time.
2018-10-04 10:40:31 -07:00
Sahil Palvia
9e420d83e4 Fixing issue with KinesisClientUtil class (#433)
* Passing HttpClientBuilder to the client instead of HttpClient
2018-10-03 08:46:34 -07:00
Justin Pfifer
e86bf3d7f3
Revert experimental features from master (#431)
Reverted 3 commits:

Revert "Change version number to 2.0.3-experimental"
Revert: 54c171dc2a.

Revert "Experimental support for sequence number validation in the publisher (#401)"
Revert: 592499f7bc.

Revert "Support Validating Records are From to the Expected Shard (#400)"
Revert: 01f5db8049.
2018-10-02 14:50:25 -07:00
Sahil Palvia
a88d4ba602
Introducing callback for DynamoDB lease table (#413)
* This feature enables customers to perform actions on DynamoDB lease tables once created and in the active state
* Introducing TableCreatorCallback for DynamoDB lease management
* Introducing DoesNothingTableCreatorCallback
* Intoducing TableCreatorCallback config in LeaseManagementConfig, with DoesNothingTableCreatorCallback as the default
* Introducing TableCreatorCallbackInput object.
* Updating the javadoc
2018-09-25 10:06:24 -07:00
Sahil Palvia
0d6335d434
Upgrading Guava dependency to version 26.0-jre (Issue #416) (#420) 2018-09-25 10:00:08 -07:00
Sahil Palvia
d85d6f4187
Fixing spelling error for Acquire timeout (#410) 2018-09-20 21:52:31 +05:30
Sahil Palvia
131b1e4b0f Cleaning up tests (#408)
* Deleting all unused tests for KinesisProxy
2018-09-19 15:00:35 -07:00
Sahil Palvia
a893da6942 Graceful handling of ReadTimeoutExceptions (#403)
* Handling ReadTimeouts gracefully

* Emitting logging messages at DEBUG level for retryable exceptions
* Introducing SubscribeToShardRetryableException

* Addressing comments

* Making private ThrowableCategory class static
* Creating static instances for acquiretimeout and readtimeout categories
* Cleaned up imports
* Renamed and moved SubscribeToShardRetryableException to RetryableRetrievalException
* Renamed UNKNOWN exception type to Other
2018-09-19 10:15:40 -07:00
Justin Pfifer
54c171dc2a
Change version number to 2.0.3-experimental 2018-09-18 18:38:59 -07:00
Justin Pfifer
592499f7bc Experimental support for sequence number validation in the publisher (#401)
* Moved sequence number validation to an experimental feature

Moved the sequence number validation to become an experimental feature
that can be removed in the future.

Added an annotation for experimental features.

* Delete merge conflict again?

* Add some reminder that this stuff is experimental

* Added a reason field, and some reasons

Added a reason value to the annotation, and updated two of the unusual places.
2018-09-19 03:35:36 +05:30
Justin Pfifer
01f5db8049 Support Validating Records are From to the Expected Shard (#400)
* SequenceNumberValidator for verifying shardId's

Added a SequenceNumberValidator that will can extract, and verify
shardId's from a v2 sequence number.

* Added documentation and bit length test

Added documentation for the public methods.
Added a bit length test for the reader that will reject sequence
numbers that don't fit the expectations.

* Added more comments and further document public operations

Added comments in the only SequenceNumberReader explaining how things
are expected to work.

Further documented the class and operations with expectations and outcomes.

* Added configuration to allow failing on mismatched records

Allow configuration which will cause the FanOutRecordsPublisher to
throw an exception when it detects records that aren't for the shard
it's processing.
2018-09-18 03:03:46 +05:30
Justin Pfifer
e8735a4742
Debugging Logs for Initialization of FanOutRecordsPublisher (#398)
* Some debug logging to understand mismatched sequence numbers

Added some logging messages for sequence numbers when starting up.

* Added debug support and logging

Added @ToString to InitialPositionInStreamExtended for debugging
purposes.
Added a debug log about the initialization of the
FanOutRecordsPublisher to ensure that the publisher is being
initialized as expected.
2018-09-11 12:16:12 -07:00
Justin Pfifer
c8a3a031f4
Updated to 2.0.3-SNAPSHOT (#397) 2018-09-11 10:41:47 -07:00
Justin Pfifer
a8badc22d0
Release notes for 2.0.2 (#392)
Release notes for 2.0.2, and advance the version
2018-09-04 10:44:30 -07:00
jiaxul
ea49eef19e Introduce initialization exception handler in KCL V2 (#369)
Added a new method to the WorkerStateChangeListener that is called once all attempts to initialize the scheduler have failed.
2018-08-31 07:54:52 -07:00
Justin Pfifer
0634a3c836
Merge pull request #388 from pfifer/default-deprecated
Change the CoordinatorFactory deprecated methods to default
2018-08-30 08:17:33 -07:00
Justin Pfifer
70f937b68b
Merge pull request #387 from maghis/patch-1
Fixed typo in terminate log message
2018-08-30 08:06:47 -07:00
Pfifer, Justin
106c055744 Change the CoordinatorFactory deprecated methods to default
Changed the CoordinatorFactory methods to be default methods.  This
will not require an implementer to implement the deprecated methods.

Updated the documentation on the methods to indicate resolve order as
a list.
2018-08-30 08:03:18 -07:00
Massimo Andreasi Bassi
b6472df41a
Fixed typo in terminate log message 2018-08-30 10:57:57 -04:00
Justin Pfifer
03af17f6ee
Merge pull request #386 from sahilpalvia/commons-lang-fix
Upgrading KCL to use commons-lang 3.7
2018-08-29 14:14:58 -07:00
Sahil Palvia
0ec3004b0b Updating the import in the configuration test. 2018-08-27 13:12:28 -07:00
Sahil Palvia
878b1a4af9 Upgrading KCL to use only commons-lang3
* Removing commons-lang 2.6 dependency
* Upgrading imports to use commons-lang3
2018-08-27 13:07:39 -07:00
Justin Pfifer
7734561e18
Merge pull request #385 from sahilpalvia/coordinator-config-fix
Cleaning up configuration

Deprecating createGracefulShutdownCoordinator from CoordinatorFactory
Deprecating createWorkerStateChangeListener from CoordinatorFactory
Introduing gracefulShutdownCoordinator and workerStateChangeListener configurations to CoordinatorConfig
Switching to use CoordinatorFactory only if the new configurations in code are set to null
2018-08-27 11:51:06 -07:00
Sahil Palvia
7fa9e10991 Cleaning up configuration
* Deprecating createGracefulShutdownCoordinator from CoordinatorFactory
* Deprecating createWorkerStateChangeListener from CoordinatorFactory
* Introduing gracefulShutdownCoordinator and workerStateChangeListener configurations to CoordinatorConfig
* Switching to use CoordinatorFactory only if the new configurations in code are set to null
2018-08-27 11:26:04 -07:00
Justin Pfifer
99667e8f50 Respect logWarningForTaskAfterMillis for logging a retrieval warning (#383)
Only log a warning if it's been > logWarningForTaskAfterMillis time
since data was last received.
2018-08-23 13:16:53 -07:00
Justin Pfifer
e3eff0dc3c
Merge pull request #379 from sahilpalvia/readme_fix
Updating README and version information
2018-08-22 11:45:29 -07:00
Sahil Palvia
9459cc6a9e Updating README and version information
* Adding information on how to import the project using maven
* Updating project version to 2.0.2-SNAPSHOT
2018-08-21 17:02:42 -07:00