feat(aws): add DynamoDB Streams input component - #802
Conversation
Adds a new `aws_dynamodb_streams` input that natively consumes change data capture events from DynamoDB Streams. This resolves the inability to use `aws_kinesis` with DynamoDB Stream ARNs due to ARN format parsing issues. Ref: warpstreamlabs#303 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix ack function returning stale error instead of downstream result, which silently swallowed output errors and broke at-least-once guarantees - Use table name (stable) instead of stream ARN (changes on re-enable) as checkpoint key to prevent orphaned checkpoints - Use random shard selection when stealing from overloaded clients instead of always targeting the first shard - Pass explicit context to getShardIterator for consistency - Use FieldDuration directly instead of manual string parsing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Parent-child ordering: - Mark completed shards with a sentinel ClientID instead of deleting checkpoint entries, so child shards can verify parent completion - Build parent-child dependency graph from shard metadata on each rebalance cycle and skip children whose parents haven't completed - This prevents out-of-order delivery at shard split boundaries TrimmedDataAccessException on GetRecords: - Handle trimmed data errors during record fetching (not just iterator creation), which occurs when consumer lag exceeds 24h retention - Reset the iterator to the configured starting position on trim Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Wait for checkpoint table to become ACTIVE after creation, preventing errors on first startup when the table is still in CREATING state - Enable TTL on ExpiresAt attribute (best-effort) so completed shard entries auto-delete after 48 hours instead of accumulating forever - Set ExpiresAt on completed shard entries (48h, well beyond the 24h DynamoDB Streams retention window) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Not sure if it's better to reuse the Kinesis checkpointer and add a Dynamo-DB specific Complete method (as well as add TTL cleanup)
There was a problem hiding this comment.
Think I'd prefer this. The overlap between these two components is very high so I'd be in favour of wherever we can re-use functionality
Adds integration tests using LocalStack 3.0 (older versions don't return stream records). Tests cover basic CDC event consumption with payload and metadata verification, and checkpoint table creation with expected schema. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
gregfurman
left a comment
There was a problem hiding this comment.
Hey. Apologies for the delay here. Since this is a pretty large PR, it's non-trivial to review.
Do you think there's an opportunity here to create a common stream reader between this and the kinesis component that could perhaps alleviate a lot of this duplicated code?
Although more risky (since it'll be touching an otherwise widely used component), I'd be curious whether we could generalise the pattern we used out to other stream readers.
WDYT?
There was a problem hiding this comment.
Think I'd prefer this. The overlap between these two components is very high so I'd be in favour of wherever we can re-use functionality
Summary
Adds a new
aws_dynamodb_streamsinput that natively consumes change data capture (CDC) events from DynamoDB Streams.aws_dynamodb_streams— consumes CDC events with balanced shard assignment across multiple consumersdynamodb_table,dynamodb_stream_arn,dynamodb_shard_id,dynamodb_event_id,dynamodb_event_name,dynamodb_sequence_numbertableorstream_arn,checkpoint,start_from_oldest,batching, plus standard AWS session fields