Is there a possibility to use read-only transactions with Spring Data R2DBC and especially with Google Spanner DB Backend? RO-transactions are supported in the Spanner R2DBC driver and offer much scalability advantage (no locking!). However, it is not R2DBC standard and I haven't found any support for this in the Spring Data R2DBC documentation.
Asked
Active
Viewed 378 times
0
-
1Hmm good question. Looks like if you're able to access the R2DBC connection object, you'll be able to downcast it to `SpannerConnection` and be able to specify a custom transaction type in the overloaded `beginTransaction(TransactionOptions o)`: https://github.com/GoogleCloudPlatform/cloud-spanner-r2dbc/blob/master/cloud-spanner-r2dbc/src/main/java/com/google/cloud/spanner/r2dbc/SpannerConnection.java#L85 I'm not sure how to access this from Spring Data R2DBC though... will do some research. – CowZow Mar 01 '21 at 19:43
1 Answers
2
Based on my research it looks like this is not possible yet.
I filed a feature request asking to support extended features in Spring Data R2DBC here: https://github.com/GoogleCloudPlatform/cloud-spanner-r2dbc/issues/314
The goal will be to allow you to make read only transactions using the Transaction annotation, like:
@Transactional(readonly = true)
public void readAndSaveRecords(..) {
}

CowZow
- 1,275
- 2
- 17
- 36