diff --git a/.github/scripts/update_generation_config.sh b/.github/scripts/update_generation_config.sh index 561a313040..91434688cc 100644 --- a/.github/scripts/update_generation_config.sh +++ b/.github/scripts/update_generation_config.sh @@ -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 @@ -48,6 +60,10 @@ case "${key}" in generation_config="$2" shift ;; + --workflow) + workflow="$2" + shift + ;; *) echo "Invalid option: [$1]" exit 1 @@ -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 @@ -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 diff --git a/.github/workflows/hermetic_library_generation.yaml b/.github/workflows/hermetic_library_generation.yaml index 35aa3b151d..604b674bad 100644 --- a/.github/workflows/hermetic_library_generation.yaml +++ b/.github/workflows/hermetic_library_generation.yaml @@ -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 }} diff --git a/.github/workflows/unmanaged_dependency_check.yaml b/.github/workflows/unmanaged_dependency_check.yaml index f5298fed0f..f62b0af0eb 100644 --- a/.github/workflows/unmanaged_dependency_check.yaml +++ b/.github/workflows/unmanaged_dependency_check.yaml @@ -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 diff --git a/.kokoro/presubmit/graalvm-native-17.cfg b/.kokoro/presubmit/graalvm-native-17.cfg index 82ed3a43e4..76ca3ee6da 100644 --- a/.kokoro/presubmit/graalvm-native-17.cfg +++ b/.kokoro/presubmit/graalvm-native-17.cfg @@ -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: { diff --git a/.kokoro/presubmit/graalvm-native.cfg b/.kokoro/presubmit/graalvm-native.cfg index a836c97f04..644bb62ce7 100644 --- a/.kokoro/presubmit/graalvm-native.cfg +++ b/.kokoro/presubmit/graalvm-native.cfg @@ -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: { diff --git a/CHANGELOG.md b/CHANGELOG.md index 1436e34143..aa465a1906 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/README.md b/README.md index 29f1bb0322..d6e321fc59 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/benchmarks/pom.xml b/benchmarks/pom.xml index 22c13635ce..31ad076c28 100644 --- a/benchmarks/pom.xml +++ b/benchmarks/pom.xml @@ -24,7 +24,7 @@ com.google.cloud google-cloud-spanner-parent - 6.82.0 + 6.83.1-SNAPSHOT @@ -34,7 +34,7 @@ UTF-8 UTF-8 2.10.1 - 1.44.1 + 1.45.0 diff --git a/generation_config.yaml b/generation_config.yaml index ef44b5b9de..f7c5f12a08 100644 --- a/generation_config.yaml +++ b/generation_config.yaml @@ -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 diff --git a/google-cloud-spanner-bom/pom.xml b/google-cloud-spanner-bom/pom.xml index 1db01f1094..d8f035ea2f 100644 --- a/google-cloud-spanner-bom/pom.xml +++ b/google-cloud-spanner-bom/pom.xml @@ -3,12 +3,12 @@ 4.0.0 com.google.cloud google-cloud-spanner-bom - 6.82.0 + 6.83.1-SNAPSHOT pom com.google.cloud sdk-platform-java-config - 3.40.0 + 3.41.0 Google Cloud Spanner BOM @@ -53,43 +53,43 @@ com.google.cloud google-cloud-spanner - 6.82.0 + 6.83.1-SNAPSHOT com.google.cloud google-cloud-spanner test-jar - 6.82.0 + 6.83.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-v1 - 6.82.0 + 6.83.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-admin-instance-v1 - 6.82.0 + 6.83.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-admin-database-v1 - 6.82.0 + 6.83.1-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-admin-instance-v1 - 6.82.0 + 6.83.1-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-v1 - 6.82.0 + 6.83.1-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-admin-database-v1 - 6.82.0 + 6.83.1-SNAPSHOT diff --git a/google-cloud-spanner-executor/pom.xml b/google-cloud-spanner-executor/pom.xml index ccb631bb1a..dd43ae439e 100644 --- a/google-cloud-spanner-executor/pom.xml +++ b/google-cloud-spanner-executor/pom.xml @@ -5,14 +5,14 @@ 4.0.0 com.google.cloud google-cloud-spanner-executor - 6.82.0 + 6.83.1-SNAPSHOT jar Google Cloud Spanner Executor com.google.cloud google-cloud-spanner-parent - 6.82.0 + 6.83.1-SNAPSHOT diff --git a/google-cloud-spanner-executor/src/main/java/com/google/cloud/executor/spanner/CloudClientExecutor.java b/google-cloud-spanner-executor/src/main/java/com/google/cloud/executor/spanner/CloudClientExecutor.java index bd905101bf..03c92ba8dc 100644 --- a/google-cloud-spanner-executor/src/main/java/com/google/cloud/executor/spanner/CloudClientExecutor.java +++ b/google-cloud-spanner-executor/src/main/java/com/google/cloud/executor/spanner/CloudClientExecutor.java @@ -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( diff --git a/google-cloud-spanner/pom.xml b/google-cloud-spanner/pom.xml index b7589c1020..c5128cc19f 100644 --- a/google-cloud-spanner/pom.xml +++ b/google-cloud-spanner/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-spanner - 6.82.0 + 6.83.1-SNAPSHOT jar Google Cloud Spanner https://github.com/googleapis/java-spanner @@ -11,7 +11,7 @@ com.google.cloud google-cloud-spanner-parent - 6.82.0 + 6.83.1-SNAPSHOT google-cloud-spanner diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AsyncResultSetImpl.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AsyncResultSetImpl.java index 1161822cd1..d980c90f78 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AsyncResultSetImpl.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AsyncResultSetImpl.java @@ -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 listeners = new LinkedList<>(); + private final Collection 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; @@ -498,10 +498,12 @@ public ApiFuture 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()); } diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionImpl.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionImpl.java index 9f4a43d5a2..2d7c917d23 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionImpl.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionImpl.java @@ -292,7 +292,7 @@ static UnitOfWorkType of(TransactionMode transactionMode) { statementExecutorType = options.isUseVirtualThreads() ? StatementExecutorType.VIRTUAL_THREAD - : StatementExecutorType.DIRECT_EXECUTOR; + : StatementExecutorType.PLATFORM_THREAD; } this.statementExecutor = new StatementExecutor(statementExecutorType, options.getStatementExecutionInterceptors()); @@ -342,7 +342,7 @@ && getDialect() == Dialect.POSTGRESQL new StatementExecutor( options.isUseVirtualThreads() ? StatementExecutorType.VIRTUAL_THREAD - : StatementExecutorType.DIRECT_EXECUTOR, + : StatementExecutorType.PLATFORM_THREAD, Collections.emptyList()); this.spannerPool = Preconditions.checkNotNull(spannerPool); this.options = Preconditions.checkNotNull(options); diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionOptions.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionOptions.java index 2be2d7980b..6e991816ab 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionOptions.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionOptions.java @@ -628,11 +628,16 @@ private Builder() {} public static final String SPANNER_URI_FORMAT = "(?:cloudspanner:)(?//[\\w.-]+(?:\\.[\\w\\.-]+)*[\\w\\-\\._~:/?#\\[\\]@!\\$&'\\(\\)\\*\\+,;=.]+)?/projects/(?(([a-z]|[-.:]|[0-9])+|(DEFAULT_PROJECT_ID)))(/instances/(?([a-z]|[-]|[0-9])+)(/databases/(?([a-z]|[-]|[_]|[0-9])+))?)?(?:[?|;].*)?"; + public static final String EXTERNAL_HOST_FORMAT = + "(?:cloudspanner:)(?//[\\w.-]+(?::\\d+)?)(/instances/(?[a-z0-9-]+))?(/databases/(?[a-z0-9_-]+))(?:[?;].*)?"; private static final String SPANNER_URI_REGEX = "(?is)^" + SPANNER_URI_FORMAT + "$"; @VisibleForTesting static final Pattern SPANNER_URI_PATTERN = Pattern.compile(SPANNER_URI_REGEX); + @VisibleForTesting + static final Pattern EXTERNAL_HOST_PATTERN = Pattern.compile(EXTERNAL_HOST_FORMAT); + private static final String HOST_GROUP = "HOSTGROUP"; private static final String PROJECT_GROUP = "PROJECTGROUP"; private static final String INSTANCE_GROUP = "INSTANCEGROUP"; @@ -643,6 +648,10 @@ private boolean isValidUri(String uri) { return SPANNER_URI_PATTERN.matcher(uri).matches(); } + private boolean isValidExternalHostUri(String uri) { + return EXTERNAL_HOST_PATTERN.matcher(uri).matches(); + } + /** * Sets the URI of the Cloud Spanner database to connect to. A connection URI must be specified * in this format: @@ -700,9 +709,11 @@ private boolean isValidUri(String uri) { * @return this builder */ public Builder setUri(String uri) { - Preconditions.checkArgument( - isValidUri(uri), - "The specified URI is not a valid Cloud Spanner connection URI. Please specify a URI in the format \"cloudspanner:[//host[:port]]/projects/project-id[/instances/instance-id[/databases/database-name]][\\?property-name=property-value[;property-name=property-value]*]?\""); + if (!isValidExternalHostUri(uri)) { + Preconditions.checkArgument( + isValidUri(uri), + "The specified URI is not a valid Cloud Spanner connection URI. Please specify a URI in the format \"cloudspanner:[//host[:port]]/projects/project-id[/instances/instance-id[/databases/database-name]][\\?property-name=property-value[;property-name=property-value]*]?\""); + } ConnectionPropertyValue value = cast(ConnectionProperties.parseValues(uri).get(LENIENT.getKey())); checkValidProperties(value != null && value.getValue(), uri); @@ -829,7 +840,14 @@ public static Builder newBuilder() { private final SpannerOptionsConfigurator configurator; private ConnectionOptions(Builder builder) { - Matcher matcher = Builder.SPANNER_URI_PATTERN.matcher(builder.uri); + Matcher matcher; + boolean isExternalHost = false; + if (builder.isValidExternalHostUri(builder.uri)) { + matcher = Builder.EXTERNAL_HOST_PATTERN.matcher(builder.uri); + isExternalHost = true; + } else { + matcher = Builder.SPANNER_URI_PATTERN.matcher(builder.uri); + } Preconditions.checkArgument( matcher.find(), String.format("Invalid connection URI specified: %s", builder.uri)); @@ -947,12 +965,18 @@ && getInitialConnectionPropertyValue(OAUTH_TOKEN) == null this.sessionPoolOptions = SessionPoolOptions.newBuilder().setAutoDetectDialect(true).build(); } - String projectId = matcher.group(Builder.PROJECT_GROUP); + String projectId = "default"; + String instanceId = matcher.group(Builder.INSTANCE_GROUP); + if (!isExternalHost) { + projectId = matcher.group(Builder.PROJECT_GROUP); + } else if (instanceId == null) { + instanceId = "default"; + } if (Builder.DEFAULT_PROJECT_ID_PLACEHOLDER.equalsIgnoreCase(projectId)) { projectId = getDefaultProjectId(this.credentials); } this.projectId = projectId; - this.instanceId = matcher.group(Builder.INSTANCE_GROUP); + this.instanceId = instanceId; this.databaseName = matcher.group(Builder.DATABASE_GROUP); } @@ -981,6 +1005,10 @@ static String determineHost( // The leading '//' is already included in the regex for the connection URL, so we don't need // to add the leading '//' to the host name here. host = matcher.group(Builder.HOST_GROUP); + if (Builder.EXTERNAL_HOST_FORMAT.equals(matcher.pattern().pattern()) + && !host.matches(".*:\\d+$")) { + host = String.format("%s:15000", host); + } } if (usePlainText) { return PLAIN_TEXT_PROTOCOL + host; diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionProperties.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionProperties.java index 0ca9b7256e..fd40efa8f4 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionProperties.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionProperties.java @@ -112,20 +112,22 @@ import com.google.cloud.spanner.connection.ClientSideStatementValueConverters.StringValueConverter; import com.google.cloud.spanner.connection.ConnectionProperty.Context; import com.google.cloud.spanner.connection.DirectedReadOptionsUtil.DirectedReadOptionsConverter; +import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.spanner.v1.DirectedReadOptions; import java.time.Duration; -import java.util.Map; /** * Utility class that defines all known connection properties. This class will eventually replace * the list of {@link com.google.cloud.spanner.connection.ConnectionOptions.ConnectionProperty} in * {@link ConnectionOptions}. */ -class ConnectionProperties { +public class ConnectionProperties { private static final ImmutableMap.Builder> CONNECTION_PROPERTIES_BUILDER = ImmutableMap.builder(); + private static final Boolean[] BOOLEANS = new Boolean[] {Boolean.TRUE, Boolean.FALSE}; + static final ConnectionProperty CONNECTION_STATE_TYPE = create( "connection_state_type", @@ -133,6 +135,7 @@ class ConnectionProperties { + "If no value is set, then the database dialect default will be used, " + "which is NON_TRANSACTIONAL for GoogleSQL and TRANSACTIONAL for PostgreSQL.", null, + ConnectionState.Type.values(), ConnectionStateTypeConverter.INSTANCE, Context.STARTUP); static final ConnectionProperty TRACING_PREFIX = @@ -148,6 +151,7 @@ class ConnectionProperties { LENIENT_PROPERTY_NAME, "Silently ignore unknown properties in the connection string/properties (true/false)", DEFAULT_LENIENT, + BOOLEANS, BooleanConverter.INSTANCE, Context.STARTUP); static final ConnectionProperty ENDPOINT = @@ -167,6 +171,7 @@ class ConnectionProperties { + "The instance and database in the connection string will automatically be created if these do not yet exist on the emulator. " + "Add dialect=postgresql to the connection string to make sure that the database that is created uses the PostgreSQL dialect.", false, + BOOLEANS, BooleanConverter.INSTANCE, Context.STARTUP); static final ConnectionProperty USE_AUTO_SAVEPOINTS_FOR_EMULATOR = @@ -175,6 +180,7 @@ class ConnectionProperties { "Automatically creates savepoints for each statement in a read/write transaction when using the Emulator. " + "This is no longer needed when using Emulator version 1.5.23 or higher.", false, + BOOLEANS, BooleanConverter.INSTANCE, Context.STARTUP); static final ConnectionProperty USE_PLAIN_TEXT = @@ -182,6 +188,7 @@ class ConnectionProperties { USE_PLAIN_TEXT_PROPERTY_NAME, "Use a plain text communication channel (i.e. non-TLS) for communicating with the server (true/false). Set this value to true for communication with the Cloud Spanner emulator.", DEFAULT_USE_PLAIN_TEXT, + BOOLEANS, BooleanConverter.INSTANCE, Context.STARTUP); @@ -226,6 +233,7 @@ class ConnectionProperties { DIALECT_PROPERTY_NAME, "Sets the dialect to use for new databases that are created by this connection.", Dialect.GOOGLE_STANDARD_SQL, + Dialect.values(), DialectConverter.INSTANCE, Context.STARTUP); static final ConnectionProperty TRACK_SESSION_LEAKS = @@ -238,6 +246,7 @@ class ConnectionProperties { + "actual session leak is detected. The stack trace of the exception will " + "in that case not contain the call stack of when the session was checked out.", DEFAULT_TRACK_SESSION_LEAKS, + BOOLEANS, BooleanConverter.INSTANCE, Context.STARTUP); static final ConnectionProperty TRACK_CONNECTION_LEAKS = @@ -250,6 +259,7 @@ class ConnectionProperties { + "actual connection leak is detected. The stack trace of the exception will " + "in that case not contain the call stack of when the connection was created.", DEFAULT_TRACK_CONNECTION_LEAKS, + BOOLEANS, BooleanConverter.INSTANCE, Context.STARTUP); static final ConnectionProperty ROUTE_TO_LEADER = @@ -257,6 +267,7 @@ class ConnectionProperties { ROUTE_TO_LEADER_PROPERTY_NAME, "Should read/write transactions and partitioned DML be routed to leader region (true/false)", DEFAULT_ROUTE_TO_LEADER, + BOOLEANS, BooleanConverter.INSTANCE, Context.STARTUP); static final ConnectionProperty USE_VIRTUAL_THREADS = @@ -265,6 +276,7 @@ class ConnectionProperties { "Use a virtual thread instead of a platform thread for each connection (true/false). " + "This option only has any effect if the application is running on Java 21 or higher. In all other cases, the option is ignored.", DEFAULT_USE_VIRTUAL_THREADS, + BOOLEANS, BooleanConverter.INSTANCE, Context.STARTUP); static final ConnectionProperty USE_VIRTUAL_GRPC_TRANSPORT_THREADS = @@ -273,6 +285,7 @@ class ConnectionProperties { "Use a virtual thread instead of a platform thread for the gRPC executor (true/false). " + "This option only has any effect if the application is running on Java 21 or higher. In all other cases, the option is ignored.", DEFAULT_USE_VIRTUAL_GRPC_TRANSPORT_THREADS, + BOOLEANS, BooleanConverter.INSTANCE, Context.STARTUP); static final ConnectionProperty ENABLE_EXTENDED_TRACING = @@ -282,6 +295,7 @@ class ConnectionProperties { + "by this connection. The SQL string is added as the standard OpenTelemetry " + "attribute 'db.statement'.", DEFAULT_ENABLE_EXTENDED_TRACING, + BOOLEANS, BooleanConverter.INSTANCE, Context.STARTUP); static final ConnectionProperty ENABLE_API_TRACING = @@ -292,6 +306,7 @@ class ConnectionProperties { + "or if you want to debug potential latency problems caused by RPCs that are " + "being retried.", DEFAULT_ENABLE_API_TRACING, + BOOLEANS, BooleanConverter.INSTANCE, Context.STARTUP); static final ConnectionProperty ENABLE_END_TO_END_TRACING = @@ -302,6 +317,7 @@ class ConnectionProperties { + "Server side traces can only go to Google Cloud Trace, so to see end to end traces, " + "the application should configure an exporter that exports the traces to Google Cloud Trace.", DEFAULT_ENABLE_END_TO_END_TRACING, + BOOLEANS, BooleanConverter.INSTANCE, Context.STARTUP); static final ConnectionProperty MIN_SESSIONS = @@ -345,6 +361,7 @@ class ConnectionProperties { AUTOCOMMIT_PROPERTY_NAME, "Should the connection start in autocommit (true/false)", DEFAULT_AUTOCOMMIT, + BOOLEANS, BooleanConverter.INSTANCE, Context.USER); static final ConnectionProperty READONLY = @@ -352,13 +369,16 @@ class ConnectionProperties { READONLY_PROPERTY_NAME, "Should the connection start in read-only mode (true/false)", DEFAULT_READONLY, + BOOLEANS, BooleanConverter.INSTANCE, Context.USER); static final ConnectionProperty AUTOCOMMIT_DML_MODE = create( "autocommit_dml_mode", - "Should the connection automatically retry Aborted errors (true/false)", + "Determines the transaction type that is used to execute " + + "DML statements when the connection is in auto-commit mode.", AutocommitDmlMode.TRANSACTIONAL, + AutocommitDmlMode.values(), AutocommitDmlModeConverter.INSTANCE, Context.USER); static final ConnectionProperty RETRY_ABORTS_INTERNALLY = @@ -371,6 +391,7 @@ class ConnectionProperties { RETRY_ABORTS_INTERNALLY_PROPERTY_NAME, "Should the connection automatically retry Aborted errors (true/false)", DEFAULT_RETRY_ABORTS_INTERNALLY, + BOOLEANS, BooleanConverter.INSTANCE, Context.USER); static final ConnectionProperty RETURN_COMMIT_STATS = @@ -378,6 +399,7 @@ class ConnectionProperties { "returnCommitStats", "Request that Spanner returns commit statistics for read/write transactions (true/false)", DEFAULT_RETURN_COMMIT_STATS, + BOOLEANS, BooleanConverter.INSTANCE, Context.USER); static final ConnectionProperty DELAY_TRANSACTION_START_UNTIL_FIRST_WRITE = @@ -389,6 +411,7 @@ class ConnectionProperties { + "the first write operation in a read/write transaction will be executed using the read/write transaction. Enabling this mode can reduce locking " + "and improve performance for applications that can handle the lower transaction isolation semantics.", DEFAULT_DELAY_TRANSACTION_START_UNTIL_FIRST_WRITE, + BOOLEANS, BooleanConverter.INSTANCE, Context.USER); static final ConnectionProperty KEEP_TRANSACTION_ALIVE = @@ -398,6 +421,7 @@ class ConnectionProperties { + "if no other statements are being executed. This option should be used with caution, as it can keep transactions alive and hold on to locks " + "longer than intended. This option should typically be used for CLI-type application that might wait for user input for a longer period of time.", DEFAULT_KEEP_TRANSACTION_ALIVE, + BOOLEANS, BooleanConverter.INSTANCE, Context.USER); @@ -415,6 +439,7 @@ class ConnectionProperties { + "Executing a query that cannot be partitioned will fail. " + "Executing a query in a read/write transaction will also fail.", DEFAULT_AUTO_PARTITION_MODE, + BOOLEANS, BooleanConverter.INSTANCE, Context.USER); static final ConnectionProperty DATA_BOOST_ENABLED = @@ -423,6 +448,7 @@ class ConnectionProperties { "Enable data boost for all partitioned queries that are executed by this connection. " + "This setting is only used for partitioned queries and is ignored by all other statements.", DEFAULT_DATA_BOOST_ENABLED, + BOOLEANS, BooleanConverter.INSTANCE, Context.USER); static final ConnectionProperty MAX_PARTITIONS = @@ -468,6 +494,7 @@ class ConnectionProperties { RPC_PRIORITY_NAME, "Sets the priority for all RPC invocations from this connection (HIGH/MEDIUM/LOW). The default is HIGH.", DEFAULT_RPC_PRIORITY, + RpcPriority.values(), RpcPriorityConverter.INSTANCE, Context.USER); static final ConnectionProperty SAVEPOINT_SUPPORT = @@ -475,6 +502,7 @@ class ConnectionProperties { "savepoint_support", "Determines the behavior of the connection when savepoints are used.", SavepointSupport.FAIL_AFTER_ROLLBACK, + SavepointSupport.values(), SavepointSupportConverter.INSTANCE, Context.USER); static final ConnectionProperty DDL_IN_TRANSACTION_MODE = @@ -482,6 +510,7 @@ class ConnectionProperties { DDL_IN_TRANSACTION_MODE_PROPERTY_NAME, "Determines how the connection should handle DDL statements in a read/write transaction.", DEFAULT_DDL_IN_TRANSACTION_MODE, + DdlInTransactionMode.values(), DdlInTransactionModeConverter.INSTANCE, Context.USER); static final ConnectionProperty MAX_COMMIT_DELAY = @@ -504,6 +533,7 @@ class ConnectionProperties { + "This setting is only in read/write transactions. DML statements in auto-commit mode " + "are executed directly.", DEFAULT_AUTO_BATCH_DML, + BOOLEANS, BooleanConverter.INSTANCE, Context.USER); static final ConnectionProperty AUTO_BATCH_DML_UPDATE_COUNT = @@ -538,12 +568,17 @@ class ConnectionProperties { + AUTO_BATCH_DML_UPDATE_COUNT_VERIFICATION_PROPERTY_NAME + " to false.", DEFAULT_AUTO_BATCH_DML_UPDATE_COUNT_VERIFICATION, + BOOLEANS, BooleanConverter.INSTANCE, Context.USER); - static final Map> CONNECTION_PROPERTIES = + static final ImmutableMap> CONNECTION_PROPERTIES = CONNECTION_PROPERTIES_BUILDER.build(); + /** The list of all supported connection properties. */ + public static ImmutableList> VALID_CONNECTION_PROPERTIES = + ImmutableList.copyOf(ConnectionProperties.CONNECTION_PROPERTIES.values()); + /** Utility method for creating a new core {@link ConnectionProperty}. */ private static ConnectionProperty create( String name, @@ -551,10 +586,27 @@ private static ConnectionProperty create( T defaultValue, ClientSideStatementValueConverter converter, Context context) { - ConnectionProperty property = - ConnectionProperty.create(name, description, defaultValue, converter, context); - CONNECTION_PROPERTIES_BUILDER.put(property.getKey(), property); - return property; + return create(name, description, defaultValue, null, converter, context); + } + + /** Utility method for creating a new core {@link ConnectionProperty}. */ + private static ConnectionProperty create( + String name, + String description, + T defaultValue, + T[] validValues, + ClientSideStatementValueConverter converter, + Context context) { + try { + ConnectionProperty property = + ConnectionProperty.create( + name, description, defaultValue, validValues, converter, context); + CONNECTION_PROPERTIES_BUILDER.put(property.getKey(), property); + return property; + } catch (Throwable t) { + t.printStackTrace(); + } + return null; } /** Parse the connection properties that can be found in the given connection URL. */ diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionProperty.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionProperty.java index c203d44203..7c06774cf2 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionProperty.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionProperty.java @@ -37,12 +37,13 @@ * connection state is an opt-in. */ public class ConnectionProperty { + /** * Context indicates when a {@link ConnectionProperty} may be set. Each higher-ordinal value * includes the preceding values, meaning that a {@link ConnectionProperty} with {@link * Context#USER} can be set both at connection startup and during the connection's lifetime. */ - enum Context { + public enum Context { /** The property can only be set at startup of the connection. */ STARTUP, /** @@ -79,8 +80,20 @@ static ConnectionProperty create( T defaultValue, ClientSideStatementValueConverter converter, Context context) { + return create(name, description, defaultValue, null, converter, context); + } + + /** Utility method for creating a typed {@link ConnectionProperty}. */ + @Nonnull + static ConnectionProperty create( + @Nonnull String name, + String description, + T defaultValue, + T[] validValues, + ClientSideStatementValueConverter converter, + Context context) { return new ConnectionProperty<>( - null, name, description, defaultValue, null, converter, context); + null, name, description, defaultValue, validValues, converter, context); } /** @@ -163,35 +176,38 @@ ConnectionPropertyValue convert(@Nullable String stringValue) { return new ConnectionPropertyValue<>(this, convertedValue, convertedValue); } - String getKey() { + @Nonnull + public String getKey() { return this.key; } - boolean hasExtension() { + public boolean hasExtension() { return this.extension != null; } - String getExtension() { + public String getExtension() { return this.extension; } - String getName() { + @Nonnull + public String getName() { return this.name; } - String getDescription() { + @Nonnull + public String getDescription() { return this.description; } - T getDefaultValue() { + public T getDefaultValue() { return this.defaultValue; } - T[] getValidValues() { + public T[] getValidValues() { return this.validValues; } - Context getContext() { + public Context getContext() { return this.context; } } diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/RetryOnInvalidatedSessionTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/RetryOnInvalidatedSessionTest.java index a6c3f9fa7c..f070f15421 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/RetryOnInvalidatedSessionTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/RetryOnInvalidatedSessionTest.java @@ -207,7 +207,7 @@ public static void stopServer() throws InterruptedException { public void setUp() throws InterruptedException { mockSpanner.reset(); if (spanner == null - || spanner.getOptions().getSessionPoolOptions().isFailIfPoolExhausted() + || spanner.getOptions().getSessionPoolOptions().isFailIfSessionNotFound() != failOnInvalidatedSession) { if (spanner != null) { spanner.close(); @@ -228,8 +228,8 @@ public void setUp() throws InterruptedException { .build() .getService(); client = spanner.getDatabaseClient(DatabaseId.of("[PROJECT]", "[INSTANCE]", "[DATABASE]")); - invalidateSessionPool(client, spanner.getOptions().getSessionPoolOptions().getMinSessions()); } + invalidateSessionPool(client, spanner.getOptions().getSessionPoolOptions().getMinSessions()); } private static void invalidateSessionPool(DatabaseClient client, int minSessions) @@ -1002,6 +1002,7 @@ public void transactionManagerBatchUpdate() throws InterruptedException { } catch (AbortedException e) { transaction = assertThrowsSessionNotFoundIfShouldFail(() -> manager.resetForRetry()); if (transaction == null) { + manager.close(); break; } } diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionOptionsTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionOptionsTest.java index f826ec08df..69c4a01032 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionOptionsTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionOptionsTest.java @@ -16,6 +16,7 @@ package com.google.cloud.spanner.connection; +import static com.google.cloud.spanner.connection.ConnectionOptions.Builder.EXTERNAL_HOST_PATTERN; import static com.google.cloud.spanner.connection.ConnectionOptions.Builder.SPANNER_URI_PATTERN; import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_ENDPOINT; import static com.google.cloud.spanner.connection.ConnectionOptions.determineHost; @@ -1211,4 +1212,40 @@ public void testEnableApiTracing() { .build() .isEnableApiTracing()); } + + @Test + public void testExternalHostPatterns() { + Matcher matcherWithoutInstance = + EXTERNAL_HOST_PATTERN.matcher("cloudspanner://localhost:15000/databases/test-db"); + assertTrue(matcherWithoutInstance.matches()); + assertNull(matcherWithoutInstance.group("INSTANCEGROUP")); + assertEquals("test-db", matcherWithoutInstance.group("DATABASEGROUP")); + Matcher matcherWithProperty = + EXTERNAL_HOST_PATTERN.matcher( + "cloudspanner://localhost:15000/instances/default/databases/singers-db?usePlainText=true"); + assertTrue(matcherWithProperty.matches()); + assertEquals("default", matcherWithProperty.group("INSTANCEGROUP")); + assertEquals("singers-db", matcherWithProperty.group("DATABASEGROUP")); + Matcher matcherWithoutPort = + EXTERNAL_HOST_PATTERN.matcher( + "cloudspanner://localhost/instances/default/databases/test-db"); + assertTrue(matcherWithoutPort.matches()); + assertEquals("default", matcherWithoutPort.group("INSTANCEGROUP")); + assertEquals("test-db", matcherWithoutPort.group("DATABASEGROUP")); + assertEquals( + "http://localhost:15000", + determineHost( + matcherWithoutPort, + DEFAULT_ENDPOINT, + /* autoConfigEmulator= */ true, + /* usePlainText= */ true, + ImmutableMap.of())); + Matcher matcherWithProject = + EXTERNAL_HOST_PATTERN.matcher( + "cloudspanner://localhost:15000/projects/default/instances/default/databases/singers-db"); + assertFalse(matcherWithProject.matches()); + Matcher matcherWithoutHost = + EXTERNAL_HOST_PATTERN.matcher("cloudspanner:/instances/default/databases/singers-db"); + assertFalse(matcherWithoutHost.matches()); + } } diff --git a/grpc-google-cloud-spanner-admin-database-v1/pom.xml b/grpc-google-cloud-spanner-admin-database-v1/pom.xml index 000a88b626..2ec9ebce7b 100644 --- a/grpc-google-cloud-spanner-admin-database-v1/pom.xml +++ b/grpc-google-cloud-spanner-admin-database-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-admin-database-v1 - 6.82.0 + 6.83.1-SNAPSHOT grpc-google-cloud-spanner-admin-database-v1 GRPC library for grpc-google-cloud-spanner-admin-database-v1 com.google.cloud google-cloud-spanner-parent - 6.82.0 + 6.83.1-SNAPSHOT diff --git a/grpc-google-cloud-spanner-admin-instance-v1/pom.xml b/grpc-google-cloud-spanner-admin-instance-v1/pom.xml index b794aca19d..78a64b26cb 100644 --- a/grpc-google-cloud-spanner-admin-instance-v1/pom.xml +++ b/grpc-google-cloud-spanner-admin-instance-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-admin-instance-v1 - 6.82.0 + 6.83.1-SNAPSHOT grpc-google-cloud-spanner-admin-instance-v1 GRPC library for grpc-google-cloud-spanner-admin-instance-v1 com.google.cloud google-cloud-spanner-parent - 6.82.0 + 6.83.1-SNAPSHOT diff --git a/grpc-google-cloud-spanner-executor-v1/pom.xml b/grpc-google-cloud-spanner-executor-v1/pom.xml index b63e9bd603..de84666cd4 100644 --- a/grpc-google-cloud-spanner-executor-v1/pom.xml +++ b/grpc-google-cloud-spanner-executor-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-executor-v1 - 6.82.0 + 6.83.1-SNAPSHOT grpc-google-cloud-spanner-executor-v1 GRPC library for google-cloud-spanner com.google.cloud google-cloud-spanner-parent - 6.82.0 + 6.83.1-SNAPSHOT diff --git a/grpc-google-cloud-spanner-v1/pom.xml b/grpc-google-cloud-spanner-v1/pom.xml index dc1c2c1c93..294952b7ec 100644 --- a/grpc-google-cloud-spanner-v1/pom.xml +++ b/grpc-google-cloud-spanner-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-v1 - 6.82.0 + 6.83.1-SNAPSHOT grpc-google-cloud-spanner-v1 GRPC library for grpc-google-cloud-spanner-v1 com.google.cloud google-cloud-spanner-parent - 6.82.0 + 6.83.1-SNAPSHOT diff --git a/pom.xml b/pom.xml index 72a2a6797e..46157f0f1e 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-spanner-parent pom - 6.82.0 + 6.83.1-SNAPSHOT Google Cloud Spanner Parent https://github.com/googleapis/java-spanner @@ -14,7 +14,7 @@ com.google.cloud sdk-platform-java-config - 3.40.0 + 3.41.0 @@ -61,47 +61,47 @@ com.google.api.grpc proto-google-cloud-spanner-admin-instance-v1 - 6.82.0 + 6.83.1-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-executor-v1 - 6.82.0 + 6.83.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-executor-v1 - 6.82.0 + 6.83.1-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-v1 - 6.82.0 + 6.83.1-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-admin-database-v1 - 6.82.0 + 6.83.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-v1 - 6.82.0 + 6.83.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-admin-instance-v1 - 6.82.0 + 6.83.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-admin-database-v1 - 6.82.0 + 6.83.1-SNAPSHOT com.google.cloud google-cloud-spanner - 6.82.0 + 6.83.1-SNAPSHOT diff --git a/proto-google-cloud-spanner-admin-database-v1/pom.xml b/proto-google-cloud-spanner-admin-database-v1/pom.xml index 4d29a245a8..af791549cd 100644 --- a/proto-google-cloud-spanner-admin-database-v1/pom.xml +++ b/proto-google-cloud-spanner-admin-database-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-admin-database-v1 - 6.82.0 + 6.83.1-SNAPSHOT proto-google-cloud-spanner-admin-database-v1 PROTO library for proto-google-cloud-spanner-admin-database-v1 com.google.cloud google-cloud-spanner-parent - 6.82.0 + 6.83.1-SNAPSHOT diff --git a/proto-google-cloud-spanner-admin-instance-v1/pom.xml b/proto-google-cloud-spanner-admin-instance-v1/pom.xml index 08da9e3b85..96dfaf95ad 100644 --- a/proto-google-cloud-spanner-admin-instance-v1/pom.xml +++ b/proto-google-cloud-spanner-admin-instance-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-admin-instance-v1 - 6.82.0 + 6.83.1-SNAPSHOT proto-google-cloud-spanner-admin-instance-v1 PROTO library for proto-google-cloud-spanner-admin-instance-v1 com.google.cloud google-cloud-spanner-parent - 6.82.0 + 6.83.1-SNAPSHOT diff --git a/proto-google-cloud-spanner-executor-v1/pom.xml b/proto-google-cloud-spanner-executor-v1/pom.xml index 23a213ca72..c37eb525cc 100644 --- a/proto-google-cloud-spanner-executor-v1/pom.xml +++ b/proto-google-cloud-spanner-executor-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-executor-v1 - 6.82.0 + 6.83.1-SNAPSHOT proto-google-cloud-spanner-executor-v1 Proto library for google-cloud-spanner com.google.cloud google-cloud-spanner-parent - 6.82.0 + 6.83.1-SNAPSHOT diff --git a/proto-google-cloud-spanner-v1/pom.xml b/proto-google-cloud-spanner-v1/pom.xml index 8c3dc7a8ad..16495a9b5c 100644 --- a/proto-google-cloud-spanner-v1/pom.xml +++ b/proto-google-cloud-spanner-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-v1 - 6.82.0 + 6.83.1-SNAPSHOT proto-google-cloud-spanner-v1 PROTO library for proto-google-cloud-spanner-v1 com.google.cloud google-cloud-spanner-parent - 6.82.0 + 6.83.1-SNAPSHOT diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeCode.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeCode.java index 9c36f6c971..9db5e0c186 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeCode.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeCode.java @@ -228,6 +228,17 @@ public enum TypeCode implements com.google.protobuf.ProtocolMessageEnum { * INTERVAL = 16; */ INTERVAL(16), + /** + * + * + *
+   * Encoded as `string`, in lower-case hexa-decimal format, as described
+   * in RFC 9562, section 4.
+   * 
+ * + * UUID = 17; + */ + UUID(17), UNRECOGNIZED(-1), ; @@ -424,6 +435,17 @@ public enum TypeCode implements com.google.protobuf.ProtocolMessageEnum { * INTERVAL = 16; */ public static final int INTERVAL_VALUE = 16; + /** + * + * + *
+   * Encoded as `string`, in lower-case hexa-decimal format, as described
+   * in RFC 9562, section 4.
+   * 
+ * + * UUID = 17; + */ + public static final int UUID_VALUE = 17; public final int getNumber() { if (this == UNRECOGNIZED) { @@ -481,6 +503,8 @@ public static TypeCode forNumber(int value) { return ENUM; case 16: return INTERVAL; + case 17: + return UUID; default: return null; } diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeProto.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeProto.java index 3c41d2585b..e640269d99 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeProto.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeProto.java @@ -60,20 +60,20 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "pe_fqn\030\005 \001(\t\"\177\n\nStructType\0223\n\006fields\030\001 \003" + "(\0132#.google.spanner.v1.StructType.Field\032" + "<\n\005Field\022\014\n\004name\030\001 \001(\t\022%\n\004type\030\002 \001(\0132\027.g" - + "oogle.spanner.v1.Type*\325\001\n\010TypeCode\022\031\n\025TY" + + "oogle.spanner.v1.Type*\337\001\n\010TypeCode\022\031\n\025TY" + "PE_CODE_UNSPECIFIED\020\000\022\010\n\004BOOL\020\001\022\t\n\005INT64" + "\020\002\022\013\n\007FLOAT64\020\003\022\013\n\007FLOAT32\020\017\022\r\n\tTIMESTAM" + "P\020\004\022\010\n\004DATE\020\005\022\n\n\006STRING\020\006\022\t\n\005BYTES\020\007\022\t\n\005" + "ARRAY\020\010\022\n\n\006STRUCT\020\t\022\013\n\007NUMERIC\020\n\022\010\n\004JSON" - + "\020\013\022\t\n\005PROTO\020\r\022\010\n\004ENUM\020\016\022\014\n\010INTERVAL\020\020*d\n" - + "\022TypeAnnotationCode\022$\n TYPE_ANNOTATION_C" - + "ODE_UNSPECIFIED\020\000\022\016\n\nPG_NUMERIC\020\002\022\014\n\010PG_" - + "JSONB\020\003\022\n\n\006PG_OID\020\004B\254\001\n\025com.google.spann" - + "er.v1B\tTypeProtoP\001Z5cloud.google.com/go/" - + "spanner/apiv1/spannerpb;spannerpb\252\002\027Goog" - + "le.Cloud.Spanner.V1\312\002\027Google\\Cloud\\Spann" - + "er\\V1\352\002\032Google::Cloud::Spanner::V1b\006prot" - + "o3" + + "\020\013\022\t\n\005PROTO\020\r\022\010\n\004ENUM\020\016\022\014\n\010INTERVAL\020\020\022\010\n" + + "\004UUID\020\021*d\n\022TypeAnnotationCode\022$\n TYPE_AN" + + "NOTATION_CODE_UNSPECIFIED\020\000\022\016\n\nPG_NUMERI" + + "C\020\002\022\014\n\010PG_JSONB\020\003\022\n\n\006PG_OID\020\004B\254\001\n\025com.go" + + "ogle.spanner.v1B\tTypeProtoP\001Z5cloud.goog" + + "le.com/go/spanner/apiv1/spannerpb;spanne" + + "rpb\252\002\027Google.Cloud.Spanner.V1\312\002\027Google\\C" + + "loud\\Spanner\\V1\352\002\032Google::Cloud::Spanner" + + "::V1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( diff --git a/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/type.proto b/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/type.proto index 734cfb54cd..a8a73bf31e 100644 --- a/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/type.proto +++ b/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/type.proto @@ -175,6 +175,10 @@ enum TypeCode { // For example, `P1Y2M3DT4H5M6.5S` represents time duration of 1 year, 2 // months, 3 days, 4 hours, 5 minutes, and 6.5 seconds. INTERVAL = 16; + + // Encoded as `string`, in lower-case hexa-decimal format, as described + // in RFC 9562, section 4. + UUID = 17; } // `TypeAnnotationCode` is used as a part of [Type][google.spanner.v1.Type] to diff --git a/renovate.json b/renovate.json index 167bf279fe..3ad0aae27d 100644 --- a/renovate.json +++ b/renovate.json @@ -41,16 +41,6 @@ ], "depNameTemplate": "com.google.cloud:sdk-platform-java-config", "datasourceTemplate": "maven" - }, - { - "fileMatch": [ - "^.github/workflows/hermetic_library_generation.yaml$" - ], - "matchStrings": [ - "uses: googleapis/sdk-platform-java/.github/scripts@v(?.+?)\\n" - ], - "depNameTemplate": "com.google.api:gapic-generator-java", - "datasourceTemplate": "maven" } ], "packageRules": [ @@ -111,13 +101,6 @@ "^com.fasterxml.jackson.core" ], "groupName": "jackson dependencies" - }, - { - "matchPackagePatterns": [ - "^com.google.api:gapic-generator-java", - "^com.google.cloud:sdk-platform-java-config" - ], - "groupName": "SDK platform Java dependencies" } ], "semanticCommits": true, diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index cc7900ed24..0d6406bd32 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -147,6 +147,8 @@ maven-failsafe-plugin 3.5.2 + 10 + false java-sample-integration-tests java-client-mr-integration-tests @@ -157,6 +159,9 @@ mysample quick-db + + **/SpannerSampleIT.java + diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 9a6e4d0e30..772e830d5e 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -32,7 +32,7 @@ com.google.cloud google-cloud-spanner - 6.82.0 + 6.83.1-SNAPSHOT @@ -146,6 +146,8 @@ maven-failsafe-plugin 3.5.2 + 10 + false java-sample-integration-tests java-client-mr-integration-tests @@ -157,6 +159,9 @@ mysample-instance quick-db + + **/SpannerSampleIT.java + diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index df0488ac11..a137325f54 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -177,6 +177,8 @@ maven-failsafe-plugin 3.5.2 + 10 + false java-sample-integration-tests java-client-mr-integration-tests @@ -187,6 +189,9 @@ mysample quick-db + + **/SpannerSampleIT.java + diff --git a/versions.txt b/versions.txt index 745b2174e2..371f87c50c 100644 --- a/versions.txt +++ b/versions.txt @@ -1,13 +1,13 @@ # Format: # module:released-version:current-version -proto-google-cloud-spanner-admin-instance-v1:6.82.0:6.82.0 -proto-google-cloud-spanner-v1:6.82.0:6.82.0 -proto-google-cloud-spanner-admin-database-v1:6.82.0:6.82.0 -grpc-google-cloud-spanner-v1:6.82.0:6.82.0 -grpc-google-cloud-spanner-admin-instance-v1:6.82.0:6.82.0 -grpc-google-cloud-spanner-admin-database-v1:6.82.0:6.82.0 -google-cloud-spanner:6.82.0:6.82.0 -google-cloud-spanner-executor:6.82.0:6.82.0 -proto-google-cloud-spanner-executor-v1:6.82.0:6.82.0 -grpc-google-cloud-spanner-executor-v1:6.82.0:6.82.0 +proto-google-cloud-spanner-admin-instance-v1:6.83.0:6.83.1-SNAPSHOT +proto-google-cloud-spanner-v1:6.83.0:6.83.1-SNAPSHOT +proto-google-cloud-spanner-admin-database-v1:6.83.0:6.83.1-SNAPSHOT +grpc-google-cloud-spanner-v1:6.83.0:6.83.1-SNAPSHOT +grpc-google-cloud-spanner-admin-instance-v1:6.83.0:6.83.1-SNAPSHOT +grpc-google-cloud-spanner-admin-database-v1:6.83.0:6.83.1-SNAPSHOT +google-cloud-spanner:6.83.0:6.83.1-SNAPSHOT +google-cloud-spanner-executor:6.83.0:6.83.1-SNAPSHOT +proto-google-cloud-spanner-executor-v1:6.83.0:6.83.1-SNAPSHOT +grpc-google-cloud-spanner-executor-v1:6.83.0:6.83.1-SNAPSHOT