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 fce568dc2..203644341 100644 --- a/.github/sync-repo-settings.yaml +++ b/.github/sync-repo-settings.yaml @@ -18,6 +18,8 @@ branchProtectionRules: - 'Kokoro - Test: Java GraalVM Native Image' - 'Kokoro - Test: Java 17 GraalVM Native Image' - javadoc + - library_generation + - unmanaged_dependency_check - pattern: 1.106.5-sp isAdminEnforced: true requiredApprovingReviewCount: 1 @@ -107,22 +109,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 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 536b57f4c..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 @@ -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-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 @@ -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() @@ -479,7 +517,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/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/generation_config.yaml b/generation_config.yaml index 029446537..685dceedb 100644 --- a/generation_config.yaml +++ b/generation_config.yaml @@ -1,6 +1,6 @@ gapic_generator_version: 2.50.0 -googleapis_commitish: 0b5613ee74c9558dd284aa2b01a585ce297c0045 -libraries_bom_version: 26.50.0 +googleapis_commitish: 5d5b1bf126485b0e2c972bac41b376438601e266 +libraries_bom_version: 26.51.0 libraries: - api_shortname: datastore name_pretty: Cloud Datastore 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 f7ddd9192..a294f039e 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/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 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/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/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 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) { 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