Skip to content

Commit 4a5e71b

Browse files
authored
Merge branch 'main' into mux-rw-it
2 parents 37dd867 + e0a3e5b commit 4a5e71b

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

google-cloud-spanner/src/main/java/com/google/cloud/spanner/TransactionManagerImpl.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ public void commit() {
8181
txnState = TransactionState.COMMIT_FAILED;
8282
throw e2;
8383
} finally {
84-
// At this point, if the TransactionState is not ABORTED, then the transaction has reached a terminal state.
84+
// At this point, if the TransactionState is not ABORTED, then the transaction has reached an
85+
// end state.
8586
// We can safely call close() to release resources.
8687
if (getState() != TransactionState.ABORTED) {
8788
close();
@@ -98,7 +99,7 @@ public void rollback() {
9899
txn.rollback();
99100
} finally {
100101
txnState = TransactionState.ROLLED_BACK;
101-
// At this point, the TransactionState is ROLLED_BACK which is a terminal state.
102+
// At this point, the TransactionState is ROLLED_BACK which is an end state.
102103
// We can safely call close() to release resources.
103104
close();
104105
}

google-cloud-spanner/src/test/java/com/google/cloud/spanner/AsyncRunnerTest.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ public void testAsyncRunner_doesNotReturnCommitTimestampBeforeCommit() {
6363
AsyncRunner runner = client().runAsync();
6464
if (isMultiplexedSessionsEnabledForRW()) {
6565
Throwable e = assertThrows(Throwable.class, () -> runner.getCommitTimestamp().get());
66+
// If the error occurs within the future, it gets wrapped in an ExecutionException.
67+
// This happens when DelayedAsyncRunner is invoked while the multiplexed session is not yet
68+
// created.
69+
// If the error occurs before the future is created, it may throw an IllegalStateException
70+
// instead.
6671
assertTrue(e instanceof ExecutionException || e instanceof IllegalStateException);
6772
if (e instanceof ExecutionException) {
6873
Throwable cause = e.getCause();
@@ -83,6 +88,11 @@ public void testAsyncRunner_doesNotReturnCommitResponseBeforeCommit() {
8388
AsyncRunner runner = client().runAsync();
8489
if (isMultiplexedSessionsEnabledForRW()) {
8590
Throwable e = assertThrows(Throwable.class, () -> runner.getCommitResponse().get());
91+
// If the error occurs within the future, it gets wrapped in an ExecutionException.
92+
// This happens when DelayedAsyncRunner is invoked while the multiplexed session is not yet
93+
// created.
94+
// If the error occurs before the future is created, it may throw an IllegalStateException
95+
// instead.
8696
assertTrue(e instanceof ExecutionException || e instanceof IllegalStateException);
8797
if (e instanceof ExecutionException) {
8898
Throwable cause = e.getCause();
@@ -583,7 +593,7 @@ public void closeTransactionBeforeEndOfAsyncQuery() throws Exception {
583593
// Wait until at least one row has been fetched. At that moment there should be one session
584594
// checked out.
585595
dataReceived.await();
586-
if(!isMultiplexedSessionsEnabledForRW()) {
596+
if (!isMultiplexedSessionsEnabledForRW()) {
587597
assertThat(clientImpl.pool.getNumberOfSessionsInUse()).isEqualTo(1);
588598
}
589599
assertThat(res.isDone()).isFalse();

samples/snippets/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<dependency>
3535
<groupId>com.google.cloud</groupId>
3636
<artifactId>libraries-bom</artifactId>
37-
<version>26.53.0</version>
37+
<version>26.54.0</version>
3838
<type>pom</type>
3939
<scope>import</scope>
4040
</dependency>

0 commit comments

Comments
 (0)