aws / aws/aws-sdk-java-v2

Optimistic Locking while using Enhanced DDB Client - DeleteItem not working

Open
#2,358 9 comments 0 reactions 0 assignees View on GitHub
bug dynamodb-enhanced hacktoberfest p2
Dominant language
Java
Stars
2.6k
Forks
1k
Avg merge
2d 9h
Merged PRs (30d)
51

Description

## Describe the issue

Need to upgrade SDK version to 2 for DDB client. I want to understand how to enforce optimistic locking while doing CRUD operation by enhanced DDB client. I am already using @DynamoDbVersionAttribute annotation.

## Steps to Reproduce

1. Insert item using TransactWriteItemsEnhancedRequest - PutItem.
2. Fetch the item using table.getItem(GetItemEnhancedRequest). (recordVersion would be 1)
3. Update one field of item using TransactWriteItemsEnhancedRequest - UpdateItem. (recordVersion will updated to 2 in the DDB.)
4. Delete item using TransactWriteItemsEnhancedRequest - DeleteItem but use object fetched from Step 2 for deletion.

## Current Behavior

Item is deleted successfully without any exception for record number mismatch.

## Your Environment

* AWS Java SDK version used: 2
* JDK version used: 11
* Operating System and version: macOS 10.15.7

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.