Conversation
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Contributor
|
Please add integration test |
squiidz
approved these changes
Apr 22, 2026
DynamoDB BatchWriteItem API limits requests to 25 items. Previously, exceeding this limit caused a fallback to individual writes. Now batches are automatically chunked into groups of 25, with backoff reset between chunks. Two data-integrity paths are handled explicitly so a chunk failure cannot silently drop later items: * When a chunk's BatchWriteItem fails and the individual PutItem fallback recovers it, the loop now continues to the next chunk instead of returning nil early. * When a chunk's unprocessed-items retry budget is exhausted, the writer returns a service.BatchError that maps each still-unprocessed item back to its original batch index via reflect.DeepEqual, with a pessimistic whole-chunk-failed fallback if the SDK returns a shape we do not recognize. Items in unattempted later chunks are also marked failed so upstream retry targets only the unwritten items. Unit tests cover single-chunk happy path, multi-chunk happy path, individual-fallback continuation to the next chunk, global-index arithmetic for partial individual fallback in a non-zero chunk, the unprocessed-items BatchError path, and the pessimistic fallback when DeepEqual cannot match. An integration test against dynamodb-local exercises multi-chunk writes end to end. Closes #992 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
BatchWriteItemcalls into groups of 25 items per the DynamoDB API limit, instead of sending all items at once and falling back to expensive one-by-one writes on failureBatchErrorwhen a chunk fails, preventing silent data lossTest plan
go test ./internal/impl/aws/dynamodb/...)Closes #992
🤖 Generated with Claude Code