[go: up one dir, main page]

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

[Spring Data Cloud Spanner] Add configuration to favour mutations or dml statements #660

Open
sebarthel89 opened this issue Oct 18, 2021 · 1 comment

Comments

@sebarthel89
Copy link

Spring data cloud spanner: add configuration to favour mutations or dml statements

Is your feature request related to a problem? Please describe.

Like stated in the spanner documenation (https://cloud.google.com/spanner/docs/dml-versus-mutations), it should avoided to uses mutations and dml statements in the same transaction. There is some behavior in Spring Data Cloud Spanner that

  • mutations are executed using dml statements by default
  • most of the times a transaction is created for the dml statement execution that causes nested transactions when a transaction content is open that is quite common because reads and updates should be executed in the same transaction to ensure data integrity

Describe the solution you'd like
From an application development, if there is no explicit need to execute a dml statement to make use of the benefits of dml statements vs mutations, it should be easy to use mutations if possible.

Because I can imagine that applications were already but around, and applications already use dml statements and mutations, maybe without even knowing, I want to request a configuration property, to control the default behavior of the execution of UPDATE, INSERT and DELETE queries.

suggestion:

spring.cloud.gcp.spanner.useMutationsOnly=true (default false)

Describe alternatives you've considered
Alternatives we are using right now is, to add custom methods to the Repository interface using the @Query annotation and set the dmlStatement to false.

Additional context
DML statements and mutations are 2 different APIs. By default, to reduce risk that comes with mixing mutation/query API. Also, engineers should be able to use the dml API if needed, but this is another API/Option they can slowly adopt. By executing dml statements although it's not explicitly visible, there are confusions about the execution path, nested transactions (transaction handling).

@mpeddada1 mpeddada1 added the type: enhancement New feature or request label Oct 18, 2021
@mpeddada1
Copy link
Contributor

Thanks for the suggestion. We will leave this open and look into this further.

prash-mi pushed a commit that referenced this issue Jun 20, 2023
Bumps [spring-boot-starter-parent](https://github.com/spring-projects/spring-boot) from 2.7.9 to 2.7.10.
- [Release notes](https://github.com/spring-projects/spring-boot/releases)
- [Commits](spring-projects/spring-boot@v2.7.9...v2.7.10)

---
updated-dependencies:
- dependency-name: org.springframework.boot:spring-boot-starter-parent
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants