From 326442bca41700debcbeb67b6bd11fc36bd4f26d Mon Sep 17 00:00:00 2001 From: rahul2393 Date: Thu, 9 Jan 2025 19:08:44 +0530 Subject: [PATCH 01/10] feat: add LockHint feature (#3588) * feat: add LockHint feature * fix typo * updated logic to make sure lockHint get propagated only for ReadWriteTransaction * add warning message when using lock hint with unsupported transaction --- .../cloud/spanner/AbstractReadContext.java | 11 ++++ .../com/google/cloud/spanner/Options.java | 55 ++++++++++++++++++- .../spanner/AbstractReadContextTest.java | 16 ++++++ .../cloud/spanner/DatabaseClientImplTest.java | 49 +++++++++++++++++ .../com/google/cloud/spanner/OptionsTest.java | 35 +++++++++++- 5 files changed, 163 insertions(+), 3 deletions(-) diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractReadContext.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractReadContext.java index 4ceb72a466d..ea21266e19d 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractReadContext.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractReadContext.java @@ -58,6 +58,7 @@ import java.util.Map; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.atomic.AtomicLong; +import java.util.logging.Logger; import javax.annotation.Nullable; import javax.annotation.concurrent.GuardedBy; @@ -67,6 +68,7 @@ */ abstract class AbstractReadContext implements ReadContext, AbstractResultSet.Listener, SessionTransaction { + private static final Logger logger = Logger.getLogger(AbstractReadContext.class.getName()); abstract static class Builder, T extends AbstractReadContext> { private SessionImpl session; @@ -951,6 +953,15 @@ ResultSet readInternalWithOptions( } else if (defaultDirectedReadOptions != null) { builder.setDirectedReadOptions(defaultDirectedReadOptions); } + if (readOptions.hasLockHint()) { + if (isReadOnly()) { + logger.warning( + "Lock hint is only supported for ReadWrite transactions. " + + "Overriding lock hint to default unspecified."); + } else { + builder.setLockHint(readOptions.lockHint()); + } + } final int prefetchChunks = readOptions.hasPrefetchChunks() ? readOptions.prefetchChunks() : defaultPrefetchChunks; ResumableStreamIterator stream = diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Options.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Options.java index 9c3257586fb..c062e89ec2b 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Options.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Options.java @@ -18,6 +18,7 @@ import com.google.common.base.Preconditions; import com.google.spanner.v1.DirectedReadOptions; +import com.google.spanner.v1.ReadRequest.LockHint; import com.google.spanner.v1.ReadRequest.OrderBy; import com.google.spanner.v1.RequestOptions.Priority; import java.io.Serializable; @@ -75,6 +76,25 @@ public static RpcOrderBy fromProto(OrderBy proto) { } } + public enum RpcLockHint { + UNSPECIFIED(LockHint.LOCK_HINT_UNSPECIFIED), + SHARED(LockHint.LOCK_HINT_SHARED), + EXCLUSIVE(LockHint.LOCK_HINT_EXCLUSIVE); + + private final LockHint proto; + + RpcLockHint(LockHint proto) { + this.proto = Preconditions.checkNotNull(proto); + } + + public static RpcLockHint fromProto(LockHint proto) { + for (RpcLockHint e : RpcLockHint.values()) { + if (e.proto.equals(proto)) return e; + } + return RpcLockHint.UNSPECIFIED; + } + } + /** Marker interface to mark options applicable to both Read and Query operations */ public interface ReadAndQueryOption extends ReadOption, QueryOption {} @@ -160,6 +180,10 @@ public static ReadOption orderBy(RpcOrderBy orderBy) { return new OrderByOption(orderBy); } + public static ReadOption lockHint(RpcLockHint orderBy) { + return new LockHintOption(orderBy); + } + /** * Specifying this will allow the client to prefetch up to {@code prefetchChunks} {@code * PartialResultSet} chunks for read and query. The data size of each chunk depends on the server @@ -469,6 +493,7 @@ void appendToOptions(Options options) { private DirectedReadOptions directedReadOptions; private DecodeMode decodeMode; private RpcOrderBy orderBy; + private RpcLockHint lockHint; // Construction is via factory methods below. private Options() {} @@ -605,6 +630,14 @@ OrderBy orderBy() { return orderBy == null ? null : orderBy.proto; } + boolean hasLockHint() { + return lockHint != null; + } + + LockHint lockHint() { + return lockHint == null ? null : lockHint.proto; + } + @Override public String toString() { StringBuilder b = new StringBuilder(); @@ -661,6 +694,9 @@ public String toString() { if (orderBy != null) { b.append("orderBy: ").append(orderBy).append(' '); } + if (lockHint != null) { + b.append("lockHint: ").append(lockHint).append(' '); + } return b.toString(); } @@ -700,7 +736,8 @@ public boolean equals(Object o) { && Objects.equals(withExcludeTxnFromChangeStreams(), that.withExcludeTxnFromChangeStreams()) && Objects.equals(dataBoostEnabled(), that.dataBoostEnabled()) && Objects.equals(directedReadOptions(), that.directedReadOptions()) - && Objects.equals(orderBy(), that.orderBy()); + && Objects.equals(orderBy(), that.orderBy()) + && Objects.equals(lockHint(), that.lockHint()); } @Override @@ -760,6 +797,9 @@ public int hashCode() { if (orderBy != null) { result = 31 * result + orderBy.hashCode(); } + if (lockHint != null) { + result = 31 * result + lockHint.hashCode(); + } return result; } @@ -853,6 +893,19 @@ void appendToOptions(Options options) { } } + static class LockHintOption extends InternalOption implements ReadOption { + private final RpcLockHint lockHint; + + LockHintOption(RpcLockHint lockHint) { + this.lockHint = lockHint; + } + + @Override + void appendToOptions(Options options) { + options.lockHint = lockHint; + } + } + static final class DataBoostQueryOption extends InternalOption implements ReadAndQueryOption { private final Boolean dataBoostEnabled; diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/AbstractReadContextTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/AbstractReadContextTest.java index ce7d6b300d1..8b53bd7efff 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/AbstractReadContextTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/AbstractReadContextTest.java @@ -34,6 +34,7 @@ import com.google.spanner.v1.ExecuteSqlRequest.QueryMode; import com.google.spanner.v1.ExecuteSqlRequest.QueryOptions; import com.google.spanner.v1.ReadRequest; +import com.google.spanner.v1.ReadRequest.LockHint; import com.google.spanner.v1.ReadRequest.OrderBy; import com.google.spanner.v1.RequestOptions; import com.google.spanner.v1.RequestOptions.Priority; @@ -241,6 +242,21 @@ public void testGetReadRequestBuilderWithOrderBy() { assertEquals(OrderBy.ORDER_BY_NO_ORDER, request.getOrderBy()); } + @Test + public void testGetReadRequestBuilderWithLockHint() { + ReadRequest request = + ReadRequest.newBuilder() + .setSession( + SessionName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]").toString()) + .setTransaction(TransactionSelector.newBuilder().build()) + .setTable("table110115790") + .setIndex("index100346066") + .addAllColumns(new ArrayList()) + .setLockHintValue(2) + .build(); + assertEquals(LockHint.LOCK_HINT_EXCLUSIVE, request.getLockHint()); + } + @Test public void testGetExecuteBatchDmlRequestBuilderWithPriority() { ExecuteBatchDmlRequest.Builder request = diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseClientImplTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseClientImplTest.java index 1ee60509d55..1523a62fd7e 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseClientImplTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseClientImplTest.java @@ -52,6 +52,7 @@ import com.google.cloud.spanner.AsyncTransactionManager.TransactionContextFuture; import com.google.cloud.spanner.MockSpannerServiceImpl.SimulatedExecutionTime; import com.google.cloud.spanner.MockSpannerServiceImpl.StatementResult; +import com.google.cloud.spanner.Options.RpcLockHint; import com.google.cloud.spanner.Options.RpcOrderBy; import com.google.cloud.spanner.Options.RpcPriority; import com.google.cloud.spanner.Options.TransactionOption; @@ -90,6 +91,7 @@ import com.google.spanner.v1.ExecuteSqlRequest.QueryMode; import com.google.spanner.v1.ExecuteSqlRequest.QueryOptions; import com.google.spanner.v1.ReadRequest; +import com.google.spanner.v1.ReadRequest.LockHint; import com.google.spanner.v1.ReadRequest.OrderBy; import com.google.spanner.v1.RequestOptions.Priority; import com.google.spanner.v1.ResultSetMetadata; @@ -1754,6 +1756,53 @@ public void testExecuteReadWithOrderByOption() { assertEquals(OrderBy.ORDER_BY_NO_ORDER, request.getOrderBy()); } + @Test + public void testUnsupportedTransactionWithLockHintOption() { + DatabaseClient client = + spanner.getDatabaseClient(DatabaseId.of(TEST_PROJECT, TEST_INSTANCE, TEST_DATABASE)); + try (ResultSet resultSet = + client + .singleUse() + .read( + READ_TABLE_NAME, + KeySet.singleKey(Key.of(1L)), + READ_COLUMN_NAMES, + Options.lockHint(RpcLockHint.EXCLUSIVE))) { + consumeResults(resultSet); + } + + List requests = mockSpanner.getRequestsOfType(ReadRequest.class); + assertThat(requests).hasSize(1); + ReadRequest request = requests.get(0); + // lock hint is only supported in ReadWriteTransaction + assertEquals(LockHint.LOCK_HINT_UNSPECIFIED, request.getLockHint()); + } + + @Test + public void testReadWriteTransactionWithLockHint() { + DatabaseClient client = + spanner.getDatabaseClient(DatabaseId.of(TEST_PROJECT, TEST_INSTANCE, TEST_DATABASE)); + + TransactionRunner runner = client.readWriteTransaction(); + runner.run( + transaction -> { + try (ResultSet resultSet = + transaction.read( + READ_TABLE_NAME, + KeySet.singleKey(Key.of(1L)), + READ_COLUMN_NAMES, + Options.lockHint(RpcLockHint.EXCLUSIVE))) { + consumeResults(resultSet); + } + return null; + }); + + List requests = mockSpanner.getRequestsOfType(ReadRequest.class); + assertThat(requests).hasSize(1); + ReadRequest request = requests.get(0); + assertEquals(LockHint.LOCK_HINT_EXCLUSIVE, request.getLockHint()); + } + @Test public void testExecuteReadWithDirectedReadOptions() { DatabaseClient client = diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/OptionsTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/OptionsTest.java index 38b7a121731..f391088589f 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/OptionsTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/OptionsTest.java @@ -25,11 +25,13 @@ import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; +import com.google.cloud.spanner.Options.RpcLockHint; import com.google.cloud.spanner.Options.RpcOrderBy; import com.google.cloud.spanner.Options.RpcPriority; import com.google.spanner.v1.DirectedReadOptions; import com.google.spanner.v1.DirectedReadOptions.IncludeReplicas; import com.google.spanner.v1.DirectedReadOptions.ReplicaSelection; +import com.google.spanner.v1.ReadRequest.LockHint; import com.google.spanner.v1.ReadRequest.OrderBy; import com.google.spanner.v1.RequestOptions.Priority; import org.junit.Test; @@ -83,7 +85,8 @@ public void allOptionsPresent() { Options.prefetchChunks(1), Options.dataBoostEnabled(true), Options.directedRead(DIRECTED_READ_OPTIONS), - Options.orderBy(RpcOrderBy.NO_ORDER)); + Options.orderBy(RpcOrderBy.NO_ORDER), + Options.lockHint(Options.RpcLockHint.SHARED)); assertThat(options.hasLimit()).isTrue(); assertThat(options.limit()).isEqualTo(10); assertThat(options.hasPrefetchChunks()).isTrue(); @@ -92,6 +95,7 @@ public void allOptionsPresent() { assertTrue(options.dataBoostEnabled()); assertTrue(options.hasDirectedReadOptions()); assertTrue(options.hasOrderBy()); + assertTrue(options.hasLockHint()); assertEquals(DIRECTED_READ_OPTIONS, options.directedReadOptions()); } @@ -107,6 +111,7 @@ public void allOptionsAbsent() { assertThat(options.hasDataBoostEnabled()).isFalse(); assertThat(options.hasDirectedReadOptions()).isFalse(); assertThat(options.hasOrderBy()).isFalse(); + assertThat(options.hasLockHint()).isFalse(); assertNull(options.withExcludeTxnFromChangeStreams()); assertThat(options.toString()).isEqualTo(""); assertThat(options.equals(options)).isTrue(); @@ -189,7 +194,8 @@ public void readOptionsTest() { Options.tag(tag), Options.dataBoostEnabled(true), Options.directedRead(DIRECTED_READ_OPTIONS), - Options.orderBy(RpcOrderBy.NO_ORDER)); + Options.orderBy(RpcOrderBy.NO_ORDER), + Options.lockHint(RpcLockHint.SHARED)); assertThat(options.toString()) .isEqualTo( @@ -207,11 +213,15 @@ public void readOptionsTest() { + " " + "orderBy: " + RpcOrderBy.NO_ORDER + + " " + + "lockHint: " + + RpcLockHint.SHARED + " "); assertThat(options.tag()).isEqualTo(tag); assertEquals(dataBoost, options.dataBoostEnabled()); assertEquals(DIRECTED_READ_OPTIONS, options.directedReadOptions()); assertEquals(OrderBy.ORDER_BY_NO_ORDER, options.orderBy()); + assertEquals(LockHint.LOCK_HINT_SHARED, options.lockHint()); } @Test @@ -373,6 +383,14 @@ public void testReadOptionsOrderBy() { assertEquals("orderBy: " + orderBy + " ", options.toString()); } + @Test + public void testReadOptionsLockHint() { + RpcLockHint lockHint = RpcLockHint.SHARED; + Options options = Options.fromReadOptions(Options.lockHint(lockHint)); + assertTrue(options.hasLockHint()); + assertEquals("lockHint: " + lockHint + " ", options.toString()); + } + @Test public void testReadOptionsWithOrderByEquality() { Options optionsWithNoOrderBy1 = Options.fromReadOptions(Options.orderBy(RpcOrderBy.NO_ORDER)); @@ -383,6 +401,19 @@ public void testReadOptionsWithOrderByEquality() { assertFalse(optionsWithNoOrderBy1.equals(optionsWithPkOrder)); } + @Test + public void testReadOptionsWithLockHintEquality() { + Options optionsWithSharedLockHint1 = + Options.fromReadOptions(Options.lockHint(RpcLockHint.SHARED)); + Options optionsWithSharedLockHint2 = + Options.fromReadOptions(Options.lockHint(RpcLockHint.SHARED)); + assertEquals(optionsWithSharedLockHint1, optionsWithSharedLockHint2); + + Options optionsWithExclusiveLock = + Options.fromReadOptions(Options.lockHint(RpcLockHint.EXCLUSIVE)); + assertNotEquals(optionsWithSharedLockHint1, optionsWithExclusiveLock); + } + @Test public void testQueryOptionsPriority() { RpcPriority priority = RpcPriority.MEDIUM; From 173da640de72751826cc46a6c16b3be0e6143868 Mon Sep 17 00:00:00 2001 From: cloud-java-bot <122572305+cloud-java-bot@users.noreply.github.com> Date: Thu, 9 Jan 2025 11:31:44 -0500 Subject: [PATCH 02/10] chore: Update generation configuration at Thu Jan 9 02:35:11 UTC 2025 (#3587) * chore: Update generation configuration at Wed Jan 8 17:05:33 UTC 2025 * chore: Update generation configuration at Thu Jan 9 02:35:11 UTC 2025 --- generation_config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generation_config.yaml b/generation_config.yaml index d2f7d5eebaf..28f408df692 100644 --- a/generation_config.yaml +++ b/generation_config.yaml @@ -1,5 +1,5 @@ gapic_generator_version: 2.51.0 -googleapis_commitish: c72d7385435589176aa6e44563fcfbc795b9a476 +googleapis_commitish: 00196e2a68b16a864c57db2e870822875a7f1198 libraries_bom_version: 26.52.0 libraries: - api_shortname: spanner From e4d0b0ffa2308c8d949630b52c67e3b79c4491fb Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 9 Jan 2025 18:00:38 +0100 Subject: [PATCH 03/10] deps: update dependency com.google.api.grpc:proto-google-cloud-monitoring-v3 to v3.56.0 (#3563) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.api.grpc:proto-google-cloud-monitoring-v3](https://redirect.github.com/googleapis/google-cloud-java) | `3.55.0` -> `3.56.0` | [![age](https://developer.mend.io/api/mc/badges/age/maven/com.google.api.grpc:proto-google-cloud-monitoring-v3/3.56.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/com.google.api.grpc:proto-google-cloud-monitoring-v3/3.56.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/com.google.api.grpc:proto-google-cloud-monitoring-v3/3.55.0/3.56.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/com.google.api.grpc:proto-google-cloud-monitoring-v3/3.55.0/3.56.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/googleapis/java-spanner). --- google-cloud-spanner/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google-cloud-spanner/pom.xml b/google-cloud-spanner/pom.xml index 2e93e6e5227..1d8c6cbcc8d 100644 --- a/google-cloud-spanner/pom.xml +++ b/google-cloud-spanner/pom.xml @@ -270,7 +270,7 @@ com.google.api.grpc proto-google-cloud-monitoring-v3 - 3.55.0 + 3.56.0 com.google.auth From 2cd42388370dac004bfd807f6aede3ba45456706 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Fri, 10 Jan 2025 05:04:56 +0100 Subject: [PATCH 04/10] deps: update dependency com.google.cloud:sdk-platform-java-config to v3.41.1 (#3589) --- .github/workflows/unmanaged_dependency_check.yaml | 2 +- .kokoro/presubmit/graalvm-native-17.cfg | 2 +- .kokoro/presubmit/graalvm-native.cfg | 2 +- google-cloud-spanner-bom/pom.xml | 2 +- pom.xml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/unmanaged_dependency_check.yaml b/.github/workflows/unmanaged_dependency_check.yaml index f62b0af0eb1..6bf8adf0b53 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.41.0 + uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v3.41.1 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 76ca3ee6daf..9705694f834 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.41.0" + value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.41.1" } env_vars: { diff --git a/.kokoro/presubmit/graalvm-native.cfg b/.kokoro/presubmit/graalvm-native.cfg index 644bb62ce7d..b070666b48e 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.41.0" + value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.41.1" } env_vars: { diff --git a/google-cloud-spanner-bom/pom.xml b/google-cloud-spanner-bom/pom.xml index 0416dc94151..ddd725c1473 100644 --- a/google-cloud-spanner-bom/pom.xml +++ b/google-cloud-spanner-bom/pom.xml @@ -8,7 +8,7 @@ com.google.cloud sdk-platform-java-config - 3.41.0 + 3.41.1 Google Cloud Spanner BOM diff --git a/pom.xml b/pom.xml index 9945c18137e..30f948fee40 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ com.google.cloud sdk-platform-java-config - 3.41.0 + 3.41.1 From 3daa1a0c735000845558a1d3612257a7d0524350 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Fri, 10 Jan 2025 06:04:00 +0100 Subject: [PATCH 05/10] deps: update googleapis/sdk-platform-java action to v2.51.1 (#3591) --- .github/workflows/hermetic_library_generation.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hermetic_library_generation.yaml b/.github/workflows/hermetic_library_generation.yaml index 604b674bad9..c1be8aca557 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.51.0 + - uses: googleapis/sdk-platform-java/.github/scripts@v2.51.1 if: env.SHOULD_RUN == 'true' with: base_ref: ${{ github.base_ref }} From a7542daff466226221eeb9a885a2e67a99adb678 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Fri, 10 Jan 2025 07:36:06 +0100 Subject: [PATCH 06/10] deps: update dependency com.google.api.grpc:proto-google-cloud-monitoring-v3 to v3.57.0 (#3592) --- google-cloud-spanner/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google-cloud-spanner/pom.xml b/google-cloud-spanner/pom.xml index 1d8c6cbcc8d..35616131fea 100644 --- a/google-cloud-spanner/pom.xml +++ b/google-cloud-spanner/pom.xml @@ -270,7 +270,7 @@ com.google.api.grpc proto-google-cloud-monitoring-v3 - 3.56.0 + 3.57.0 com.google.auth From 9ab4c9fd18eb19bc00679e2ad1b8ba0844a541ed Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Fri, 10 Jan 2025 07:36:24 +0100 Subject: [PATCH 07/10] chore(deps): update dependency com.google.cloud:google-cloud-spanner to v6.84.0 (#3491) --- benchmarks/pom.xml | 2 +- samples/install-without-bom/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmarks/pom.xml b/benchmarks/pom.xml index 27f32c0e9c8..a1d0bf57483 100644 --- a/benchmarks/pom.xml +++ b/benchmarks/pom.xml @@ -92,7 +92,7 @@ com.google.cloud google-cloud-spanner - 6.81.1 + 6.84.0 commons-cli diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 0d6406bd321..548ffdf8fd2 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -33,7 +33,7 @@ com.google.cloud google-cloud-spanner - 6.81.1 + 6.84.0 From 7893f2499f6a43e4e80ec78a9f0da5beedb6967a Mon Sep 17 00:00:00 2001 From: surbhigarg92 Date: Fri, 10 Jan 2025 12:56:27 +0530 Subject: [PATCH 08/10] feat: add gcp client attributes in OpenTelemetry traces (#3595) --- README.md | 2 +- .../java/com/google/cloud/spanner/TraceWrapper.java | 10 ++++++++++ .../google/cloud/spanner/OpenTelemetrySpanTest.java | 8 ++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a64487c221e..0718c5d7de8 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ If you are using Maven without the BOM, add this to your dependencies: com.google.cloud google-cloud-spanner - 6.81.1 + 6.84.0 ``` diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/TraceWrapper.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/TraceWrapper.java index 3e01eec1fb2..606a54fe8b7 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/TraceWrapper.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/TraceWrapper.java @@ -16,6 +16,7 @@ package com.google.cloud.spanner; +import com.google.api.gax.core.GaxProperties; import com.google.cloud.spanner.Options.TagOption; import com.google.cloud.spanner.Options.TransactionOption; import com.google.cloud.spanner.SpannerOptions.TracingFramework; @@ -46,6 +47,12 @@ class TraceWrapper { private static final AttributeKey> DB_STATEMENT_ARRAY_KEY = AttributeKey.stringArrayKey("db.statement"); private static final AttributeKey DB_TABLE_NAME_KEY = AttributeKey.stringKey("db.table"); + private static final AttributeKey GCP_CLIENT_SERVICE_KEY = + AttributeKey.stringKey("gcp.client.service"); + private static final AttributeKey GCP_CLIENT_VERSION_KEY = + AttributeKey.stringKey("gcp.client.version"); + private static final AttributeKey GCP_CLIENT_REPO_KEY = + AttributeKey.stringKey("gcp.client.repo"); private static final AttributeKey THREAD_NAME_KEY = AttributeKey.stringKey("thread.name"); private final Tracer openCensusTracer; @@ -204,6 +211,9 @@ Attributes createCommonAttributes(DatabaseId db) { AttributesBuilder builder = Attributes.builder(); builder.put(DB_NAME_KEY, db.getDatabase()); builder.put(INSTANCE_NAME_KEY, db.getInstanceId().getInstance()); + builder.put(GCP_CLIENT_SERVICE_KEY, "spanner"); + builder.put(GCP_CLIENT_REPO_KEY, "googleapis/java-spanner"); + builder.put(GCP_CLIENT_VERSION_KEY, GaxProperties.getLibraryVersion(TraceWrapper.class)); return builder.build(); } diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/OpenTelemetrySpanTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/OpenTelemetrySpanTest.java index 27e9cdb31f9..cbc449815e7 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/OpenTelemetrySpanTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/OpenTelemetrySpanTest.java @@ -21,6 +21,7 @@ import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; +import com.google.api.gax.core.GaxProperties; import com.google.api.gax.grpc.testing.LocalChannelProvider; import com.google.cloud.NoCredentials; import com.google.cloud.spanner.MockSpannerServiceImpl.StatementResult; @@ -871,6 +872,13 @@ private static void verifySpans(List actualSpanItems, List expec private static void verifyCommonAttributes(SpanData span) { assertEquals(span.getAttributes().get(AttributeKey.stringKey("instance.name")), "my-instance"); assertEquals(span.getAttributes().get(AttributeKey.stringKey("db.name")), "my-database"); + assertEquals(span.getAttributes().get(AttributeKey.stringKey("gcp.client.service")), "spanner"); + assertEquals( + span.getAttributes().get(AttributeKey.stringKey("gcp.client.repo")), + "googleapis/java-spanner"); + assertEquals( + span.getAttributes().get(AttributeKey.stringKey("gcp.client.version")), + GaxProperties.getLibraryVersion(TraceWrapper.class)); } private static void verifyTableAttributes(SpanData span) { From 0f2013d66d3fd14e6be019cda6745ddc32032091 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Fri, 10 Jan 2025 09:56:38 +0100 Subject: [PATCH 09/10] deps: update dependency com.google.re2j:re2j to v1.8 (#3594) --- benchmarks/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmarks/pom.xml b/benchmarks/pom.xml index a1d0bf57483..aca7a32a55e 100644 --- a/benchmarks/pom.xml +++ b/benchmarks/pom.xml @@ -80,7 +80,7 @@ com.google.re2j re2j - 1.7 + 1.8 io.opentelemetry From a5f9e7a3abcd903cf8101fb943362cd5a2c78100 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 10 Jan 2025 09:40:30 +0000 Subject: [PATCH 10/10] chore(main): release 6.84.1-SNAPSHOT (#3583) :robot: I have created a release *beep* *boop* --- ### Updating meta-information for bleeding-edge SNAPSHOT release. --- This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please). --- benchmarks/pom.xml | 2 +- google-cloud-spanner-bom/pom.xml | 18 ++++++++--------- google-cloud-spanner-executor/pom.xml | 4 ++-- google-cloud-spanner/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- grpc-google-cloud-spanner-executor-v1/pom.xml | 4 ++-- grpc-google-cloud-spanner-v1/pom.xml | 4 ++-- pom.xml | 20 +++++++++---------- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- proto-google-cloud-spanner-v1/pom.xml | 4 ++-- samples/snapshot/pom.xml | 2 +- versions.txt | 20 +++++++++---------- 15 files changed, 51 insertions(+), 51 deletions(-) diff --git a/benchmarks/pom.xml b/benchmarks/pom.xml index aca7a32a55e..3aa5216c9dd 100644 --- a/benchmarks/pom.xml +++ b/benchmarks/pom.xml @@ -24,7 +24,7 @@ com.google.cloud google-cloud-spanner-parent - 6.84.0 + 6.84.1-SNAPSHOT diff --git a/google-cloud-spanner-bom/pom.xml b/google-cloud-spanner-bom/pom.xml index ddd725c1473..21b8d57f6b4 100644 --- a/google-cloud-spanner-bom/pom.xml +++ b/google-cloud-spanner-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-spanner-bom - 6.84.0 + 6.84.1-SNAPSHOT pom com.google.cloud @@ -53,43 +53,43 @@ com.google.cloud google-cloud-spanner - 6.84.0 + 6.84.1-SNAPSHOT com.google.cloud google-cloud-spanner test-jar - 6.84.0 + 6.84.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-v1 - 6.84.0 + 6.84.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-admin-instance-v1 - 6.84.0 + 6.84.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-admin-database-v1 - 6.84.0 + 6.84.1-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-admin-instance-v1 - 6.84.0 + 6.84.1-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-v1 - 6.84.0 + 6.84.1-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-admin-database-v1 - 6.84.0 + 6.84.1-SNAPSHOT diff --git a/google-cloud-spanner-executor/pom.xml b/google-cloud-spanner-executor/pom.xml index 07cb7db2abc..718788fae96 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.84.0 + 6.84.1-SNAPSHOT jar Google Cloud Spanner Executor com.google.cloud google-cloud-spanner-parent - 6.84.0 + 6.84.1-SNAPSHOT diff --git a/google-cloud-spanner/pom.xml b/google-cloud-spanner/pom.xml index 35616131fea..ac2c6d14d54 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.84.0 + 6.84.1-SNAPSHOT jar Google Cloud Spanner https://github.com/googleapis/java-spanner @@ -11,7 +11,7 @@ com.google.cloud google-cloud-spanner-parent - 6.84.0 + 6.84.1-SNAPSHOT google-cloud-spanner diff --git a/grpc-google-cloud-spanner-admin-database-v1/pom.xml b/grpc-google-cloud-spanner-admin-database-v1/pom.xml index 79a7ca08bee..8842bd0682a 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.84.0 + 6.84.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.84.0 + 6.84.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 435cf44ff07..b0a44c1ca32 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.84.0 + 6.84.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.84.0 + 6.84.1-SNAPSHOT diff --git a/grpc-google-cloud-spanner-executor-v1/pom.xml b/grpc-google-cloud-spanner-executor-v1/pom.xml index c0bc1b9b837..945b07b7c51 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.84.0 + 6.84.1-SNAPSHOT grpc-google-cloud-spanner-executor-v1 GRPC library for google-cloud-spanner com.google.cloud google-cloud-spanner-parent - 6.84.0 + 6.84.1-SNAPSHOT diff --git a/grpc-google-cloud-spanner-v1/pom.xml b/grpc-google-cloud-spanner-v1/pom.xml index 722150cf6c7..13167d07bfc 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.84.0 + 6.84.1-SNAPSHOT grpc-google-cloud-spanner-v1 GRPC library for grpc-google-cloud-spanner-v1 com.google.cloud google-cloud-spanner-parent - 6.84.0 + 6.84.1-SNAPSHOT diff --git a/pom.xml b/pom.xml index 30f948fee40..23626ec8aa8 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-spanner-parent pom - 6.84.0 + 6.84.1-SNAPSHOT Google Cloud Spanner Parent https://github.com/googleapis/java-spanner @@ -61,47 +61,47 @@ com.google.api.grpc proto-google-cloud-spanner-admin-instance-v1 - 6.84.0 + 6.84.1-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-executor-v1 - 6.84.0 + 6.84.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-executor-v1 - 6.84.0 + 6.84.1-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-v1 - 6.84.0 + 6.84.1-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-admin-database-v1 - 6.84.0 + 6.84.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-v1 - 6.84.0 + 6.84.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-admin-instance-v1 - 6.84.0 + 6.84.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-admin-database-v1 - 6.84.0 + 6.84.1-SNAPSHOT com.google.cloud google-cloud-spanner - 6.84.0 + 6.84.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 b23496331a3..141130bdceb 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.84.0 + 6.84.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.84.0 + 6.84.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 76ccb0cf4b1..a1ccf63b518 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.84.0 + 6.84.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.84.0 + 6.84.1-SNAPSHOT diff --git a/proto-google-cloud-spanner-executor-v1/pom.xml b/proto-google-cloud-spanner-executor-v1/pom.xml index 301f105837f..3a8f38bddaa 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.84.0 + 6.84.1-SNAPSHOT proto-google-cloud-spanner-executor-v1 Proto library for google-cloud-spanner com.google.cloud google-cloud-spanner-parent - 6.84.0 + 6.84.1-SNAPSHOT diff --git a/proto-google-cloud-spanner-v1/pom.xml b/proto-google-cloud-spanner-v1/pom.xml index f42ee2b3e90..36af9f00a0c 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.84.0 + 6.84.1-SNAPSHOT proto-google-cloud-spanner-v1 PROTO library for proto-google-cloud-spanner-v1 com.google.cloud google-cloud-spanner-parent - 6.84.0 + 6.84.1-SNAPSHOT diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index f44821f2838..7fa7369cece 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -32,7 +32,7 @@ com.google.cloud google-cloud-spanner - 6.84.0 + 6.84.1-SNAPSHOT diff --git a/versions.txt b/versions.txt index 52488f51531..2b5ef8bd9e8 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.84.0:6.84.0 -proto-google-cloud-spanner-v1:6.84.0:6.84.0 -proto-google-cloud-spanner-admin-database-v1:6.84.0:6.84.0 -grpc-google-cloud-spanner-v1:6.84.0:6.84.0 -grpc-google-cloud-spanner-admin-instance-v1:6.84.0:6.84.0 -grpc-google-cloud-spanner-admin-database-v1:6.84.0:6.84.0 -google-cloud-spanner:6.84.0:6.84.0 -google-cloud-spanner-executor:6.84.0:6.84.0 -proto-google-cloud-spanner-executor-v1:6.84.0:6.84.0 -grpc-google-cloud-spanner-executor-v1:6.84.0:6.84.0 +proto-google-cloud-spanner-admin-instance-v1:6.84.0:6.84.1-SNAPSHOT +proto-google-cloud-spanner-v1:6.84.0:6.84.1-SNAPSHOT +proto-google-cloud-spanner-admin-database-v1:6.84.0:6.84.1-SNAPSHOT +grpc-google-cloud-spanner-v1:6.84.0:6.84.1-SNAPSHOT +grpc-google-cloud-spanner-admin-instance-v1:6.84.0:6.84.1-SNAPSHOT +grpc-google-cloud-spanner-admin-database-v1:6.84.0:6.84.1-SNAPSHOT +google-cloud-spanner:6.84.0:6.84.1-SNAPSHOT +google-cloud-spanner-executor:6.84.0:6.84.1-SNAPSHOT +proto-google-cloud-spanner-executor-v1:6.84.0:6.84.1-SNAPSHOT +grpc-google-cloud-spanner-executor-v1:6.84.0:6.84.1-SNAPSHOT