From 8244ad258a90e5bbc7e7d8ec384555b2be84ab8f Mon Sep 17 00:00:00 2001 From: cloud-java-bot <122572305+cloud-java-bot@users.noreply.github.com> Date: Wed, 20 Nov 2024 12:50:00 -0500 Subject: [PATCH 01/10] chore: Update generation configuration at Wed Nov 20 02:25:57 UTC 2024 (#1669) * chore: Update generation configuration at Tue Nov 19 02:26:26 UTC 2024 * chore: generate libraries at Tue Nov 19 02:27:03 UTC 2024 * chore: Update generation configuration at Wed Nov 20 02:25:57 UTC 2024 --- README.md | 6 +- generation_config.yaml | 2 +- .../admin/v1/DatastoreAdminSettings.java | 2 +- .../v1/stub/DatastoreAdminStubSettings.java | 60 +++++++++---------- 4 files changed, 35 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 536b57f4c..f059e75ed 100644 --- a/README.md +++ b/README.md @@ -56,13 +56,13 @@ implementation 'com.google.cloud:google-cloud-datastore' If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-datastore:2.24.2' +implementation 'com.google.cloud:google-cloud-datastore:2.24.3' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-datastore" % "2.24.2" +libraryDependencies += "com.google.cloud" % "google-cloud-datastore" % "2.24.3" ``` ## Authentication @@ -479,7 +479,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-datastore/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-datastore.svg -[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-datastore/2.24.2 +[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-datastore/2.24.3 [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/generation_config.yaml b/generation_config.yaml index 029446537..b9de0b019 100644 --- a/generation_config.yaml +++ b/generation_config.yaml @@ -1,5 +1,5 @@ gapic_generator_version: 2.50.0 -googleapis_commitish: 0b5613ee74c9558dd284aa2b01a585ce297c0045 +googleapis_commitish: a547fc1420eb0a0f3ae32b0a4eb72d3b8b17d136 libraries_bom_version: 26.50.0 libraries: - api_shortname: datastore diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/DatastoreAdminSettings.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/DatastoreAdminSettings.java index cafef310e..4db454e20 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/DatastoreAdminSettings.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/DatastoreAdminSettings.java @@ -117,7 +117,7 @@ * RetrySettings.newBuilder() * .setInitialRetryDelayDuration(Duration.ofMillis(500)) * .setRetryDelayMultiplier(1.5) - * .setMaxRetryDelay(Duration.ofMillis(5000)) + * .setMaxRetryDelayDuration(Duration.ofMillis(5000)) * .setTotalTimeoutDuration(Duration.ofHours(24)) * .build()); * datastoreAdminSettingsBuilder diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/stub/DatastoreAdminStubSettings.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/stub/DatastoreAdminStubSettings.java index 82df00c03..aa10d582f 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/stub/DatastoreAdminStubSettings.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/stub/DatastoreAdminStubSettings.java @@ -67,9 +67,9 @@ import com.google.longrunning.Operation; import com.google.protobuf.Empty; import java.io.IOException; +import java.time.Duration; import java.util.List; import javax.annotation.Generated; -import org.threeten.bp.Duration; // AUTO-GENERATED DOCUMENTATION AND CLASS. /** @@ -138,7 +138,7 @@ * RetrySettings.newBuilder() * .setInitialRetryDelayDuration(Duration.ofMillis(500)) * .setRetryDelayMultiplier(1.5) - * .setMaxRetryDelay(Duration.ofMillis(5000)) + * .setMaxRetryDelayDuration(Duration.ofMillis(5000)) * .setTotalTimeoutDuration(Duration.ofHours(24)) * .build()); * datastoreAdminSettingsBuilder @@ -449,21 +449,21 @@ public static class Builder extends StubSettings.Builder Date: Wed, 20 Nov 2024 13:35:07 -0500 Subject: [PATCH 02/10] chore: make library generation required (#1672) * chore: make library generation required * chore: generate libraries at Tue Nov 19 22:29:32 UTC 2024 --------- Co-authored-by: cloud-java-bot --- .github/sync-repo-settings.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml index fce568dc2..bd6908f91 100644 --- a/.github/sync-repo-settings.yaml +++ b/.github/sync-repo-settings.yaml @@ -18,6 +18,7 @@ branchProtectionRules: - 'Kokoro - Test: Java GraalVM Native Image' - 'Kokoro - Test: Java 17 GraalVM Native Image' - javadoc + - library_generation - pattern: 1.106.5-sp isAdminEnforced: true requiredApprovingReviewCount: 1 From 593c50c34849c0f967822e05bfd3859eacedd99c Mon Sep 17 00:00:00 2001 From: Cindy Peng <148148319+cindy-peng@users.noreply.github.com> Date: Wed, 20 Nov 2024 16:21:56 -0800 Subject: [PATCH 03/10] chore: disable V3-experimental branch rules (#1668) * chore:Disable v3-experimental branch rules * chore: generate libraries at Tue Nov 19 00:24:17 UTC 2024 --------- Co-authored-by: cloud-java-bot --- .github/dependabot.yml | 13 +------------ .github/sync-repo-settings.yaml | 16 ---------------- 2 files changed, 1 insertion(+), 28 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 3a7c9a454..2afe7bfe7 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -17,15 +17,4 @@ updates: # If a security vulnerability comes in, we will be notified about # it via template in the synthtool repository. ignore: - - dependency-name: "*" - - # rules for the `V3-experimental` branch - - package-ecosystem: maven - directory: "/" - schedule: - interval: daily - commit-message: - # Prefix all commit messages with "deps: " - prefix: "deps" - open-pull-requests-limit: 10 - target-branch: "V3-experimental" + - dependency-name: "*" \ No newline at end of file diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml index bd6908f91..ab421dce5 100644 --- a/.github/sync-repo-settings.yaml +++ b/.github/sync-repo-settings.yaml @@ -108,22 +108,6 @@ branchProtectionRules: - cla/google - 'Kokoro - Test: Java GraalVM Native Image' - 'Kokoro - Test: Java 17 GraalVM Native Image' - - pattern: V3-experimental - isAdminEnforced: true - requiredApprovingReviewCount: 1 - requiresCodeOwnerReviews: true - requiresStrictStatusChecks: false - requiredStatusCheckContexts: - - dependencies (17) - - lint - - clirr - - units (8) - - units (11) - - 'Kokoro - Test: Integration' - - cla/google - - 'Kokoro - Test: Java GraalVM Native Image' - - 'Kokoro - Test: Java 17 GraalVM Native Image' - - javadoc - pattern: 2.15.x isAdminEnforced: true requiredApprovingReviewCount: 1 From 5a78a8075867f4b2fc598f0423bd2ab65b559856 Mon Sep 17 00:00:00 2001 From: Diego Marquez Date: Wed, 27 Nov 2024 19:06:20 -0500 Subject: [PATCH 04/10] feat: introduce `java.time` methods and variables (#1671) This PR introduces `java.time` alternatives to existing `org.threeten.bp.*` methods, as well as switching internal variables (if any) to `java.time` The main constraint is to keep the changes backwards compatible, so for each existing threeten method "`method1(org.threeten.bp.Duration)`" we will add an alternative with a _Duration_ (or _Timestamp_ when applicable) suffix: "`method1Duration(java.time.Duration)`". For most cases, the implementation will be held in the `java.time` method and the old threeten method will just delegate the call to it. However, for the case of abstract classes, the implementation will be kept in the threeten method to avoid breaking changes (i.e. users that already overloaded the method in their user code). --- .../datastore/models/ExecutionStats.java | 16 ++++++++++---- .../testing/LocalDatastoreHelper.java | 22 ++++++++++++++----- .../google/cloud/datastore/DatastoreTest.java | 4 ++-- .../cloud/datastore/it/ITDatastoreTest.java | 4 ++-- .../datastore/models/ExecutionStatsTest.java | 4 ++-- .../testing/ITLocalDatastoreHelperTest.java | 6 ++--- .../testing/RemoteDatastoreHelper.java | 12 +++++----- .../datastore/snippets/ConceptsTest.java | 3 +-- 8 files changed, 44 insertions(+), 27 deletions(-) diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/models/ExecutionStats.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/models/ExecutionStats.java index 52184a01a..6738d84e3 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/models/ExecutionStats.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/models/ExecutionStats.java @@ -15,25 +15,27 @@ */ package com.google.cloud.datastore.models; +import static com.google.api.gax.util.TimeConversionUtils.toThreetenDuration; + import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; +import com.google.api.core.ObsoleteApi; import com.google.cloud.Structs; import com.google.common.base.Objects; import java.util.Map; -import org.threeten.bp.Duration; /** Model class for {@link com.google.datastore.v1.ExecutionStats} */ @BetaApi public class ExecutionStats { private final long resultsReturned; - private final Duration executionDuration; + private final java.time.Duration executionDuration; private final long readOperations; private final Map debugStats; @InternalApi public ExecutionStats(com.google.datastore.v1.ExecutionStats proto) { this.resultsReturned = proto.getResultsReturned(); - this.executionDuration = Duration.ofNanos(proto.getExecutionDuration().getNanos()); + this.executionDuration = java.time.Duration.ofNanos(proto.getExecutionDuration().getNanos()); this.readOperations = proto.getReadOperations(); this.debugStats = Structs.asMap(proto.getDebugStats()); } @@ -51,8 +53,14 @@ public Map getDebugStats() { return debugStats; } + /** This method is obsolete. Use {@link #getExecutionDurationJavaTime()} instead. */ + @ObsoleteApi("Use getExecutionDurationJavaTime() instead") + public org.threeten.bp.Duration getExecutionDuration() { + return toThreetenDuration(getExecutionDurationJavaTime()); + } + /** Returns the total time to execute the query in the backend. */ - public Duration getExecutionDuration() { + public java.time.Duration getExecutionDurationJavaTime() { return executionDuration; } diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/testing/LocalDatastoreHelper.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/testing/LocalDatastoreHelper.java index 2723325ee..32bf9611c 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/testing/LocalDatastoreHelper.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/testing/LocalDatastoreHelper.java @@ -16,9 +16,11 @@ package com.google.cloud.datastore.testing; +import static com.google.api.gax.util.TimeConversionUtils.toJavaTimeDuration; import static com.google.common.base.MoreObjects.firstNonNull; import com.google.api.core.InternalApi; +import com.google.api.core.ObsoleteApi; import com.google.cloud.NoCredentials; import com.google.cloud.ServiceOptions; import com.google.cloud.datastore.DatastoreOptions; @@ -38,7 +40,6 @@ import java.util.UUID; import java.util.concurrent.TimeoutException; import java.util.logging.Logger; -import org.threeten.bp.Duration; /** * Utility to start and stop local Google Cloud Datastore emulators. @@ -307,6 +308,14 @@ public void reset() throws IOException { sendPostRequest("/reset"); } + /** This method is obsolete. Use {@link #stopDuration(java.time.Duration)} instead */ + @ObsoleteApi("Use stopDuration(java.time.Duration) instead") + @Override + public void stop(org.threeten.bp.Duration timeout) + throws IOException, InterruptedException, TimeoutException { + stopDuration(toJavaTimeDuration(timeout)); + } + /** * Stops the Datastore emulator. * @@ -319,15 +328,16 @@ public void reset() throws IOException { * this value high to ensure proper shutdown, like 5 seconds or more. */ @Override - public void stop(Duration timeout) throws IOException, InterruptedException, TimeoutException { + public void stopDuration(java.time.Duration timeout) + throws IOException, InterruptedException, TimeoutException { sendPostRequest("/shutdown"); - waitForProcess(timeout); + waitForProcessDuration(timeout); deleteRecursively(gcdPath); } /** - * Stops the Datastore emulator. The same as {@link #stop(Duration)} but with timeout duration of - * 20 seconds. + * Stops the Datastore emulator. The same as {@link #stopDuration(java.time.Duration)} but with + * timeout duration of 20 seconds. * *

It is important to stop the emulator. Since the emulator runs in its own process, not * stopping it might cause it to become orphan. @@ -335,7 +345,7 @@ public void stop(Duration timeout) throws IOException, InterruptedException, Tim *

It is not required to call {@link #reset()} before {@code stop()}. */ public void stop() throws IOException, InterruptedException, TimeoutException { - stop(Duration.ofSeconds(20)); + stopDuration(java.time.Duration.ofSeconds(20)); } static void deleteRecursively(Path path) throws IOException { diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreTest.java index d88e1d1ec..459278f25 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreTest.java @@ -68,6 +68,7 @@ import com.google.datastore.v1.TransactionOptions; import com.google.protobuf.ByteString; import java.io.IOException; +import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -87,7 +88,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import org.threeten.bp.Duration; @RunWith(JUnit4.class) public class DatastoreTest { @@ -193,7 +193,7 @@ public void setUp() { @AfterClass public static void afterClass() throws IOException, InterruptedException, TimeoutException { - helper.stop(Duration.ofMinutes(1)); + helper.stopDuration(Duration.ofMinutes(1)); } @Test diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITDatastoreTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITDatastoreTest.java index c012d28c9..bf0c20dce 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITDatastoreTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITDatastoreTest.java @@ -81,6 +81,7 @@ import com.google.common.truth.Truth; import com.google.datastore.v1.TransactionOptions; import com.google.datastore.v1.TransactionOptions.ReadOnly; +import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -103,7 +104,6 @@ import org.junit.rules.Timeout; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -import org.threeten.bp.Duration; @RunWith(Parameterized.class) public class ITDatastoreTest { @@ -674,7 +674,7 @@ private void assertExecutionStats( Truth.assertThat(debugStats.get("index_entries_scanned")) .isEqualTo(expectedIndexEntriesScanned); - Duration executionDuration = executionStats.getExecutionDuration(); + Duration executionDuration = executionStats.getExecutionDurationJavaTime(); Truth.assertThat(executionDuration).isIn(Range.greaterThan(Duration.ofMillis(0))); long readOperations = executionStats.getReadOperations(); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/models/ExecutionStatsTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/models/ExecutionStatsTest.java index 4706e3b86..a0e778cee 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/models/ExecutionStatsTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/models/ExecutionStatsTest.java @@ -41,8 +41,8 @@ public class ExecutionStatsTest { @Test public void testModel() { Truth.assertThat(executionStats.getDebugStats()).isEqualTo(Structs.asMap(struct)); - Truth.assertThat(executionStats.getExecutionDuration()) - .isEqualTo(org.threeten.bp.Duration.ofNanos(duration.getNanos())); + Truth.assertThat(executionStats.getExecutionDurationJavaTime()) + .isEqualTo(java.time.Duration.ofNanos(duration.getNanos())); Truth.assertThat(executionStats.getReadOperations()).isEqualTo(2); Truth.assertThat(executionStats.getResultsReturned()).isEqualTo(3); } diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/testing/ITLocalDatastoreHelperTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/testing/ITLocalDatastoreHelperTest.java index 3ebd3ef4a..dfa2255a0 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/testing/ITLocalDatastoreHelperTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/testing/ITLocalDatastoreHelperTest.java @@ -32,6 +32,7 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; +import java.time.Duration; import java.util.concurrent.TimeoutException; import org.junit.After; import org.junit.Assert; @@ -39,7 +40,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import org.threeten.bp.Duration; @RunWith(JUnit4.class) public class ITLocalDatastoreHelperTest { @@ -178,7 +178,7 @@ public void testStartStopReset() throws IOException, InterruptedException, Timeo assertNotNull(datastore.get(key)); helper.reset(); assertNull(datastore.get(key)); - helper.stop(Duration.ofMinutes(1)); + helper.stopDuration(Duration.ofMinutes(1)); datastore.get(key); Assert.fail(); } catch (DatastoreException ex) { @@ -198,7 +198,7 @@ public void testStartStopResetWithBuilder() assertNotNull(datastore.get(key)); helper.reset(); assertNull(datastore.get(key)); - helper.stop(Duration.ofMinutes(1)); + helper.stopDuration(Duration.ofMinutes(1)); datastore.get(key); Assert.fail(); } catch (DatastoreException ex) { diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/testing/RemoteDatastoreHelper.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/testing/RemoteDatastoreHelper.java index 6167cedca..a4b389a1e 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/testing/RemoteDatastoreHelper.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/testing/RemoteDatastoreHelper.java @@ -27,9 +27,9 @@ import com.google.cloud.datastore.StructuredQuery; import com.google.cloud.http.HttpTransportOptions; import io.opentelemetry.sdk.OpenTelemetrySdk; +import java.time.Duration; import java.util.UUID; import javax.annotation.Nullable; -import org.threeten.bp.Duration; /** * Utility to create a remote datastore configuration for testing. Datastore options can be obtained @@ -110,13 +110,13 @@ public static RemoteDatastoreHelper create(String databaseId) { private static RetrySettings retrySettings() { return RetrySettings.newBuilder() .setMaxAttempts(10) - .setMaxRetryDelay(Duration.ofMillis(30000L)) - .setTotalTimeout(Duration.ofMillis(120000L)) - .setInitialRetryDelay(Duration.ofMillis(250L)) + .setMaxRetryDelayDuration(Duration.ofMillis(30000L)) + .setTotalTimeoutDuration(Duration.ofMillis(120000L)) + .setInitialRetryDelayDuration(Duration.ofMillis(250L)) .setRetryDelayMultiplier(1.0) - .setInitialRpcTimeout(Duration.ofMillis(120000L)) + .setInitialRpcTimeoutDuration(Duration.ofMillis(120000L)) .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMillis(120000L)) + .setMaxRpcTimeoutDuration(Duration.ofMillis(120000L)) .build(); } } diff --git a/samples/snippets/src/test/java/com/google/datastore/snippets/ConceptsTest.java b/samples/snippets/src/test/java/com/google/datastore/snippets/ConceptsTest.java index 045b16a9a..33aa63ab4 100644 --- a/samples/snippets/src/test/java/com/google/datastore/snippets/ConceptsTest.java +++ b/samples/snippets/src/test/java/com/google/datastore/snippets/ConceptsTest.java @@ -77,7 +77,6 @@ import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import org.threeten.bp.Duration; /** Contains Cloud Datastore snippets demonstrating concepts for documentation. */ @RunWith(JUnit4.class) @@ -147,7 +146,7 @@ public void tearDown() throws Exception { */ @AfterClass public static void afterClass() throws IOException, InterruptedException, TimeoutException { - HELPER.stop(Duration.ofMinutes(1)); + HELPER.stopDuration(java.time.Duration.ofMinutes(1)); } private void assertValidKey(Key taskKey) { From 8146530139e2bdcec0961c252cc2fc1bfff2bd4a Mon Sep 17 00:00:00 2001 From: Joe Wang <106995533+JoeWang1127@users.noreply.github.com> Date: Thu, 28 Nov 2024 12:37:53 +0000 Subject: [PATCH 05/10] chore: mark the unmanaged dependency check required (#1675) --- .github/sync-repo-settings.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml index ab421dce5..203644341 100644 --- a/.github/sync-repo-settings.yaml +++ b/.github/sync-repo-settings.yaml @@ -19,6 +19,7 @@ branchProtectionRules: - 'Kokoro - Test: Java 17 GraalVM Native Image' - javadoc - library_generation + - unmanaged_dependency_check - pattern: 1.106.5-sp isAdminEnforced: true requiredApprovingReviewCount: 1 From b3fbfcc9654bc63bf0d8f3025641d8c50a24ef97 Mon Sep 17 00:00:00 2001 From: Cindy Peng <148148319+cindy-peng@users.noreply.github.com> Date: Wed, 4 Dec 2024 16:17:28 -0800 Subject: [PATCH 06/10] Docs: Update gapic upgrade installation instructions (#1677) * Update user guide * chore: generate libraries at Wed Dec 4 18:25:42 UTC 2024 * Formatting code block * chore: generate libraries at Wed Dec 4 19:22:29 UTC 2024 * Remove client-side metrics suggestions --------- Co-authored-by: cloud-java-bot --- .readme-partials.yaml | 82 +++++++++++++++++++++++++++++++------------ README.md | 82 +++++++++++++++++++++++++++++++------------ 2 files changed, 120 insertions(+), 44 deletions(-) diff --git a/.readme-partials.yaml b/.readme-partials.yaml index ced21e49f..3e8d3a465 100644 --- a/.readme-partials.yaml +++ b/.readme-partials.yaml @@ -110,28 +110,33 @@ custom_content: | ------- In this feature launch, the [Java Datastore client](https://github.com/googleapis/java-datastore) now offers gRPC as a transport layer option with experimental support. Using [gRPC connection pooling](https://grpc.io/docs/guides/performance/) enables distributing RPCs over multiple connections which may improve performance. - #### Download Instructions - Instructions: - 1. Clone the grpc-experimental branch from GitHub: - ```python - git clone -b grpc-experimental https://github.com/googleapis/java-datastore.git - ``` - 2. Run the following commands to build the library: - ```python - # Go to the directory the code was downloaded to - cd java-datastore/ - - # Build the library - mvn clean install -DskipTests=true - ``` - 3. Add the following dependency to your project: - ```xml - + #### Installation Instructions + The client can be built from the `grpc-experimental` branch on GitHub. For private preview, you can also download the artifact with the instructions provided below. + + 1. Download the datastore private preview package with dependencies: + ``` + curl -o https://datastore-sdk-feature-release.web.app/google-cloud-datastore-2.20.0-grpc-experimental-1-SNAPSHOT-jar-with-dependencies.jar + ``` + 2. Run the following commands to install JDK locally: + ``` + mvn install:install-file -Dfile= -DgroupId=com.google.cloud -DartifactId=google-cloud-datastore -Dversion=2.20.0-grpc + ``` + 3. Edit your pom.xml to add above package to `` section: + ```xml + com.google.cloud google-cloud-datastore 2.20.0-grpc-experimental-1-SNAPSHOT - - ``` + + ``` + + And if you have not yet, add below to `` section: + ```xml + + local-repo + file://${user.home}/.m2/repository + + ``` #### How to Use To opt-in to the gRPC transport behavior, simply add the below line of code (`setTransportOptions`) to your Datastore client instantiation. @@ -181,11 +186,44 @@ custom_content: | #### New Features There are new gRPC specific features available to use in this update. - ##### Channel Pooling - To customize the number of channels your client uses, you can update the channel provider in the DatastoreOptions. + ##### Connection Pool + A connection pool, also known as a channel pool, is a cache of database connections that are shared and reused to improve connection latency and performance. With this update, now you will be able to configure the channel pool to improve application performance. This section guides you in determining the optimal connection pool size and configuring it within the Java datastore client. + To customize the number of channels your client uses, you can update the channel provider in the DatastoreOptions. + ###### Determine the best connection pool size + The default connection pool size is right for most applications, and in most cases there's no need to change it. + + However sometimes you may want to change your connection pool size due to high throughput or buffered requests. Ideally, to leave room for traffic fluctuations, a connection pool has about twice the number of connections it takes for maximum saturation. Because a connection can handle a maximum of 100 concurrent requests, between 10 and 50 outstanding requests per connection is optimal. The limit of 100 concurrent streams per gRPC connection is enforced in Google's middleware layer, and you are not able to reconfigure this number. + + The following steps help you calculate the optimal number of connections in your channel pool using estimate per-client QPS and average latency numbers. + + To calculate the optimal connections, gather the following information: + + 1. The maximum number of queries per second (QPS) per client when your application is running a typical workload. + 2. The average latency (the response time for a single request) in ms. + 3. Determine the number of requests that you can send serially per second by dividing 1,000 by the average latency value. + 4. Divide the QPS in seconds by the number of serial requests per second. + 5. Divide the result by 50 requests per channel to determine the minimum optimal channel pool size. (If your calculation is less than 2, use at least 2 channels anyway, to ensure redundancy.) + 6. Divide the same result by 10 requests per channel to determine the maximum optimal channel pool size. + + These steps are expressed in the following equations: + ```java + (QPS ÷ (1,000 ÷ latency ms)) ÷ 50 streams = Minimum optimal number of connections + (QPS ÷ (1,000 ÷ latency ms)) ÷ 10 streams = Maximum optimal number of connections + ``` + + ###### Example + Your application typically sends 50,000 requests per second, and the average latency is 10 ms. Divide 1,000 by 10 ms to determine that you can send 100 requests serially per second. + Divide that number into 50,000 to get the parallelism needed to send 50,000 QPS: 500. Each channel can have at most 100 requests out concurrently, and your target channel utilization + is between 10 and 50 concurrent streams. Therefore, to calculate the minimum, divide 500 by 50 to get 10. To find the maximum, divide 500 by 10 to get 50. This means that your channel + pool size for this example should be between 10 and 50 connections. + + It is also important to monitor your traffic after making changes and adjust the number of connections in your pool if necessary. + + ###### Set the pool size + The following code sample demonstrates how to configure the channel pool in the client libraries using `DatastoreOptions`. See [ChannelPoolSettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.grpc.ChannelPoolSettings) and [Performance Best Practices](https://grpc.io/docs/guides/performance/) for more information on channel pools and best practices for performance. - Example: + Code Example ```java InstantiatingGrpcChannelProvider channelProvider = DatastoreSettings.defaultGrpcTransportProviderBuilder() diff --git a/README.md b/README.md index f059e75ed..4dc14a97f 100644 --- a/README.md +++ b/README.md @@ -208,28 +208,33 @@ gRPC Java Datastore Client User Guide ------- In this feature launch, the [Java Datastore client](https://github.com/googleapis/java-datastore) now offers gRPC as a transport layer option with experimental support. Using [gRPC connection pooling](https://grpc.io/docs/guides/performance/) enables distributing RPCs over multiple connections which may improve performance. -#### Download Instructions -Instructions: -1. Clone the grpc-experimental branch from GitHub: -```python -git clone -b grpc-experimental https://github.com/googleapis/java-datastore.git -``` -2. Run the following commands to build the library: -```python -# Go to the directory the code was downloaded to -cd java-datastore/ - -# Build the library -mvn clean install -DskipTests=true -``` -3. Add the following dependency to your project: -```xml - +#### Installation Instructions +The client can be built from the `grpc-experimental` branch on GitHub. For private preview, you can also download the artifact with the instructions provided below. + +1. Download the datastore private preview package with dependencies: + ``` + curl -o https://datastore-sdk-feature-release.web.app/google-cloud-datastore-2.20.0-grpc-experimental-1-SNAPSHOT-jar-with-dependencies.jar + ``` +2. Run the following commands to install JDK locally: + ``` + mvn install:install-file -Dfile= -DgroupId=com.google.cloud -DartifactId=google-cloud-datastore -Dversion=2.20.0-grpc + ``` +3. Edit your pom.xml to add above package to `` section: + ```xml + com.google.cloud google-cloud-datastore 2.20.0-grpc-experimental-1-SNAPSHOT - -``` + + ``` + +And if you have not yet, add below to `` section: + ```xml + + local-repo + file://${user.home}/.m2/repository + + ``` #### How to Use To opt-in to the gRPC transport behavior, simply add the below line of code (`setTransportOptions`) to your Datastore client instantiation. @@ -279,11 +284,44 @@ boolean isHTTP = datastore.getOptions().getTransportOptions() instanceof HTTPTra #### New Features There are new gRPC specific features available to use in this update. -##### Channel Pooling -To customize the number of channels your client uses, you can update the channel provider in the DatastoreOptions. +##### Connection Pool +A connection pool, also known as a channel pool, is a cache of database connections that are shared and reused to improve connection latency and performance. With this update, now you will be able to configure the channel pool to improve application performance. This section guides you in determining the optimal connection pool size and configuring it within the Java datastore client. +To customize the number of channels your client uses, you can update the channel provider in the DatastoreOptions. +###### Determine the best connection pool size +The default connection pool size is right for most applications, and in most cases there's no need to change it. + +However sometimes you may want to change your connection pool size due to high throughput or buffered requests. Ideally, to leave room for traffic fluctuations, a connection pool has about twice the number of connections it takes for maximum saturation. Because a connection can handle a maximum of 100 concurrent requests, between 10 and 50 outstanding requests per connection is optimal. The limit of 100 concurrent streams per gRPC connection is enforced in Google's middleware layer, and you are not able to reconfigure this number. + +The following steps help you calculate the optimal number of connections in your channel pool using estimate per-client QPS and average latency numbers. + +To calculate the optimal connections, gather the following information: + +1. The maximum number of queries per second (QPS) per client when your application is running a typical workload. +2. The average latency (the response time for a single request) in ms. +3. Determine the number of requests that you can send serially per second by dividing 1,000 by the average latency value. +4. Divide the QPS in seconds by the number of serial requests per second. +5. Divide the result by 50 requests per channel to determine the minimum optimal channel pool size. (If your calculation is less than 2, use at least 2 channels anyway, to ensure redundancy.) +6. Divide the same result by 10 requests per channel to determine the maximum optimal channel pool size. + +These steps are expressed in the following equations: +```java +(QPS ÷ (1,000 ÷ latency ms)) ÷ 50 streams = Minimum optimal number of connections +(QPS ÷ (1,000 ÷ latency ms)) ÷ 10 streams = Maximum optimal number of connections +``` + +###### Example +Your application typically sends 50,000 requests per second, and the average latency is 10 ms. Divide 1,000 by 10 ms to determine that you can send 100 requests serially per second. +Divide that number into 50,000 to get the parallelism needed to send 50,000 QPS: 500. Each channel can have at most 100 requests out concurrently, and your target channel utilization +is between 10 and 50 concurrent streams. Therefore, to calculate the minimum, divide 500 by 50 to get 10. To find the maximum, divide 500 by 10 to get 50. This means that your channel +pool size for this example should be between 10 and 50 connections. + +It is also important to monitor your traffic after making changes and adjust the number of connections in your pool if necessary. + +###### Set the pool size +The following code sample demonstrates how to configure the channel pool in the client libraries using `DatastoreOptions`. See [ChannelPoolSettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.grpc.ChannelPoolSettings) and [Performance Best Practices](https://grpc.io/docs/guides/performance/) for more information on channel pools and best practices for performance. -Example: +Code Example ```java InstantiatingGrpcChannelProvider channelProvider = DatastoreSettings.defaultGrpcTransportProviderBuilder() From c308e4c57439460785378be7f46af057bc2d1b72 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Mon, 9 Dec 2024 19:04:50 +0100 Subject: [PATCH 07/10] chore(deps): update dependency com.google.cloud:libraries-bom to v26.51.0 (#1678) Co-authored-by: Cindy Peng <148148319+cindy-peng@users.noreply.github.com> --- samples/snippets/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index d31d40cb9..95c5f4db4 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -30,7 +30,7 @@ com.google.cloud libraries-bom - 26.50.0 + 26.51.0 pom import From 3de67d55917a4ed97cf5f34e5f1183e865ce6e3a Mon Sep 17 00:00:00 2001 From: cloud-java-bot <122572305+cloud-java-bot@users.noreply.github.com> Date: Mon, 9 Dec 2024 13:22:07 -0500 Subject: [PATCH 08/10] chore: Update generation configuration at Sat Dec 7 02:27:08 UTC 2024 (#1673) * chore: Update generation configuration at Thu Nov 21 02:25:49 UTC 2024 * chore: Update generation configuration at Fri Nov 22 02:26:29 UTC 2024 * chore: Update generation configuration at Sat Nov 23 02:25:13 UTC 2024 * chore: Update generation configuration at Tue Nov 26 02:26:48 UTC 2024 * chore: Update generation configuration at Wed Nov 27 02:27:31 UTC 2024 * chore: Update generation configuration at Thu Nov 28 02:27:23 UTC 2024 * chore: Update generation configuration at Fri Nov 29 02:27:22 UTC 2024 * chore: Update generation configuration at Tue Dec 3 02:27:53 UTC 2024 * chore: Update generation configuration at Wed Dec 4 02:28:04 UTC 2024 * chore: Update generation configuration at Thu Dec 5 02:28:17 UTC 2024 * chore: Update generation configuration at Fri Dec 6 02:27:42 UTC 2024 * chore: generate libraries at Fri Dec 6 02:28:19 UTC 2024 * chore: Update generation configuration at Sat Dec 7 02:27:08 UTC 2024 --- README.md | 2 +- generation_config.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4dc14a97f..780b96e75 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ 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-datastore' ``` diff --git a/generation_config.yaml b/generation_config.yaml index b9de0b019..d7067bcda 100644 --- a/generation_config.yaml +++ b/generation_config.yaml @@ -1,6 +1,6 @@ gapic_generator_version: 2.50.0 -googleapis_commitish: a547fc1420eb0a0f3ae32b0a4eb72d3b8b17d136 -libraries_bom_version: 26.50.0 +googleapis_commitish: 0f3a20ebd29fb1deb2bd1f75c7ba55500d35457d +libraries_bom_version: 26.51.0 libraries: - api_shortname: datastore name_pretty: Cloud Datastore From 9c992a77fee4b114815acd178dae515d345e2f98 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 10 Dec 2024 17:36:22 +0000 Subject: [PATCH 09/10] chore(main): release 2.24.4-SNAPSHOT (#1667) :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). --- README.md | 2 +- datastore-v1-proto-client/pom.xml | 4 ++-- google-cloud-datastore-bom/pom.xml | 10 +++++----- google-cloud-datastore/pom.xml | 4 ++-- grpc-google-cloud-datastore-admin-v1/pom.xml | 4 ++-- pom.xml | 12 ++++++------ proto-google-cloud-datastore-admin-v1/pom.xml | 4 ++-- proto-google-cloud-datastore-v1/pom.xml | 4 ++-- samples/snapshot/pom.xml | 2 +- versions.txt | 12 ++++++------ 10 files changed, 29 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 780b96e75..321a5e15c 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file: com.google.cloud libraries-bom - 26.50.0 + 26.51.0 pom import diff --git a/datastore-v1-proto-client/pom.xml b/datastore-v1-proto-client/pom.xml index 81f589e82..5bddd489b 100644 --- a/datastore-v1-proto-client/pom.xml +++ b/datastore-v1-proto-client/pom.xml @@ -19,12 +19,12 @@ 4.0.0 com.google.cloud.datastore datastore-v1-proto-client - 2.24.3 + 2.24.4-SNAPSHOT com.google.cloud google-cloud-datastore-parent - 2.24.3 + 2.24.4-SNAPSHOT jar diff --git a/google-cloud-datastore-bom/pom.xml b/google-cloud-datastore-bom/pom.xml index c44f45040..e2efd3ff3 100644 --- a/google-cloud-datastore-bom/pom.xml +++ b/google-cloud-datastore-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-datastore-bom - 2.24.3 + 2.24.4-SNAPSHOT pom com.google.cloud @@ -52,22 +52,22 @@ com.google.cloud google-cloud-datastore - 2.24.3 + 2.24.4-SNAPSHOT com.google.api.grpc grpc-google-cloud-datastore-admin-v1 - 2.24.3 + 2.24.4-SNAPSHOT com.google.api.grpc proto-google-cloud-datastore-v1 - 0.115.3 + 0.115.4-SNAPSHOT com.google.api.grpc proto-google-cloud-datastore-admin-v1 - 2.24.3 + 2.24.4-SNAPSHOT diff --git a/google-cloud-datastore/pom.xml b/google-cloud-datastore/pom.xml index 6c8dbf156..16c16241e 100644 --- a/google-cloud-datastore/pom.xml +++ b/google-cloud-datastore/pom.xml @@ -2,7 +2,7 @@ 4.0.0 google-cloud-datastore - 2.24.3 + 2.24.4-SNAPSHOT jar Google Cloud Datastore https://github.com/googleapis/java-datastore @@ -12,7 +12,7 @@ com.google.cloud google-cloud-datastore-parent - 2.24.3 + 2.24.4-SNAPSHOT google-cloud-datastore diff --git a/grpc-google-cloud-datastore-admin-v1/pom.xml b/grpc-google-cloud-datastore-admin-v1/pom.xml index bc6da09a2..46a6065ba 100644 --- a/grpc-google-cloud-datastore-admin-v1/pom.xml +++ b/grpc-google-cloud-datastore-admin-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-datastore-admin-v1 - 2.24.3 + 2.24.4-SNAPSHOT grpc-google-cloud-datastore-admin-v1 GRPC library for google-cloud-datastore com.google.cloud google-cloud-datastore-parent - 2.24.3 + 2.24.4-SNAPSHOT diff --git a/pom.xml b/pom.xml index 010f41c6b..7c0df571c 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-datastore-parent pom - 2.24.3 + 2.24.4-SNAPSHOT Google Cloud Datastore Parent https://github.com/googleapis/java-datastore @@ -159,27 +159,27 @@ com.google.api.grpc proto-google-cloud-datastore-admin-v1 - 2.24.3 + 2.24.4-SNAPSHOT com.google.api.grpc grpc-google-cloud-datastore-admin-v1 - 2.24.3 + 2.24.4-SNAPSHOT com.google.cloud google-cloud-datastore - 2.24.3 + 2.24.4-SNAPSHOT com.google.api.grpc proto-google-cloud-datastore-v1 - 0.115.3 + 0.115.4-SNAPSHOT com.google.cloud.datastore datastore-v1-proto-client - 2.24.3 + 2.24.4-SNAPSHOT com.google.api.grpc diff --git a/proto-google-cloud-datastore-admin-v1/pom.xml b/proto-google-cloud-datastore-admin-v1/pom.xml index e0eb6c902..1fb4dd265 100644 --- a/proto-google-cloud-datastore-admin-v1/pom.xml +++ b/proto-google-cloud-datastore-admin-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-datastore-admin-v1 - 2.24.3 + 2.24.4-SNAPSHOT proto-google-cloud-datastore-admin-v1 Proto library for google-cloud-datastore com.google.cloud google-cloud-datastore-parent - 2.24.3 + 2.24.4-SNAPSHOT diff --git a/proto-google-cloud-datastore-v1/pom.xml b/proto-google-cloud-datastore-v1/pom.xml index 49d767dfb..1e9a5083f 100644 --- a/proto-google-cloud-datastore-v1/pom.xml +++ b/proto-google-cloud-datastore-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-datastore-v1 - 0.115.3 + 0.115.4-SNAPSHOT proto-google-cloud-datastore-v1 PROTO library for proto-google-cloud-datastore-v1 com.google.cloud google-cloud-datastore-parent - 2.24.3 + 2.24.4-SNAPSHOT diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index e484c2694..5eefa5993 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -28,7 +28,7 @@ com.google.cloud google-cloud-datastore - 2.24.3 + 2.24.4-SNAPSHOT diff --git a/versions.txt b/versions.txt index 99f46fe19..e40fb3ab7 100644 --- a/versions.txt +++ b/versions.txt @@ -1,9 +1,9 @@ # Format: # module:released-version:current-version -google-cloud-datastore:2.24.3:2.24.3 -google-cloud-datastore-bom:2.24.3:2.24.3 -proto-google-cloud-datastore-v1:0.115.3:0.115.3 -datastore-v1-proto-client:2.24.3:2.24.3 -proto-google-cloud-datastore-admin-v1:2.24.3:2.24.3 -grpc-google-cloud-datastore-admin-v1:2.24.3:2.24.3 +google-cloud-datastore:2.24.3:2.24.4-SNAPSHOT +google-cloud-datastore-bom:2.24.3:2.24.4-SNAPSHOT +proto-google-cloud-datastore-v1:0.115.3:0.115.4-SNAPSHOT +datastore-v1-proto-client:2.24.3:2.24.4-SNAPSHOT +proto-google-cloud-datastore-admin-v1:2.24.3:2.24.4-SNAPSHOT +grpc-google-cloud-datastore-admin-v1:2.24.3:2.24.4-SNAPSHOT From b3042ddc2f76a01ef411f26c1e271f2566108592 Mon Sep 17 00:00:00 2001 From: cloud-java-bot <122572305+cloud-java-bot@users.noreply.github.com> Date: Tue, 10 Dec 2024 15:47:50 -0500 Subject: [PATCH 10/10] chore: Update generation configuration at Tue Dec 10 02:28:41 UTC 2024 (#1680) * chore: Update generation configuration at Tue Dec 10 02:28:41 UTC 2024 * chore: generate libraries at Tue Dec 10 02:29:17 UTC 2024 --- generation_config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generation_config.yaml b/generation_config.yaml index d7067bcda..685dceedb 100644 --- a/generation_config.yaml +++ b/generation_config.yaml @@ -1,5 +1,5 @@ gapic_generator_version: 2.50.0 -googleapis_commitish: 0f3a20ebd29fb1deb2bd1f75c7ba55500d35457d +googleapis_commitish: 5d5b1bf126485b0e2c972bac41b376438601e266 libraries_bom_version: 26.51.0 libraries: - api_shortname: datastore