Skip to content

feat: support isolation level repeatable read#1973

Merged
olavloite merged 1 commit intomainfrom
isolation-level-repeatable-read
Apr 3, 2025
Merged

feat: support isolation level repeatable read#1973
olavloite merged 1 commit intomainfrom
isolation-level-repeatable-read

Conversation

@olavloite
Copy link
Collaborator

Adds support for setting the transaction isolation level to repeatable read.

Adds support for setting the transaction isolation level to repeatable read.
@olavloite olavloite requested a review from a team April 1, 2025 08:31
@product-auto-label product-auto-label bot added size: l Pull request size is large. api: spanner Issues related to the googleapis/java-spanner-jdbc API. labels Apr 1, 2025
// There is no 'unspecified' isolation level in JDBC, so we convert this to the default
// SERIALIZABLE isolation level in Spanner.
assertEquals(
Connection.TRANSACTION_SERIALIZABLE,

Choose a reason for hiding this comment

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

Is there a specific reason we're defaulting to the Serialization isolation level when the Spanner isolation level isn't specified?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, the reason is the following:

  1. JDBC requires us to always return an actual isolation level (so for example serializable). JDBC does not have anything like an 'unspecified isolation level'.
  2. Spanner supports ISOLATION_LEVEL_UNSPECIFIED and this is the default that we are using in the Java client library. It basically means 'Spanner should use its own default'. At the moment, as a user, you cannot configure a default. So this means the default is always serializable.
  3. We use this method to convert the isolation level specified in the Spanner client library to the JDBC spec. As the Spanner client library can return ISOLATION_LEVEL_UNSPECIFIED and JDBC does not have an equivalent, we have to convert it to one of the actual isolation levels. And the only logical choice is then to return serializable, as that is the isolation level that Spanner will be using when you use ISOLATION_LEVEL_UNSPECIFIED.

@olavloite olavloite merged commit 010a502 into main Apr 3, 2025
22 checks passed
@olavloite olavloite deleted the isolation-level-repeatable-read branch April 3, 2025 07:09
gcf-merge-on-green bot pushed a commit that referenced this pull request Apr 22, 2025
🤖 I have created a release *beep* *boop*
---


## [2.29.0](https://togithub.com/googleapis/java-spanner-jdbc/compare/v2.28.0...v2.29.0) (2025-04-22)


### Features

* Support isolation level repeatable read ([#1973](https://togithub.com/googleapis/java-spanner-jdbc/issues/1973)) ([010a502](https://togithub.com/googleapis/java-spanner-jdbc/commit/010a502310db88f8c676960c641a7e9a6581bf11))


### Dependencies

* Update dependency com.google.cloud:google-cloud-spanner-bom to v6.90.0 ([#1970](https://togithub.com/googleapis/java-spanner-jdbc/issues/1970)) ([7153c39](https://togithub.com/googleapis/java-spanner-jdbc/commit/7153c39464fd9b83609bb7cc2ada5c0f9aab3af8))
* Update dependency com.google.cloud:google-cloud-spanner-bom to v6.91.1 ([#1993](https://togithub.com/googleapis/java-spanner-jdbc/issues/1993)) ([97d4840](https://togithub.com/googleapis/java-spanner-jdbc/commit/97d4840bd3e7cee7f1ddb9b26f3946f1b10ed894))
* Update dependency com.google.cloud:sdk-platform-java-config to v3.46.0 ([#1992](https://togithub.com/googleapis/java-spanner-jdbc/issues/1992)) ([ea0b557](https://togithub.com/googleapis/java-spanner-jdbc/commit/ea0b55729d1bf9e8b5994758314841591ea0c883))
* Update dependency io.opentelemetry:opentelemetry-bom to v1.49.0 ([#1982](https://togithub.com/googleapis/java-spanner-jdbc/issues/1982)) ([6b7ddf4](https://togithub.com/googleapis/java-spanner-jdbc/commit/6b7ddf4352d4db87eab6d9f3fd4945e5650e7798))
* Update dependency org.springframework.data:spring-data-bom to v2024.1.5 ([#1995](https://togithub.com/googleapis/java-spanner-jdbc/issues/1995)) ([6bedf12](https://togithub.com/googleapis/java-spanner-jdbc/commit/6bedf124b9da233e6f4001dff2c1b56f0249aaad))

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: spanner Issues related to the googleapis/java-spanner-jdbc API. size: l Pull request size is large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants