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

Support disabling consistent read on per @Query #9

Closed
dragneelfps opened this issue Jan 21, 2020 · 9 comments
Closed

Support disabling consistent read on per @Query #9

dragneelfps opened this issue Jan 21, 2020 · 9 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@dragneelfps
Copy link

Expected Behavior

We should be able to disable consistent read behaviour on per query basis, instead of having to use a custom repository.
This feature is helpful for queries on GSI as they dont support consistent reads.

Actual Behavior

Either disable it for all using dynamodb mapper config or use custom repositories.

Specifications

  • Spring Data DynamoDB Version: 5.1.0
  • Spring Data Version: 2.2.3.Release
  • AWS SDK Version: 1.11.443
  • Java Version: openjdk version "11.0.5" 2019-10-15
  • Platform Details: Macbook Pro mid-2018
@dragneelfps
Copy link
Author

derjust#276

@boostchicken
Copy link
Owner

boostchicken commented Jan 25, 2020

164de98

Live on 5.2.2-SNAPSHOT on ossrh

@Query(consistentReads = QueryConstants.ConsistentReadMode.CONSISTENT)
Optional<User> findById(String id);

Default does whatever the mapper has configured and is the default. Other keys are self explanatory.

Leaving issue open for comments / suggestions

@boostchicken boostchicken self-assigned this Jan 25, 2020
@boostchicken boostchicken added the enhancement New feature or request label Jan 25, 2020
@boostchicken boostchicken added this to the 5.2.2 milestone Jan 25, 2020
@boostchicken boostchicken added this to In progress in Spring Data DynamoDB Jan 25, 2020
@boostchicken boostchicken moved this from In progress to In Testing in Spring Data DynamoDB Jan 25, 2020
@boostchicken
Copy link
Owner

@dragneelfps you get a chance to look at it?

@dragneelfps
Copy link
Author

@boostchicken do you have any plans on creating a PR for the parent repository of derkjust.

Ill look into the changes and report back as soon as possible.

@dragneelfps
Copy link
Author

@boostchicken instead of having an enum, can't we have a boolean as the original private Boolean consistentRead; in QueryRequest is a boolean?? I think this will be more consistent behavior.

@boostchicken
Copy link
Owner

boostchicken commented Jan 29, 2020

The problem with this is you have to put it on every annotation. Annotations can't have null values, they just have a default. By putting it to an enum we can have it be a default value which means change nothing. If we were to have an Boolean it would require you to adjust every query annotation and break the API significantly.

@dragneelfps
Copy link
Author

Valid point.
But just a thought shower, how about

boolean consistentReads() default true;
boolean override() default false;

@boostchicken
Copy link
Owner

I think its a little more verbose and confusing, only one annotation argument should be required. Also, a lot of people may never want to default to true or false. The default setting makes a lot of sense in my book

@boostchicken
Copy link
Owner

Released in 5.2.2

@boostchicken boostchicken moved this from In Testing to Done in Spring Data DynamoDB Feb 25, 2020
@boostchicken boostchicken moved this from Done to Released in Spring Data DynamoDB Jun 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

No branches or pull requests

2 participants