Skip to content

Commit

Permalink
Merge branch 'main' into executor-struct-array-support
Browse files Browse the repository at this point in the history
  • Loading branch information
larkee authored Dec 16, 2024
2 parents 1ac1f07 + 430143c commit 5c9d565
Show file tree
Hide file tree
Showing 37 changed files with 366 additions and 133 deletions.
63 changes: 55 additions & 8 deletions .github/scripts/update_generation_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,23 @@ function update_config() {
sed -i -e "s/^${key_word}.*$/${key_word}: ${new_value}/" "${file}"
}

# Update an action to a new version in GitHub action.
function update_action() {
local key_word=$1
local new_value=$2
local file=$3
echo "Update ${key_word} to ${new_value} in ${file}"
# use a different delimiter because the key_word contains "/".
sed -i -e "s|${key_word}@v.*$|${key_word}@v${new_value}|" "${file}"
}

# The parameters of this script is:
# 1. base_branch, the base branch of the result pull request.
# 2. repo, organization/repo-name, e.g., googleapis/google-cloud-java
# 3. [optional] generation_config, the path to the generation configuration,
# the default value is generation_config.yaml in the repository root.
# 4. [optional] workflow, the library generation workflow file,
# the default value is .github/workflows/hermetic_library_generation.yaml.
while [[ $# -gt 0 ]]; do
key="$1"
case "${key}" in
Expand All @@ -48,6 +60,10 @@ case "${key}" in
generation_config="$2"
shift
;;
--workflow)
workflow="$2"
shift
;;
*)
echo "Invalid option: [$1]"
exit 1
Expand All @@ -71,21 +87,34 @@ if [ -z "${generation_config}" ]; then
echo "Use default generation config: ${generation_config}"
fi

if [ -z "${workflow}" ]; then
workflow=".github/workflows/hermetic_library_generation.yaml"
echo "Use default library generation workflow file: ${workflow}"
fi

current_branch="generate-libraries-${base_branch}"
title="chore: Update generation configuration at $(date)"

# try to find a open pull request associated with the branch
git checkout "${base_branch}"
# Try to find a open pull request associated with the branch
pr_num=$(gh pr list -s open -H "${current_branch}" -q . --json number | jq ".[] | .number")
# create a branch if there's no open pull request associated with the
# Create a branch if there's no open pull request associated with the
# branch; otherwise checkout the pull request.
if [ -z "${pr_num}" ]; then
git checkout -b "${current_branch}"
# Push the current branch to remote so that we can
# compare the commits later.
git push -u origin "${current_branch}"
else
gh pr checkout "${pr_num}"
fi

# Only allow fast-forward merging; exit with non-zero result if there's merging
# conflict.
git merge -m "chore: merge ${base_branch} into ${current_branch}" "${base_branch}"

mkdir tmp-googleapis
# use partial clone because only commit history is needed.
# Use partial clone because only commit history is needed.
git clone --filter=blob:none https://github.com/googleapis/googleapis.git tmp-googleapis
pushd tmp-googleapis
git pull
Expand All @@ -94,25 +123,43 @@ popd
rm -rf tmp-googleapis
update_config "googleapis_commitish" "${latest_commit}" "${generation_config}"

# update gapic-generator-java version to the latest
# Update gapic-generator-java version to the latest
latest_version=$(get_latest_released_version "com.google.api" "gapic-generator-java")
update_config "gapic_generator_version" "${latest_version}" "${generation_config}"

# update libraries-bom version to the latest
# Update composite action version to latest gapic-generator-java version
update_action "googleapis/sdk-platform-java/.github/scripts" \
"${latest_version}" \
"${workflow}"

# Update libraries-bom version to the latest
latest_version=$(get_latest_released_version "com.google.cloud" "libraries-bom")
update_config "libraries_bom_version" "${latest_version}" "${generation_config}"

git add "${generation_config}"
git add "${generation_config}" "${workflow}"
changed_files=$(git diff --cached --name-only)
if [[ "${changed_files}" == "" ]]; then
echo "The latest generation config is not changed."
echo "Skip committing to the pull request."
else
git commit -m "${title}"
fi

# There are potentially at most two commits: merge commit and change commit.
# We want to exit the script if no commit happens (otherwise this will be an
# infinite loop).
# `git cherry` is a way to find whether the local branch has commits that are
# not in the remote branch.
# If we find any such commit, push them to remote branch.
unpushed_commit=$(git cherry -v "origin/${current_branch}" | wc -l)
if [[ "${unpushed_commit}" -eq 0 ]]; then
echo "No unpushed commits, exit"
exit 0
fi
git commit -m "${title}"

if [ -z "${pr_num}" ]; then
git remote add remote_repo https://cloud-java-bot:"${GH_TOKEN}@github.com/${repo}.git"
git fetch -q --unshallow remote_repo
git fetch -q remote_repo
git push -f remote_repo "${current_branch}"
gh pr create --title "${title}" --head "${current_branch}" --body "${title}" --base "${base_branch}"
else
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/hermetic_library_generation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
with:
fetch-depth: 0
token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}
- uses: googleapis/sdk-platform-java/.github/scripts@v2.50.0
- uses: googleapis/sdk-platform-java/.github/scripts@v2.51.0
if: env.SHOULD_RUN == 'true'
with:
base_ref: ${{ github.base_ref }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unmanaged_dependency_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ jobs:
# repository
.kokoro/build.sh
- name: Unmanaged dependency check
uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v3.40.0
uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v3.41.0
with:
bom-path: google-cloud-spanner-bom/pom.xml
2 changes: 1 addition & 1 deletion .kokoro/presubmit/graalvm-native-17.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.40.0"
value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.41.0"
}

env_vars: {
Expand Down
2 changes: 1 addition & 1 deletion .kokoro/presubmit/graalvm-native.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.40.0"
value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.41.0"
}

env_vars: {
Expand Down
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# Changelog

## [6.83.0](https://github.com/googleapis/java-spanner/compare/v6.82.0...v6.83.0) (2024-12-13)


### Features

* Add Metrics host for built in metrics ([#3519](https://github.com/googleapis/java-spanner/issues/3519)) ([4ed455a](https://github.com/googleapis/java-spanner/commit/4ed455a43edf7ff8d138ce4d40a52d3224383b14))
* Add opt-in for using multiplexed sessions for blind writes ([#3540](https://github.com/googleapis/java-spanner/issues/3540)) ([216f53e](https://github.com/googleapis/java-spanner/commit/216f53e4cbc0150078ece7785da33b342a6ab082))
* Add UUID in Spanner TypeCode enum ([41f83dc](https://github.com/googleapis/java-spanner/commit/41f83dcf046f955ec289d4e976f40a03922054cb))
* Introduce java.time variables and methods ([#3495](https://github.com/googleapis/java-spanner/issues/3495)) ([8a7d533](https://github.com/googleapis/java-spanner/commit/8a7d533ded21b9b94992b68c702c08bb84474e1b))
* **spanner:** Support multiplexed session for Partitioned operations ([#3231](https://github.com/googleapis/java-spanner/issues/3231)) ([4501a3e](https://github.com/googleapis/java-spanner/commit/4501a3ea69a9346e8b95edf6f94ff839b509ec73))
* Support 'set local' for retry_aborts_internally ([#3532](https://github.com/googleapis/java-spanner/issues/3532)) ([331942f](https://github.com/googleapis/java-spanner/commit/331942f51b11660b9de9c8fe8aacd6f60ac254b5))


### Bug Fixes

* **deps:** Update the Java code generator (gapic-generator-java) to 2.51.0 ([41f83dc](https://github.com/googleapis/java-spanner/commit/41f83dcf046f955ec289d4e976f40a03922054cb))


### Dependencies

* Update sdk platform java dependencies ([#3549](https://github.com/googleapis/java-spanner/issues/3549)) ([6235f0f](https://github.com/googleapis/java-spanner/commit/6235f0f2c223718c537addc450fa5910d1500271))

## [6.82.0](https://github.com/googleapis/java-spanner/compare/v6.81.2...v6.82.0) (2024-12-04)


Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,20 @@ If you are using Maven without the BOM, add this to your dependencies:
If you are using Gradle 5.x or later, add this to your dependencies:

```Groovy
implementation platform('com.google.cloud:libraries-bom:26.50.0')
implementation platform('com.google.cloud:libraries-bom:26.51.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.82.0'
implementation 'com.google.cloud:google-cloud-spanner:6.83.0'
```

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

```Scala
libraryDependencies += "com.google.cloud" % "google-cloud-spanner" % "6.82.0"
libraryDependencies += "com.google.cloud" % "google-cloud-spanner" % "6.83.0"
```

## Authentication
Expand Down Expand Up @@ -725,7 +725,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.82.0
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-spanner/6.83.0
[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
4 changes: 2 additions & 2 deletions benchmarks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-spanner-parent</artifactId>
<version>6.82.0</version><!-- {x-version-update:google-cloud-spanner:current} -->
<version>6.83.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner:current} -->
</parent>

<properties>
Expand All @@ -34,7 +34,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<junixsocket.version>2.10.1</junixsocket.version>
<opentelemetry.version>1.44.1</opentelemetry.version>
<opentelemetry.version>1.45.0</opentelemetry.version>
</properties>

<dependencies>
Expand Down
6 changes: 3 additions & 3 deletions generation_config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
gapic_generator_version: 2.50.0
googleapis_commitish: 349841abac6c3e580ccce6e3d6fcc182ed2512c2
libraries_bom_version: 26.50.0
gapic_generator_version: 2.51.0
googleapis_commitish: 7d0c6bee2517d77635beb2a1dd6d6e7d4d943512
libraries_bom_version: 26.51.0
libraries:
- api_shortname: spanner
name_pretty: Cloud Spanner
Expand Down
20 changes: 10 additions & 10 deletions google-cloud-spanner-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-spanner-bom</artifactId>
<version>6.82.0</version><!-- {x-version-update:google-cloud-spanner:current} -->
<version>6.83.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner:current} -->
<packaging>pom</packaging>
<parent>
<groupId>com.google.cloud</groupId>
<artifactId>sdk-platform-java-config</artifactId>
<version>3.40.0</version>
<version>3.41.0</version>
</parent>

<name>Google Cloud Spanner BOM</name>
Expand Down Expand Up @@ -53,43 +53,43 @@
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-spanner</artifactId>
<version>6.82.0</version><!-- {x-version-update:google-cloud-spanner:current} -->
<version>6.83.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner:current} -->
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-spanner</artifactId>
<type>test-jar</type>
<version>6.82.0</version><!-- {x-version-update:google-cloud-spanner:current} -->
<version>6.83.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-cloud-spanner-v1</artifactId>
<version>6.82.0</version><!-- {x-version-update:grpc-google-cloud-spanner-v1:current} -->
<version>6.83.1-SNAPSHOT</version><!-- {x-version-update:grpc-google-cloud-spanner-v1:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-cloud-spanner-admin-instance-v1</artifactId>
<version>6.82.0</version><!-- {x-version-update:grpc-google-cloud-spanner-admin-instance-v1:current} -->
<version>6.83.1-SNAPSHOT</version><!-- {x-version-update:grpc-google-cloud-spanner-admin-instance-v1:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-cloud-spanner-admin-database-v1</artifactId>
<version>6.82.0</version><!-- {x-version-update:grpc-google-cloud-spanner-admin-database-v1:current} -->
<version>6.83.1-SNAPSHOT</version><!-- {x-version-update:grpc-google-cloud-spanner-admin-database-v1:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-cloud-spanner-admin-instance-v1</artifactId>
<version>6.82.0</version><!-- {x-version-update:proto-google-cloud-spanner-admin-instance-v1:current} -->
<version>6.83.1-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-spanner-admin-instance-v1:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-cloud-spanner-v1</artifactId>
<version>6.82.0</version><!-- {x-version-update:proto-google-cloud-spanner-v1:current} -->
<version>6.83.1-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-spanner-v1:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-cloud-spanner-admin-database-v1</artifactId>
<version>6.82.0</version><!-- {x-version-update:proto-google-cloud-spanner-admin-database-v1:current} -->
<version>6.83.1-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-spanner-admin-database-v1:current} -->
</dependency>
</dependencies>
</dependencyManagement>
Expand Down
4 changes: 2 additions & 2 deletions google-cloud-spanner-executor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-spanner-executor</artifactId>
<version>6.82.0</version><!-- {x-version-update:google-cloud-spanner-executor:current} -->
<version>6.83.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner-executor:current} -->
<packaging>jar</packaging>
<name>Google Cloud Spanner Executor</name>

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

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,8 @@ private synchronized Spanner getClient(long timeoutSeconds, boolean useMultiplex
SessionPoolOptionsHelper.setUseMultiplexedSession(poolOptionsBuilder, useMultiplexedSession);
SessionPoolOptionsHelper.setUseMultiplexedSessionForRW(
poolOptionsBuilder, useMultiplexedSession);
SessionPoolOptionsHelper.setUseMultiplexedSessionForPartitionedOperations(
poolOptionsBuilder, useMultiplexedSession);
LOGGER.log(
Level.INFO,
String.format(
Expand Down
4 changes: 2 additions & 2 deletions google-cloud-spanner/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-spanner</artifactId>
<version>6.82.0</version><!-- {x-version-update:google-cloud-spanner:current} -->
<version>6.83.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner:current} -->
<packaging>jar</packaging>
<name>Google Cloud Spanner</name>
<url>https://github.com/googleapis/java-spanner</url>
<description>Java idiomatic client for Google Cloud Spanner.</description>
<parent>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-spanner-parent</artifactId>
<version>6.82.0</version><!-- {x-version-update:google-cloud-spanner:current} -->
<version>6.83.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner:current} -->
</parent>
<properties>
<site.installationModule>google-cloud-spanner</site.installationModule>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ private enum State {
* Listeners that will be called when the {@link AsyncResultSetImpl} has finished fetching all
* rows and any underlying transaction or session can be closed.
*/
private Collection<Runnable> listeners = new LinkedList<>();
private final Collection<Runnable> listeners = new LinkedList<>();

private State state = State.INITIALIZED;
private volatile State state = State.INITIALIZED;

/** This variable indicates that produce rows thread is initiated */
private volatile boolean produceRowsInitiated;
Expand Down Expand Up @@ -498,10 +498,12 @@ public ApiFuture<Void> setCallback(Executor exec, ReadyCallback cb) {
}

private void initiateProduceRows() {
if (this.state == State.STREAMING_INITIALIZED) {
this.state = State.RUNNING;
synchronized (monitor) {
if (this.state == State.STREAMING_INITIALIZED) {
this.state = State.RUNNING;
}
produceRowsInitiated = true;
}
produceRowsInitiated = true;
this.service.execute(new ProduceRowsRunnable());
}

Expand Down
Loading

0 comments on commit 5c9d565

Please sign in to comment.