-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
Behavior
When implementing a Subscriber<SubscribeToShardEventStream>
using the AWS Java SDK, starting from a timestamp and inserting records, onNext
returns a SubscribeToShardEvent
with a continuationSequenceNumber
of 0. The returned record sequenceNumbers are like:
49658026119490182770032252969867129256605616914593865986
49658026119490182770032252969868338182425231543768572162
49658026119490182770032252969869547108244846172943278338
Creating a new subscriber using this sequence number of 0 gives an error:
Unable to find record with provided SequenceNumber SequenceNumber(0) in stream
Localstack says:
localstack | 2024-01-05T11:29:24.910 INFO --- [functhread10] l.s.k.kinesis_mock_server : kinesis.mock.ResourceNotFoundException: Unable to find record with provided SequenceNumber SequenceNumber(0) in stream Some(state-store-test-stream-8e44ffd7-b8ea-4a8e-b78a-d64d3d95fb4e)
Expected Behavior
The continuationSequenceNumber should be the highest sequence number reached, not 0 (a non-existent record).
How are you starting LocalStack?
With a docker-compose file
Steps To Reproduce
- Create a Kinesis Stream
- Put records to it
- Subscribe to it. Read records (note 0 continuationSequenceNumber)
- Put more records
- Subscribe to it again, using position of AFTER_SEQUENCE_NUMBER of 0. Get error due to invalid sequence number.
Environment
- OS: Ubuntu
- LocalStack: 3.0.5
- Java AWS SDK: 2.21.37
Anything else?
Cause
ContinuationSequenceNumber
is simply set to 0 and never updated when records are added:
https://github.com/localstack/localstack/blob/master/localstack/services/kinesis/provider.py#L136
In previous versions (eg 0.14.5) which worked, I think the number was derived from the records.
Versions
This wasn't in v0.14.5, but is in v3.0.5 and v2.3.2