Skip to content

Implement support for ReturnValuesOnConditionCheckFailure #2688

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

Merged
merged 5 commits into from
Sep 7, 2021

Conversation

dagnir
Copy link
Contributor

@dagnir dagnir commented Aug 31, 2021

Motivation and Context

Fixes #2283

Description

This change gives customer the ability to specify
ReturnValuesOnConditionCheckFailure on the TransactWriteItems operation, i.e.
for PutItem, DeleteItem, UpdateItem, and ConditionCheck.

In order to support this feature, new Transact*EnhancedRequest objects have been
introduced because ReturnValuesOnConditionCheckFailure does not make any sense
for the non-TransactWrite operations. Conversely, other options on the
non-transact versions like ReturnConsumedCapacity do not make sense for the
Transact* versions.

As a result of "splitting" off the TransactWrite versions of the operations, the
methods on TransactWriteItemsEnhancedRequest that take the non-transact versions
have been deprecated.

Testing

  • New unit tests

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have read the README document
  • I have added tests to cover my changes
  • All new and existing tests passed
  • A short description of the change has been added to the CHANGELOG
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

@dagnir dagnir force-pushed the ddb-enhanced-returnvalues branch 7 times, most recently from 96aa329 to efb4816 Compare August 31, 2021 17:37
@dagnir dagnir changed the title WIP ReturnValuesOnConditionCheckFailure Implement support for ReturnValuesOnConditionCheckFailure Aug 31, 2021
@dagnir dagnir force-pushed the ddb-enhanced-returnvalues branch 8 times, most recently from c58acda to c57df6d Compare August 31, 2021 23:04
This change gives customer the ability to specify
ReturnValuesOnConditionCheckFailure on the TransactWriteItems operation, i.e.
for PutItem, DeleteItem, UpdateItem, and ConditionCheck.

In order to support this feature, new Transact*EnhancedRequest objects have been
introduced because ReturnValuesOnConditionCheckFailure does not make any sense
for the non-TransactWrite operations. Conversely, other options on the
non-transact versions like ReturnConsumedCapacity do not make sense for the
Transact* versions.

As a result of "splitting" off the TransactWrite versions of the operations, the
methods on TransactWriteItemsEnhancedRequest that take the non-transact versions
have been deprecated.

Fixes aws#2283
@dagnir dagnir force-pushed the ddb-enhanced-returnvalues branch from c57df6d to ec5b871 Compare August 31, 2021 23:56
@dagnir dagnir marked this pull request as ready for review September 1, 2021 00:06
@dagnir
Copy link
Contributor Author

dagnir commented Sep 1, 2021

Duplication failure is expected; it's flagging the duplication of the returnValuesOnConditionCheckFailure setters/getters :(.

Comment on lines +98 to +99
* {@link ReturnValuesOnConditionCheckFailure#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #returnValuesOnConditionCheckFailureAsString}.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: This Javadoc seems to be somewhat redundantly referring to itself.

try {
enhancedClient.transactWriteItems(transactWriteItemsEnhancedRequest);
fail("Expected TransactionCanceledException to be thrown");
} catch(TransactionCanceledException e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Recommend using assertThatExceptionOfType(..) instead.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Sep 3, 2021

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

98.3% 98.3% Coverage
13.7% 13.7% Duplication

@dagnir dagnir merged commit 023ebb4 into aws:master Sep 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DynamoDbEnhancedClient transaction write missing support for return values
3 participants