Repository navigation
Conversation
…g them DynamoDBUtil.batch_write_requests ignored the unprocessed_items in each BatchWriteItem response, so throttled writes were lost without an error and init could report success with partial data. Retry unprocessed items, and batches rejected with ProvisionedThroughputExceededException, with jittered exponential backoff, one batch at a time so the write order is kept. Raise if items remain unprocessed after the retries. The retry budget matches the js-core DynamoDB store. SDK-3814
Store held @lock, which every evaluation takes to find the active store, for the whole of each persistent write in apply and commit. A slow write, such as DynamoDB retrying throttled items, blocked every evaluation for as long as it ran. Apply and commit now update or snapshot the memory store under @lock and write to the persistent store after releasing it. A new @write_lock, taken only by writers, serializes apply and commit, so changesets and their persistent writes keep their order and commit's snapshot cannot interleave with a changeset. SDK-3814
This branch has not been deployed
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.
Requirements
Related issues
SDK-3814. Found while reviewing the work for #504; it matters more once postfork children stop doing a full init.
Describe the solution you've provided
DynamoDBUtil.batch_write_requestscalledbatch_write_itemand ignored the response'sunprocessed_items. When DynamoDB throttled part of a batch, those writes were lost without an error, andinitcould write the$initedmarker and report success while the table held partial data.Each batch is now retried until DynamoDB accepts every item:
ProvisionedThroughputExceededExceptionis retried too, sharing the same budget. Other errors are raised as before.$initedlast).initand the store status report the failure.Retrying makes a write slow, so the second commit keeps it from blocking evaluations.
Storeheld@lock, which every evaluation takes to find the active store, for the whole of each persistent write inapplyandcommit. Both now update or snapshot the memory store under@lockand write to the persistent store after releasing it. A new@write_lock, taken only by writers, serializesapplyandcommit, so changesets and their writes keep their order. A slow write now delays later changesets, not evaluations.The new specs use the AWS SDK's stubbed client, so they run without DynamoDB. They fail without the fix.
Describe alternatives you've considered
Go (
go-server-sdk-dynamodbbatchWriteRequests) and Java (DynamoDbDataStoreImpl) also ignoreUnprocessedItems, so they are not a usable reference here. js-core'sDynamoDBClientState.batchWriteis the one SDK that handles it, and this follows its behaviour.Additional context
I did not run the DynamoDB integration specs against a local DynamoDB for this change; the stubbed-client specs cover the retry logic. python-server-sdk has the same bug, which is tracked separately.