Skip to content
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

feat(appsync): support for read consistency during DynamoDB reads #20793

Merged
merged 27 commits into from
Jul 21, 2022

Conversation

YichenQian09
Copy link
Contributor

@YichenQian09 YichenQian09 commented Jun 20, 2022


Motivation: DynamoDB uses eventually consistent reads unless you specify otherwise. Now the users cannot specify consistent read during DynamoDB reads. This commit allows users to set consistent read while creating resolvers.

Use case: To control the amount of replicas contacted during DynamoDB reads.

most salient design aspects:
Added an boolean parameter to the dynamoDbGetItem, dynamoDbScanTable and dynamoDbQuery methods in mapping-template.ts. Changed relative tests.

closes #5980


All Submissions:

Adding new Unconventional Dependencies:

  • This PR adds new unconventional dependencies following the process described here

New Features

I ran yarn tests. They include integration test snapshots for DynamoDB reads. Do I need to write a new integration test?

  • Have you added the new feature to an integration test?
    • Did you use yarn integ to deploy the infrastructure and generate the snapshot (i.e. yarn integ without --dry-run)?
      By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@gitpod-io
Copy link

gitpod-io bot commented Jun 20, 2022

@github-actions github-actions bot added the p2 label Jun 20, 2022
@aws-cdk-automation aws-cdk-automation requested a review from a team June 20, 2022 04:07
@indrora indrora self-assigned this Jun 27, 2022
@indrora
Copy link
Contributor

indrora commented Jun 27, 2022

Overall looks fine, but I'd rather see a test that shows that passing consistentRead = true in results in the change, not just changing all the calls to have true as their single argument.

w/r/t the README, as a nit: It might be nice to have a link to the documentation ( https://docs.aws.amazon.com/appsync/latest/devguide/resolver-mapping-template-reference-dynamodb.html ) on how resolver mappings work and how you're passing them under the hood.

Copy link
Contributor

@indrora indrora left a comment

Choose a reason for hiding this comment

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

I'd like to see at least in integ snapshots a test with none/true/false resolvers just for consistency across the full suite.

@YichenQian09
Copy link
Contributor Author

Thanks for your comment.
So I need to create integration tests with none/true/false resolvers? If it uses the consistentRead(set it to be true), then the read query will wait until all pending write queries have processed, it's difficult to test. I am a little confused how to show different results of different consistentRead values in tests.
Could you please give me some suggestions?

@mergify mergify bot dismissed indrora’s stale review July 1, 2022 02:26

Pull request has been modified.

@github-actions github-actions bot added effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p1 and removed p2 labels Jul 5, 2022
@kaizencc kaizencc changed the title feat(aws-appsync): support for read consistency during DynamoDB reads feat(appsync): support for read consistency during DynamoDB reads Jul 5, 2022
pahud
pahud previously requested changes Jul 19, 2022
Copy link
Contributor

@pahud pahud left a comment

Choose a reason for hiding this comment

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

I am not sure if we should remove the comments in the README. I am fine with either.

packages/@aws-cdk/aws-appsync/README.md Outdated Show resolved Hide resolved
@mergify mergify bot dismissed pahud’s stale review July 21, 2022 19:58

Pull request has been modified.

Copy link
Contributor

@indrora indrora left a comment

Choose a reason for hiding this comment

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

LGTM.

This covers every base and does a fantastic job of making sure it covers all the corner cases. 👍

@mergify
Copy link
Contributor

mergify bot commented Jul 21, 2022

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 669d3dd
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit 0b911ef into aws:main Jul 21, 2022
@mergify
Copy link
Contributor

mergify bot commented Jul 21, 2022

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

comcalvi pushed a commit to comcalvi/aws-cdk that referenced this pull request Jul 25, 2022
…s#20793)

----
Motivation: DynamoDB uses eventually consistent reads unless you specify otherwise. Now the users cannot specify consistent read during DynamoDB reads. This commit allows users to set consistent read while creating resolvers.

Use case: To control the amount of replicas contacted during DynamoDB reads.

most salient design aspects: 
Added an boolean parameter to the dynamoDbGetItem, dynamoDbScanTable and dynamoDbQuery methods in mapping-template.ts. Changed relative tests.

closes aws#5980

----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features
I ran yarn tests. They include integration test snapshots for DynamoDB reads. Do I need to write a new integration test?
* [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [x] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
josephedward pushed a commit to josephedward/aws-cdk that referenced this pull request Aug 30, 2022
…s#20793)

----
Motivation: DynamoDB uses eventually consistent reads unless you specify otherwise. Now the users cannot specify consistent read during DynamoDB reads. This commit allows users to set consistent read while creating resolvers.

Use case: To control the amount of replicas contacted during DynamoDB reads.

most salient design aspects: 
Added an boolean parameter to the dynamoDbGetItem, dynamoDbScanTable and dynamoDbQuery methods in mapping-template.ts. Changed relative tests.

closes aws#5980

----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features
I ran yarn tests. They include integration test snapshots for DynamoDB reads. Do I need to write a new integration test?
* [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [x] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AppSync L2: support for read consistency
5 participants