Skip to content

Commit 197415f

Browse files
authored
Merge branch 'main' into x-goog-spanner-request-id-setup-e2e-expectations
2 parents 3e7e9e7 + 5651f61 commit 197415f

File tree

4 files changed

+108
-2
lines changed

4 files changed

+108
-2
lines changed

.github/release-please.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,7 @@ branches:
4646
bumpMinorPreMajor: true
4747
handleGHRelease: true
4848
branch: 6.88.x
49+
- releaseType: java-backport
50+
bumpMinorPreMajor: true
51+
handleGHRelease: true
52+
branch: 6.96.x

.github/sync-repo-settings.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,27 @@ branchProtectionRules:
182182
- units-with-multiplexed-session (11)
183183
- unmanaged_dependency_check
184184
- library_generation
185+
- pattern: 6.96.x
186+
isAdminEnforced: true
187+
requiredApprovingReviewCount: 1
188+
requiresCodeOwnerReviews: true
189+
requiresStrictStatusChecks: false
190+
requiredStatusCheckContexts:
191+
- dependencies (17)
192+
- lint
193+
- javadoc
194+
- units (8)
195+
- units (11)
196+
- 'Kokoro - Test: Integration'
197+
- 'Kokoro - Test: Integration with Multiplexed Sessions'
198+
- cla/google
199+
- checkstyle
200+
- compile (8)
201+
- compile (11)
202+
- units-with-multiplexed-session (8)
203+
- units-with-multiplexed-session (11)
204+
- unmanaged_dependency_check
205+
- library_generation
185206
permissionRules:
186207
- team: yoshi-admins
187208
permission: admin

google-cloud-spanner/src/main/java/com/google/cloud/spanner/spi/v1/GapicSpannerRpc.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,6 @@ public GapicSpannerRpc(final SpannerOptions options) {
344344
InstantiatingGrpcChannelProvider.newBuilder()
345345
.setChannelConfigurator(options.getChannelConfigurator())
346346
.setEndpoint(options.getEndpoint())
347-
.setMaxInboundMessageSize(MAX_MESSAGE_SIZE)
348-
.setMaxInboundMetadataSize(MAX_METADATA_SIZE)
349347
.setPoolSize(options.getNumChannels())
350348

351349
// Set a keepalive time of 120 seconds to help long running
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.cloud.spanner;
18+
19+
import static com.google.cloud.spanner.testing.EmulatorSpannerHelper.isUsingEmulator;
20+
import static com.google.common.truth.Truth.assertThat;
21+
import static org.junit.Assert.assertTrue;
22+
import static org.junit.Assume.assumeFalse;
23+
24+
import org.junit.ClassRule;
25+
import org.junit.Test;
26+
import org.junit.experimental.categories.Category;
27+
import org.junit.runner.RunWith;
28+
import org.junit.runners.JUnit4;
29+
30+
@Category(ParallelIntegrationTest.class)
31+
@RunWith(JUnit4.class)
32+
public class ITTransactionRetryTest {
33+
34+
@ClassRule public static IntegrationTestEnv env = new IntegrationTestEnv();
35+
36+
@Test
37+
public void TestRetryInfo() {
38+
assumeFalse("emulator does not support parallel transaction", isUsingEmulator());
39+
40+
// Creating a database with the table which contains INT64 columns
41+
Database db =
42+
env.getTestHelper()
43+
.createTestDatabase("CREATE TABLE Test(ID INT64, " + "EMPID INT64) PRIMARY KEY (ID)");
44+
DatabaseClient databaseClient = env.getTestHelper().getClient().getDatabaseClient(db.getId());
45+
46+
// Inserting one row
47+
databaseClient
48+
.readWriteTransaction()
49+
.run(
50+
transaction -> {
51+
transaction.buffer(
52+
Mutation.newInsertBuilder("Test").set("ID").to(1).set("EMPID").to(1).build());
53+
return null;
54+
});
55+
56+
int numRetries = 10;
57+
boolean isAbortedWithRetryInfo = false;
58+
while (numRetries-- > 0) {
59+
try (TransactionManager transactionManager1 = databaseClient.transactionManager()) {
60+
try (TransactionManager transactionManager2 = databaseClient.transactionManager()) {
61+
try {
62+
TransactionContext transaction1 = transactionManager1.begin();
63+
TransactionContext transaction2 = transactionManager2.begin();
64+
transaction1.executeUpdate(
65+
Statement.of("UPDATE Test SET EMPID = EMPID + 1 WHERE ID = 1"));
66+
transaction2.executeUpdate(
67+
Statement.of("UPDATE Test SET EMPID = EMPID + 1 WHERE ID = 1"));
68+
transactionManager1.commit();
69+
transactionManager2.commit();
70+
} catch (AbortedException abortedException) {
71+
assertThat(abortedException.getErrorCode()).isEqualTo(ErrorCode.ABORTED);
72+
if (abortedException.getRetryDelayInMillis() > 0) {
73+
isAbortedWithRetryInfo = true;
74+
break;
75+
}
76+
}
77+
}
78+
}
79+
}
80+
81+
assertTrue("Transaction is not aborted with the trailers", isAbortedWithRetryInfo);
82+
}
83+
}

0 commit comments

Comments
 (0)