GoogleCloudPlatform / GoogleCloudPlatform/spring-cloud-gcp
DatastoreTransactionManager transaction propagation modes
- Dominant language
- Java
- Stars
- 551
- Forks
- 349
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 14
Description
[`DatastoreTransactionManager`](https://github.com/GoogleCloudPlatform/spring-cloud-gcp/blob/main/spring-cloud-gcp-data-datastore/src/main/java/com/google/cloud/spring/data/datastore/core/DatastoreTransactionManager.java#L68) only supports `TransactionDefinition.PROPAGATION_REQUIRED`.
Such limitations make it incompatible with e.g. [Spring Modulith](https://spring.io/projects/spring-modulith) which requires e.g. `@Transactional(propagation = Propagation.REQUIRES_NEW)` support.
The base class [`AbstractPlatformTransactionManager`](https://github.com/spring-projects/spring-framework/blob/main/spring-tx/src/main/java/org/springframework/transaction/support/AbstractPlatformTransactionManager.java#L89) already implements major handling of different propagation modes. Nested transactions are not handled, but are disabled by default.
I've reviewed the GCP SDK and Firestore in Datastore Mode API but couldn't find the reason for the mentioned condition in `DatastoreTransactionManager`.
We've [sketched and tested an implementation](https://github.com/bright/spring-modulith-gcp/blob/main/spring-gcp-datastore/src/main/java/pl/brightinventions/spring/datastore/DatastoreTransactionManager.java) that doesn't include the condition, and it seems to be working fine.
Can we get rid of this condition to support more propagation modes?
Contributor guide
Research direction
Start with spring-cloud-gcp-data-datastore/src/main/java/com/google/cloud/spring/data/datastore/core/DatastoreTransactionManager.java and inspect its PROPAGATION_REQUIRED condition. Compare it with AbstractPlatformTransactionManager and the linked tested implementation, then verify the transaction behavior for additional propagation modes such as REQUIRES_NEW while keeping nested transactions disabled by default. Done means the manager supports the requested propagation modes without breaking existing transaction behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- google-cloud, java, spring
- Domain
- backend, database
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100