Repository navigation
fix(spanner): show database value for unknown isolation levels - #14981
rayudu3745 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new method getDatabaseDefaultIsolationLevelValue() to DatabaseClient and its implementations to retrieve the raw string value of the default transaction isolation level. This allows handling unrecognized isolation levels (such as "read committed" in PostgreSQL) without throwing an exception. The feedback recommends adding @Nullable annotations to the overridden implementations of getDatabaseDefaultIsolationLevelValue() in DatabaseClientImpl and MultiplexedSessionDatabaseClient to match the interface definition. Additionally, it suggests wrapping the call to getDatabaseDefaultIsolationLevelValue() in ConnectionStatementExecutorImpl with Objects.requireNonNull to prevent potential null-safety warnings or runtime exceptions since the enclosing method returns a non-nullable string.
e051207 to
57d2d56
Compare
Fixes #14967.
If the database's
default_transaction_isolationholds a value that this client doesn't recognize, the PostgreSQL isolation levelSHOWstatements failed withFAILED_PRECONDITION. They now return the value that is stored in the database, so an older client keeps working with a database that uses a newer default isolation level.read committed)SHOW TRANSACTION ISOLATION LEVELFAILED_PRECONDITIONread committedSHOW transaction_isolationFAILED_PRECONDITIONread committedSHOW default_transaction_isolationFAILED_PRECONDITIONread committedChanges
DatabaseMetadatastores thedefault_transaction_isolationvalue as returned by Spanner, and derives the isolation level from it.@InternalApimethodDatabaseClient#getDatabaseDefaultIsolationLevelValue()returns that value.SHOWstatements return it when the isolation level isUNRECOGNIZED.