Skip to content

DyanamoDB BatchWriteItem missing item writes when run in goroutines #2887

Closed
@kartheekDogga

Description

@kartheekDogga

Acknowledgements

Describe the bug

I am trying to migrate some data from one dynamoDB table to another table with some item level mutation.
For this, I am reading the parent table iteratively using Scan and passing the items into a channel after modifying them.

I am writing the items into the target table using BatchWriteItems wrapped in go routines. I used a workerpool from the conc pkg to limit 5 go routines at any point of time.

The problem I am seeing is, the write succeeds but when I get the "Live Iitem Count" for the table, there are some items missing. The number of missing items is sporadic, ranging from ~100 to ~400 when the total payload size is 5000 (batched parallelly into 25 per set)

I am also checking for UnprocessedItems, which is ALWAYS empty.

Additional Details: The table is PAY_ON_DEMAND

here's the code for write operations:

``

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

Live Item Count Should match total Items written in a fresh Table

Current Behavior

some Items are missing from BatchWriteItems operation with nil error and empty UnprocessedItems

Reproduction Steps

Here's a sample code
https://raw.githubusercontent.com/kartheekDogga/kartheekDogga/refs/heads/main/sample.go

steps:

  • create a test table with pay_on_demand
  • Write items into table using batchwriteitems, with added concurrency using go routines

Possible Solution

No response

Additional Information/Context

Sample code:
https://raw.githubusercontent.com/kartheekDogga/kartheekDogga/refs/heads/main/sample.go

AWS Go SDK V2 Module Versions Used

github.com/aws/aws-sdk-go-v2 v1.32.3
github.com/aws/aws-sdk-go-v2/config v1.28.1
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.36.3

Compiler and Version used

1.22

Operating System and version

22.04.3 LTS (GNU/Linux 5.15.153.1-microsoft-standard-WSL2 x86_64)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.needs-triageThis issue or PR still needs to be triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions