Will a Lambda connected to a DynamoDB stream ever send 2 batches that have a different set of records in them but one or more records in common?
e.g. Let's say we have a DynamoDB table with a partition key called name but no sort key and we perform the following operations.
- Put item {"name":"alpha"}
- Put item {"name":"bravo"}
- Put item {"name":"charlie"}
I know the DynamoDB / Lambda integration may invoke the Lambda with something like this if there are timeouts:
- [{"newImage":{"name":"alpha"},"eventId":"01"},{"newImage":{"name":"bravo"},"eventId":"02"}]
- [{"newImage":{"name":"alpha"},"eventId":"01"},{"newImage":{"name":"bravo"},"eventId":"02"}]
- [{"newImage":{"name":"charlie"},"eventId":"03"}]
But could the Lambda handler ever perform this sequence of invocations where the bravo record is present in two different Lambda invocations but one is present with the alpha and the other is present with the charlie?
- [{"newImage":{"name":"alpha"},"eventId":"01"},{"newImage":{"name":"bravo"},"eventId":"02"}]
- [{"newImage":{"name":"bravo"},"eventId":"02"},{"newImage":{"name":"charlie"},"eventId":"03"}]
If you have enabled bisect batch on error then yes it possible, otherwise no it's not expected.
https://aws.amazon.com/about-aws/whats-new/2019/11/aws-lambda-supports-failure-handling-features-for-kinesis-and-dynamodb-event-sources/