Skip to content

Commit

Permalink
Merge branch 'main' into allow-ddl-in-autocommit-off
Browse files Browse the repository at this point in the history
  • Loading branch information
olavloite committed May 3, 2024
2 parents 9bbc1cd + e595157 commit 9180d24
Show file tree
Hide file tree
Showing 64 changed files with 3,122 additions and 265 deletions.
2 changes: 2 additions & 0 deletions .github/sync-repo-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ branchProtectionRules:
- compile (8)
- compile (11)
- OwlBot Post Processor
- units-with-multiplexed-session (8)
- units-with-multiplexed-session (11)
- pattern: 3.3.x
isAdminEnforced: true
requiredApprovingReviewCount: 1
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,26 @@ jobs:
- run: .kokoro/build.sh
env:
JOB_TYPE: test
units-with-multiplexed-session8:
# Building using Java 17 and run the tests with Java 8 runtime
name: "units-with-multiplexed-session (8)"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
java-version: 8
distribution: temurin
- run: echo "SUREFIRE_JVM_OPT=-Djvm=${JAVA_HOME}/bin/java" >> $GITHUB_ENV
shell: bash
- uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
- run: .kokoro/build.sh
env:
JOB_TYPE: test
GOOGLE_CLOUD_SPANNER_ENABLE_MULTIPLEXED_SESSIONS: true
windows:
runs-on: windows-latest
steps:
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## [6.65.1](https://github.com/googleapis/java-spanner/compare/v6.65.0...v6.65.1) (2024-04-30)


### Dependencies

* Update dependency com.google.cloud:google-cloud-monitoring to v3.43.0 ([#3066](https://github.com/googleapis/java-spanner/issues/3066)) ([97b0a93](https://github.com/googleapis/java-spanner/commit/97b0a93469ea1b0f0c9a3413e2364951c2d667d1))


### Documentation

* Add a sample for max commit delays ([#2941](https://github.com/googleapis/java-spanner/issues/2941)) ([d3b5097](https://github.com/googleapis/java-spanner/commit/d3b50976f8a6687a6dac2f483ae133c026b81cac))

## [6.65.0](https://github.com/googleapis/java-spanner/compare/v6.64.0...v6.65.0) (2024-04-20)


Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,28 +42,28 @@ If you are using Maven without the BOM, add this to your dependencies:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-spanner</artifactId>
<version>6.65.0</version>
<version>6.65.1</version>
</dependency>

```

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

```Groovy
implementation platform('com.google.cloud:libraries-bom:26.37.0')
implementation platform('com.google.cloud:libraries-bom:26.38.0')
implementation 'com.google.cloud:google-cloud-spanner'
```
If you are using Gradle without BOM, add this to your dependencies:

```Groovy
implementation 'com.google.cloud:google-cloud-spanner:6.65.0'
implementation 'com.google.cloud:google-cloud-spanner:6.65.1'
```

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

```Scala
libraryDependencies += "com.google.cloud" % "google-cloud-spanner" % "6.65.0"
libraryDependencies += "com.google.cloud" % "google-cloud-spanner" % "6.65.1"
```
<!-- {x-version-update-end} -->

Expand Down Expand Up @@ -651,7 +651,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-spanner/java11.html
[stability-image]: https://img.shields.io/badge/stability-stable-green
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-spanner.svg
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-spanner/6.65.0
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-spanner/6.65.1
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles
Expand Down
53 changes: 53 additions & 0 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Latency Tests

This directory contains a utility to compare latencies of different public methods supported by the Java Client Library.
The tests use simple statements that operate on a single row at a time.

The goal is that addition of new features should not add any latency.

## Setup Test Database

All tests in this directory use a database with a single table. Follow these steps to create a
database that you can use for these tests:

1. Set up some environment variables. These will be used by all following steps.
```shell
export SPANNER_CLIENT_BENCHMARK_GOOGLE_CLOUD_PROJECT=my-project
export SPANNER_CLIENT_BENCHMARK_SPANNER_INSTANCE=my-instance
export SPANNER_CLIENT_BENCHMARK_SPANNER_DATABASE=my-database
```

2. Create the Cloud Spanner database if it does not already exist using Pantheon UI.
3. Create the test table in the Cloud Spanner database. The tests assume the below DDL for the table.

```shell
CREATE TABLE FOO ( id INT64 NOT NULL, BAZ INT64, BAR INT64, ) PRIMARY KEY(id);
```
4. Generate some random test data that can be used for the benchmarking. This can be done
by using the script `bulkInsertTestData` in class `BenchmarkingUtilityScripts` to bulk
load 1000000 rows into this table. A large table makes sure that the queries are well
randomised and there is no hot-spotting.

## Running

The benchmark application includes Java Client as a dependency. Modify the dependency
version in `pom.xml` file if you wish to benchmark a different version of Java Client.


* The below command uses only 1 thread and 1000 operations. So the total load would
be 1000 read operations. The test also uses multiplexed sessions.
```shell
mvn clean compile exec:java -Dexec.args="--clients=1 --operations=1000 --multiplexed=true"
```

* The below command uses 10 threads, so at any point in time there would be roughly
10 concurrent requests. The total load of the benchmark would be 50000 read operations.
```shell
mvn clean compile exec:java -Dexec.args="--clients=10 --operations=5000 --multiplexed=true"
```

* To run the same test without multiplexed sessions avoid passing `multiplexed` flag. This will
make sure that tests uses regular sessions.
```shell
mvn clean compile exec:java -Dexec.args="--clients=10 --operations=5000"
```
155 changes: 155 additions & 0 deletions benchmarks/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
<!--
Copyright 2023 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-spanner-benchmark</artifactId>
<packaging>jar</packaging>
<name>Google Cloud Spanner Benchmark</name>

<parent>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-spanner-parent</artifactId>
<version>6.65.2-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner:current} -->
</parent>

<properties>
<java.version>1.8</java.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<junixsocket.version>2.9.1</junixsocket.version>
<opentelemetry.version>1.36.0</opentelemetry.version>
</properties>

<dependencies>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-api</artifactId>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-context</artifactId>
</dependency>
<dependency>
<groupId>com.google.cloud.opentelemetry</groupId>
<artifactId>exporter-trace</artifactId>
<version>0.25.2</version>
</dependency>
<dependency>
<groupId>com.google.cloud.opentelemetry</groupId>
<artifactId>exporter-metrics</artifactId>
<version>0.25.2</version>
</dependency>
<!-- OpenTelemetry test dependencies -->
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk</artifactId>
<version>${opentelemetry.version}</version>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-metrics</artifactId>
<version>${opentelemetry.version}</version>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-trace</artifactId>
<version>${opentelemetry.version}</version>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-testing</artifactId>
<version>${opentelemetry.version}</version>
</dependency>
<dependency>
<groupId>com.google.re2j</groupId>
<artifactId>re2j</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-bom</artifactId>
<version>1.37.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-spanner</artifactId>
<version>6.65.1</version>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.6.0</version>
</dependency>
<dependency>
<groupId>com.google.auto.value</groupId>
<artifactId>auto-value-annotations</artifactId>
<version>1.10.4</version>
</dependency>
<dependency>
<groupId>com.kohlschutter.junixsocket</groupId>
<artifactId>junixsocket-core</artifactId>
<version>${junixsocket.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.kohlschutter.junixsocket</groupId>
<artifactId>junixsocket-common</artifactId>
<version>${junixsocket.version}</version>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.7.0</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<mainClass>com.google.cloud.spanner.benchmark.LatencyBenchmark</mainClass>
<cleanupDaemonThreads>false</cleanupDaemonThreads>
</configuration>
</plugin>
<plugin>
<groupId>com.coveo</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>format</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.cloud.spanner;

import com.google.api.core.InternalApi;

/**
* Simple helper class to get access to a package-private method in the {@link
* com.google.cloud.spanner.SessionPoolOptions}.
*/
@InternalApi
public class SessionPoolOptionsHelper {

// TODO: Remove when Builder.setUseMultiplexedSession(..) has been made public.
public static SessionPoolOptions.Builder setUseMultiplexedSession(
SessionPoolOptions.Builder sessionPoolOptionsBuilder, boolean useMultiplexedSession) {
return sessionPoolOptionsBuilder.setUseMultiplexedSession(useMultiplexedSession);
}
}
Loading

0 comments on commit 9180d24

Please sign in to comment.