Skip to content

Commit affcbdc

Browse files
authored
Merge branch 'main' into last-statement-sample
2 parents 747f4f3 + 53bc510 commit affcbdc

File tree

71 files changed

+2061
-729
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+2061
-729
lines changed

.github/workflows/hermetic_library_generation.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
with:
3838
fetch-depth: 0
3939
token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}
40-
- uses: googleapis/sdk-platform-java/.github/scripts@v2.57.0
40+
- uses: googleapis/sdk-platform-java/.github/scripts@v2.58.0
4141
if: env.SHOULD_RUN == 'true'
4242
with:
4343
base_ref: ${{ github.base_ref }}

.github/workflows/unmanaged_dependency_check.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ jobs:
1717
# repository
1818
.kokoro/build.sh
1919
- name: Unmanaged dependency check
20-
uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v3.47.0
20+
uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v3.48.0
2121
with:
2222
bom-path: google-cloud-spanner-bom/pom.xml

.kokoro/presubmit/graalvm-native-a.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Configure the docker image for kokoro-trampoline.
44
env_vars: {
55
key: "TRAMPOLINE_IMAGE"
6-
value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.47.0" # {x-version-update:google-cloud-shared-dependencies:current}
6+
value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.48.0" # {x-version-update:google-cloud-shared-dependencies:current}
77
}
88

99
env_vars: {

.kokoro/presubmit/graalvm-native-b.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Configure the docker image for kokoro-trampoline.
44
env_vars: {
55
key: "TRAMPOLINE_IMAGE"
6-
value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.47.0" # {x-version-update:google-cloud-shared-dependencies:current}
6+
value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.48.0" # {x-version-update:google-cloud-shared-dependencies:current}
77
}
88

99
env_vars: {

.kokoro/presubmit/graalvm-native-c.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Configure the docker image for kokoro-trampoline.
44
env_vars: {
55
key: "TRAMPOLINE_IMAGE"
6-
value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_c:3.47.0" # {x-version-update:google-cloud-shared-dependencies:current}
6+
value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_c:3.48.0" # {x-version-update:google-cloud-shared-dependencies:current}
77
}
88

99
env_vars: {

.kokoro/presubmit/samples.cfg

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Configure the docker image for kokoro-trampoline.
4+
env_vars: {
5+
key: "TRAMPOLINE_IMAGE"
6+
value: "gcr.io/cloud-devrel-kokoro-resources/java8"
7+
}
8+
9+
env_vars: {
10+
key: "JOB_TYPE"
11+
value: "samples"
12+
}
13+
14+
# TODO: remove this after we've migrated all tests and scripts
15+
env_vars: {
16+
key: "GCLOUD_PROJECT"
17+
value: "gcloud-devel"
18+
}
19+
20+
env_vars: {
21+
key: "GOOGLE_CLOUD_PROJECT"
22+
value: "gcloud-devel"
23+
}
24+
25+
env_vars: {
26+
key: "GOOGLE_APPLICATION_CREDENTIALS"
27+
value: "secret_manager/java-it-service-account"
28+
}
29+
30+
env_vars: {
31+
key: "SECRET_MANAGER_KEYS"
32+
value: "java-it-service-account"
33+
}
34+
35+
env_vars: {
36+
key: "ENABLE_BUILD_COP"
37+
value: "true"
38+
}

CHANGELOG.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,49 @@
11
# Changelog
22

3+
## [6.94.0](https://github.com/googleapis/java-spanner/compare/v6.93.0...v6.94.0) (2025-05-21)
4+
5+
6+
### Features
7+
8+
* Add throughput_mode to UpdateDatabaseDdlRequest to be used by Spanner Migration Tool. See https://github.com/GoogleCloudPlatform/spanner-migration-tool ([3070f1d](https://github.com/googleapis/java-spanner/commit/3070f1db97788c2a55c553ab8a4de3419d1ccf5c))
9+
10+
11+
### Bug Fixes
12+
13+
* **deps:** Update the Java code generator (gapic-generator-java) to 2.58.0 ([3070f1d](https://github.com/googleapis/java-spanner/commit/3070f1db97788c2a55c553ab8a4de3419d1ccf5c))
14+
* Remove trailing semicolons in DDL ([#3879](https://github.com/googleapis/java-spanner/issues/3879)) ([ca3a67d](https://github.com/googleapis/java-spanner/commit/ca3a67db715f398943382df1f8a9979905811ff8))
15+
16+
17+
### Dependencies
18+
19+
* Update dependency com.google.cloud:sdk-platform-java-config to v3.48.0 ([#3869](https://github.com/googleapis/java-spanner/issues/3869)) ([afa17f7](https://github.com/googleapis/java-spanner/commit/afa17f73beab80639467916bc73b5c96305093aa))
20+
* Update dependency com.google.cloud:sdk-platform-java-config to v3.48.0 ([#3880](https://github.com/googleapis/java-spanner/issues/3880)) ([f3b00b6](https://github.com/googleapis/java-spanner/commit/f3b00b663aa897fda1bc21222d29726e6be630cb))
21+
* Update dependency com.google.cloud.opentelemetry:exporter-metrics to v0.34.0 ([#3861](https://github.com/googleapis/java-spanner/issues/3861)) ([676b14f](https://github.com/googleapis/java-spanner/commit/676b14f916dea783b40ddec4061bd7af157b5d98))
22+
* Update dependency commons-io:commons-io to v2.19.0 ([#3863](https://github.com/googleapis/java-spanner/issues/3863)) ([80a6af8](https://github.com/googleapis/java-spanner/commit/80a6af836ca29ec196a2f509831e1d36c557168f))
23+
* Update dependency io.opentelemetry:opentelemetry-bom to v1.50.0 ([#3865](https://github.com/googleapis/java-spanner/issues/3865)) ([ae63050](https://github.com/googleapis/java-spanner/commit/ae6305089b394be0c1eaf8ff7e188711288d87ad))
24+
* Update googleapis/sdk-platform-java action to v2.58.0 ([#3870](https://github.com/googleapis/java-spanner/issues/3870)) ([d1e45fa](https://github.com/googleapis/java-spanner/commit/d1e45fa88bb005529bcfb2a6ff2df44065be0fd2))
25+
* Update opentelemetry.version to v1.50.0 ([#3866](https://github.com/googleapis/java-spanner/issues/3866)) ([f7e09b8](https://github.com/googleapis/java-spanner/commit/f7e09b8148c0e51503255694bd3347c637724b34))
26+
27+
28+
### Documentation
29+
30+
* Add samples for unnamed (positional) parameters ([#3849](https://github.com/googleapis/java-spanner/issues/3849)) ([035cadd](https://github.com/googleapis/java-spanner/commit/035cadd5bb77a8f9f6fb25ac8c8e5a3e186d9a22))
31+
32+
## [6.93.0](https://github.com/googleapis/java-spanner/compare/v6.92.0...v6.93.0) (2025-05-09)
33+
34+
35+
### Features
36+
37+
* Enable AFE and gRPC metrics for DP ([#3852](https://github.com/googleapis/java-spanner/issues/3852)) ([203baae](https://github.com/googleapis/java-spanner/commit/203baae3996378435095cb90e3b2c7ee71a643cd))
38+
39+
40+
### Bug Fixes
41+
42+
* Change server timing duration attribute to float as per w3c ([#3851](https://github.com/googleapis/java-spanner/issues/3851)) ([da8dd8d](https://github.com/googleapis/java-spanner/commit/da8dd8da3171a073d7b450d4413936351a4c1060))
43+
* **deps:** Update the Java code generator (gapic-generator-java) to 2.57.0 ([23b985c](https://github.com/googleapis/java-spanner/commit/23b985c9a04837b0b38f2cfc5d96469e1d664d67))
44+
* Non-ASCII Unicode characters in code ([#3844](https://github.com/googleapis/java-spanner/issues/3844)) ([85a0820](https://github.com/googleapis/java-spanner/commit/85a0820505889ae6482a9e4f845cd53430dd6b44))
45+
* Only close and return sessions once ([#3846](https://github.com/googleapis/java-spanner/issues/3846)) ([32b2373](https://github.com/googleapis/java-spanner/commit/32b2373d62cac3047d9686c56af278c706d7c488))
46+
347
## [6.92.0](https://github.com/googleapis/java-spanner/compare/v6.91.1...v6.92.0) (2025-04-29)
448

549

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
1919
<dependency>
2020
<groupId>com.google.cloud</groupId>
2121
<artifactId>libraries-bom</artifactId>
22-
<version>26.57.0</version>
22+
<version>26.60.0</version>
2323
<type>pom</type>
2424
<scope>import</scope>
2525
</dependency>
@@ -41,28 +41,28 @@ If you are using Maven without the BOM, add this to your dependencies:
4141
<dependency>
4242
<groupId>com.google.cloud</groupId>
4343
<artifactId>google-cloud-spanner</artifactId>
44-
<version>6.89.0</version>
44+
<version>6.93.0</version>
4545
</dependency>
4646

4747
```
4848

4949
If you are using Gradle 5.x or later, add this to your dependencies:
5050

5151
```Groovy
52-
implementation platform('com.google.cloud:libraries-bom:26.59.0')
52+
implementation platform('com.google.cloud:libraries-bom:26.61.0')
5353
5454
implementation 'com.google.cloud:google-cloud-spanner'
5555
```
5656
If you are using Gradle without BOM, add this to your dependencies:
5757

5858
```Groovy
59-
implementation 'com.google.cloud:google-cloud-spanner:6.92.0'
59+
implementation 'com.google.cloud:google-cloud-spanner:6.94.0'
6060
```
6161

6262
If you are using SBT, add this to your dependencies:
6363

6464
```Scala
65-
libraryDependencies += "com.google.cloud" % "google-cloud-spanner" % "6.92.0"
65+
libraryDependencies += "com.google.cloud" % "google-cloud-spanner" % "6.94.0"
6666
```
6767

6868
## Authentication
@@ -575,6 +575,7 @@ Samples are in the [`samples/`](https://github.com/googleapis/java-spanner/tree/
575575
| Tag Sample | [source code](https://github.com/googleapis/java-spanner/blob/main/samples/snippets/src/main/java/com/example/spanner/TagSample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-spanner&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/spanner/TagSample.java) |
576576
| Tracing Sample | [source code](https://github.com/googleapis/java-spanner/blob/main/samples/snippets/src/main/java/com/example/spanner/TracingSample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-spanner&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/spanner/TracingSample.java) |
577577
| Transaction Timeout Example | [source code](https://github.com/googleapis/java-spanner/blob/main/samples/snippets/src/main/java/com/example/spanner/TransactionTimeoutExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-spanner&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/spanner/TransactionTimeoutExample.java) |
578+
| Unnamed Parameters Example | [source code](https://github.com/googleapis/java-spanner/blob/main/samples/snippets/src/main/java/com/example/spanner/UnnamedParametersExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-spanner&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/spanner/UnnamedParametersExample.java) |
578579
| Update Backup Schedule Sample | [source code](https://github.com/googleapis/java-spanner/blob/main/samples/snippets/src/main/java/com/example/spanner/UpdateBackupScheduleSample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-spanner&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/spanner/UpdateBackupScheduleSample.java) |
579580
| Update Database Sample | [source code](https://github.com/googleapis/java-spanner/blob/main/samples/snippets/src/main/java/com/example/spanner/UpdateDatabaseSample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-spanner&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/spanner/UpdateDatabaseSample.java) |
580581
| Update Database With Default Leader Sample | [source code](https://github.com/googleapis/java-spanner/blob/main/samples/snippets/src/main/java/com/example/spanner/UpdateDatabaseWithDefaultLeaderSample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-spanner&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/spanner/UpdateDatabaseWithDefaultLeaderSample.java) |
@@ -728,7 +729,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
728729
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-spanner/java11.html
729730
[stability-image]: https://img.shields.io/badge/stability-stable-green
730731
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-spanner.svg
731-
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-spanner/6.92.0
732+
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-spanner/6.94.0
732733
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
733734
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
734735
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles

benchmarks/pom.xml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<parent>
2525
<groupId>com.google.cloud</groupId>
2626
<artifactId>google-cloud-spanner-parent</artifactId>
27-
<version>6.92.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner:current} -->
27+
<version>6.94.0</version><!-- {x-version-update:google-cloud-spanner:current} -->
2828
</parent>
2929

3030
<properties>
@@ -34,7 +34,7 @@
3434
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3535
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
3636
<junixsocket.version>2.10.1</junixsocket.version>
37-
<opentelemetry.version>1.49.0</opentelemetry.version>
37+
<opentelemetry.version>1.47.0</opentelemetry.version>
3838
</properties>
3939

4040
<dependencies>
@@ -56,6 +56,11 @@
5656
<artifactId>exporter-metrics</artifactId>
5757
<version>0.33.0</version>
5858
</dependency>
59+
<dependency>
60+
<groupId>com.google.cloud</groupId>
61+
<artifactId>google-cloud-monitoring</artifactId>
62+
<version>3.63.0</version>
63+
</dependency>
5964
<!-- OpenTelemetry test dependencies -->
6065
<dependency>
6166
<groupId>io.opentelemetry</groupId>
@@ -85,19 +90,14 @@
8590
<dependency>
8691
<groupId>io.opentelemetry</groupId>
8792
<artifactId>opentelemetry-bom</artifactId>
88-
<version>1.46.0</version>
93+
<version>1.50.0</version>
8994
<type>pom</type>
9095
<scope>import</scope>
9196
</dependency>
9297
<dependency>
9398
<groupId>com.google.cloud</groupId>
9499
<artifactId>google-cloud-spanner</artifactId>
95-
<version>6.89.0</version>
96-
</dependency>
97-
<dependency>
98-
<groupId>commons-cli</groupId>
99-
<artifactId>commons-cli</artifactId>
100-
<version>1.9.0</version>
100+
<version>6.93.0</version>
101101
</dependency>
102102
<dependency>
103103
<groupId>com.google.auto.value</groupId>
@@ -140,8 +140,9 @@
140140
</configuration>
141141
</plugin>
142142
<plugin>
143-
<groupId>com.coveo</groupId>
143+
<groupId>com.spotify.fmt</groupId>
144144
<artifactId>fmt-maven-plugin</artifactId>
145+
<version>2.27</version>
145146
<executions>
146147
<execution>
147148
<goals>

benchmarks/src/main/java/com/google/cloud/spanner/benchmark/AbstractRunner.java

Lines changed: 73 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,46 +18,80 @@
1818

1919
import java.nio.charset.StandardCharsets;
2020
import java.time.Duration;
21+
import java.time.Instant;
22+
import java.time.temporal.ChronoUnit;
2123
import java.util.ArrayList;
24+
import java.util.HashMap;
25+
import java.util.HashSet;
2226
import java.util.List;
27+
import java.util.Map;
28+
import java.util.Set;
2329
import java.util.concurrent.ExecutorService;
2430
import java.util.concurrent.Future;
2531
import java.util.concurrent.ThreadLocalRandom;
2632
import java.util.concurrent.TimeUnit;
2733
import java.util.concurrent.TimeoutException;
28-
import java.util.concurrent.atomic.AtomicInteger;
2934

3035
abstract class AbstractRunner implements BenchmarkRunner {
31-
static final int TOTAL_RECORDS = 1000000;
32-
static final String SELECT_QUERY = "SELECT ID FROM FOO WHERE ID = @id";
33-
static final String UPDATE_QUERY = "UPDATE FOO SET BAR=1 WHERE ID = @id";
36+
static final int TOTAL_RECORDS = 100000;
37+
static final String TABLE_NAME = "Employees";
38+
static final String SELECT_QUERY = String.format("SELECT ID FROM %s WHERE ID = @id", TABLE_NAME);
39+
static final String UPDATE_QUERY =
40+
String.format("UPDATE %s SET Name=Google WHERE ID = @id", TABLE_NAME);
3441
static final String ID_COLUMN_NAME = "id";
35-
static final String SERVER_URL = "https://staging-wrenchworks.sandbox.googleapis.com";
42+
static final Map<Environment, String> SERVER_URL_MAPPING = new HashMap<>();
3643

37-
private final AtomicInteger operationCounter = new AtomicInteger();
44+
static {
45+
SERVER_URL_MAPPING.put(
46+
Environment.CLOUD_DEVEL, "https://staging-wrenchworks.sandbox.googleapis.com");
47+
SERVER_URL_MAPPING.put(Environment.PROD, "https://spanner.googleapis.com");
48+
}
49+
50+
Map<Integer, TimerConfiguration> timerConfigurations = new HashMap<>();
51+
private final Set<Integer> completedClients = new HashSet<>();
52+
private final Set<Integer> finishedClients = new HashSet<>();
53+
54+
protected void initiateTimer(int clientId, String message, Instant endTime) {
55+
TimerConfiguration timerConfiguration =
56+
timerConfigurations.getOrDefault(clientId, new TimerConfiguration());
57+
timerConfiguration.setMessage(message);
58+
timerConfiguration.setEndTime(endTime);
59+
timerConfigurations.put(clientId, timerConfiguration);
60+
}
3861

39-
protected void incOperations() {
40-
operationCounter.incrementAndGet();
62+
protected void setBenchmarkingCompleted(int clientId) {
63+
this.completedClients.add(clientId);
4164
}
4265

4366
protected List<Duration> collectResults(
4467
ExecutorService service,
4568
List<Future<List<Duration>>> results,
46-
int numClients,
47-
int numOperations)
69+
BenchmarkingConfiguration configuration)
4870
throws Exception {
49-
int totalOperations = numClients * numOperations;
71+
while (!(finishedClients.size() == configuration.getNumOfClients()))
72+
for (int i = 0; i < configuration.getNumOfClients(); i++) {
73+
TimerConfiguration timerConfiguration =
74+
timerConfigurations.getOrDefault(i, new TimerConfiguration());
75+
long totalSeconds =
76+
ChronoUnit.SECONDS.between(Instant.now(), timerConfiguration.getEndTime());
77+
if (completedClients.contains(i)) {
78+
if (!finishedClients.contains(i)) {
79+
System.out.printf("Client %s: Completed", i);
80+
finishedClients.add(i);
81+
}
82+
} else {
83+
System.out.printf(
84+
"Client %s: %s %s Minutes %s Seconds\r",
85+
i + 1, timerConfiguration.getMessage(), totalSeconds / 60, totalSeconds % 60);
86+
}
87+
//noinspection BusyWait
88+
Thread.sleep(1000L);
89+
}
5090
service.shutdown();
51-
while (!service.isTerminated()) {
52-
//noinspection BusyWait
53-
Thread.sleep(1000L);
54-
System.out.printf("\r%d/%d", operationCounter.get(), totalOperations);
55-
}
56-
System.out.println();
5791
if (!service.awaitTermination(60L, TimeUnit.MINUTES)) {
5892
throw new TimeoutException();
5993
}
60-
List<Duration> allResults = new ArrayList<>(numClients * numOperations);
94+
List<Duration> allResults = new ArrayList<>();
6195
for (Future<List<Duration>> result : results) {
6296
allResults.addAll(result.get());
6397
}
@@ -77,4 +111,25 @@ protected String generateRandomString() {
77111
ThreadLocalRandom.current().nextBytes(bytes);
78112
return new String(bytes, StandardCharsets.UTF_8);
79113
}
114+
115+
static class TimerConfiguration {
116+
private Instant endTime = Instant.now();
117+
private String message = "Waiting for benchmarks to start...";
118+
119+
Instant getEndTime() {
120+
return endTime;
121+
}
122+
123+
void setEndTime(Instant endTime) {
124+
this.endTime = endTime;
125+
}
126+
127+
String getMessage() {
128+
return message;
129+
}
130+
131+
void setMessage(String message) {
132+
this.message = message;
133+
}
134+
}
80135
}

0 commit comments

Comments
 (0)