-
Notifications
You must be signed in to change notification settings - Fork 1.1k
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect behavior when doing BatchWriteItem() of GetUnprocessedItems() #358
Comments
The issue turns out that the vector allocated to hold the results is begin initialized with empty values followed by pushing the new values. I believe what's meant was to reserve the vector or use the [] operator to insert at the specified indexes. but the code is doing both resulting in twice the # of elements to be inserted where the first half are nulls because of the initialization. The line below will create a vector of size = GetLength() Following this, is https://github.com/aws/aws-sdk-cpp/blob/master/aws-cpp-sdk-dynamodb/source/model/BatchWriteItemResult.cpp#L48 which will push_back the new entries on top of the allocated empty entries. |
I did some grepping and found other potential bugs waiting to happen because of the same pattern.
|
We'll get the generator fixed today and a release out tomorrow. |
Cool. I submitted a pr that fixes it by calling reserve() explicitly or if you want to fix it by replacing push_back with [] that also works. |
We applied your change to the code generator and it should be fixed in yesterday's release. Please reopen if we missed something. |
Would you like me to submit a PR for the other ones mentioned as well? |
No need, all of that code is actually generated, so applying your fix to the codegen template (see lines 64-65 of https://github.com/aws/aws-sdk-cpp/blob/master/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/json/ModelInternalMapOrListJsonDeserializer.vm) should fix everything. |
Oh got it. |
Hi, Thank you! |
When I do a BatchWriteItem and the result has unprocessed items, I try to resend them but the ones that succeeded show up as nulls in the next request.
Here's how the data shows up on the wire:
initial request
response
Second request to send the unprocessed items (notice the nulls in the beginning)
The code behind this:
The text was updated successfully, but these errors were encountered: