fix: drain BatchGetItem paginator in async batchLoad to retry UnprocessedKeys#253
Merged
ThePumpingLemma merged 1 commit intoMay 12, 2026
Conversation
…ssedKeys The async path called `batchGetItem(request).limit(1).asFlow()`, which truncated the SDK auto-paginator to its first emission. Any keys returned in `UnprocessedKeys` (under throttling or on partial responses) were silently dropped — contradicting the KDoc on `AsyncLogicalDb.batchLoad` which promises that `UnprocessedKeys` are retried in follow-up calls. The sync path was already fixed in cashapp#176; this brings the async path to parity. Adds a `batchLoad more than 16MB` test that mirrors the sync suite and exercises the multi-page case. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
ThePumpingLemma
approved these changes
May 8, 2026
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
AsyncLogicalDb.batchLoad(andbatchLoadAsync) silently dropsUnprocessedKeysreturned by DynamoDB under throttling or partial-result conditions, contradicting the KDoc:The implementation called
dynamoDbEnhancedClient.batchGetItem(request).limit(1).asFlow().batchGetItemreturns aBatchGetResultPagePublisherwhose auto-paginator emits oneBatchGetResultPageper HTTP round-trip and continues issuing follow-upBatchGetItemcalls as long as the previous response hadUnprocessedKeys. The.limit(1)truncated this to the first page — so any keys returned inUnprocessedKeyson that first response were never retried, never decoded, and the caller never found out.Callers couldn't distinguish "key didn't exist" from "throttled and silently dropped." The sync
LogicalDb.batchLoadpath was already correct (it drains the full paginator iterator) and was independently fixed in #176; the async path was missed.This PR drops
.limit(1)and lets the paginator drain naturally. The suspend wrapper inAsyncLogicalDb.batchLoadalready accumulates across multipleItemSetemissions viareduce { acc, item -> ItemSet(acc.getAllItems() + item.getAllItems()) }, so removing.limit(1)composes correctly downstream.History
The
.limit(1)originated in #154, which convertedbatchLoadAsyncfrom a single-batch publisher (batchGetItem(batchRequests.first()).limit(1)) into chunked flows. The.limit(1)was carried forward from the original single-batch shape without re-evaluating against the SDK's paginator semantics.Test plan
batchLoad more than 16MBtest inAsyncLogicalDbBatchTest, mirroring the existing sync test inLogicalDbBatchTest. Generates ~20MB with 200KB descriptions to force the SDK paginator to issue follow-upBatchGetItemcalls forUnprocessedKeys.main(with.limit(1)in place) and passes with the fix.:tempest2:testsuite passes locally.🤖 Generated with Claude Code