diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b758bd213..0ffb49d9c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,30 @@ # Changelog +## [2.25.0](https://github.com/googleapis/java-bigtable/compare/v2.24.1...v2.25.0) (2023-07-14) + + +### Features + +* Change stream retention to create and update table ([#1823](https://github.com/googleapis/java-bigtable/issues/1823)) ([05fca58](https://github.com/googleapis/java-bigtable/commit/05fca581d4225769cc581e26e679e6bca105055b)) + + +### Bug Fixes + +* Fix batch mutation limit ([#1808](https://github.com/googleapis/java-bigtable/issues/1808)) ([ed24d4f](https://github.com/googleapis/java-bigtable/commit/ed24d4fdc67c6d0af66ea055ba1ad7f7c037a361)) +* Update default sample row key attempt timeout to 5 min ([#1827](https://github.com/googleapis/java-bigtable/issues/1827)) ([2f363ef](https://github.com/googleapis/java-bigtable/commit/2f363ef3636c2810c322bb5978cc586f8aec2ef2)) + + +### Documentation + +* Fix formatting for reversed order field example ([#1836](https://github.com/googleapis/java-bigtable/issues/1836)) ([10a0426](https://github.com/googleapis/java-bigtable/commit/10a0426f580b86b26541b95a778bb8b7f6562383)) +* Increase the maximum retention period for a Cloud Bigtable backup from 30 days to 90 days ([#1826](https://github.com/googleapis/java-bigtable/issues/1826)) ([159fe38](https://github.com/googleapis/java-bigtable/commit/159fe3857735c9061672fc951388215edb0a324c)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-monitoring-bom to v3.22.0 ([#1838](https://github.com/googleapis/java-bigtable/issues/1838)) ([fba2c49](https://github.com/googleapis/java-bigtable/commit/fba2c49e9e71209289497f53868aa561c0fba7a3)) +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.13.0 ([#1833](https://github.com/googleapis/java-bigtable/issues/1833)) ([cb160af](https://github.com/googleapis/java-bigtable/commit/cb160af8e66ec6693ed0d3286c654a93094b68a3)) + ## [2.24.1](https://github.com/googleapis/java-bigtable/compare/v2.24.0...v2.24.1) (2023-06-27) diff --git a/README.md b/README.md index 4e9c15721d..c556fc94e8 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.17.0 + 26.18.0 pom import @@ -42,7 +42,7 @@ If you are using Maven without the BOM, add this to your dependencies: com.google.cloud google-cloud-bigtable - 2.23.3 + 2.24.1 ``` @@ -50,20 +50,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.17.0') +implementation platform('com.google.cloud:libraries-bom:26.18.0') implementation 'com.google.cloud:google-cloud-bigtable' ``` If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-bigtable:2.23.3' +implementation 'com.google.cloud:google-cloud-bigtable:2.24.1' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-bigtable" % "2.23.3" +libraryDependencies += "com.google.cloud" % "google-cloud-bigtable" % "2.24.1" ``` @@ -609,7 +609,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-bigtable/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-bigtable.svg -[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-bigtable/2.23.3 +[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-bigtable/2.24.1 [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/google-cloud-bigtable-bom/pom.xml b/google-cloud-bigtable-bom/pom.xml index b007d8f4f7..cadc5a5286 100644 --- a/google-cloud-bigtable-bom/pom.xml +++ b/google-cloud-bigtable-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-bigtable-bom - 2.24.1 + 2.25.0 pom com.google.cloud @@ -63,42 +63,42 @@ com.google.cloud google-cloud-bigtable - 2.24.1 + 2.25.0 com.google.cloud google-cloud-bigtable-emulator - 0.161.1 + 0.162.0 com.google.cloud google-cloud-bigtable-emulator-core - 0.161.1 + 0.162.0 com.google.api.grpc grpc-google-cloud-bigtable-admin-v2 - 2.24.1 + 2.25.0 com.google.api.grpc grpc-google-cloud-bigtable-v2 - 2.24.1 + 2.25.0 com.google.api.grpc proto-google-cloud-bigtable-admin-v2 - 2.24.1 + 2.25.0 com.google.api.grpc proto-google-cloud-bigtable-v2 - 2.24.1 + 2.25.0 com.google.cloud google-cloud-bigtable-stats - 2.24.1 + 2.25.0 diff --git a/google-cloud-bigtable-deps-bom/pom.xml b/google-cloud-bigtable-deps-bom/pom.xml index 21eefe5d36..76e1f195fe 100644 --- a/google-cloud-bigtable-deps-bom/pom.xml +++ b/google-cloud-bigtable-deps-bom/pom.xml @@ -13,7 +13,7 @@ com.google.cloud google-cloud-bigtable-deps-bom - 2.24.1 + 2.25.0 pom @@ -66,14 +66,14 @@ com.google.cloud google-cloud-shared-dependencies - 3.12.0 + 3.13.0 pom import com.google.cloud google-cloud-monitoring-bom - 3.21.0 + 3.22.0 diff --git a/google-cloud-bigtable-emulator-core/pom.xml b/google-cloud-bigtable-emulator-core/pom.xml index 0e5d4b4e80..2b483d5851 100644 --- a/google-cloud-bigtable-emulator-core/pom.xml +++ b/google-cloud-bigtable-emulator-core/pom.xml @@ -7,11 +7,11 @@ google-cloud-bigtable-parent com.google.cloud - 2.24.1 + 2.25.0 google-cloud-bigtable-emulator-core - 0.161.1 + 0.162.0 A Java wrapper for the Cloud Bigtable emulator. diff --git a/google-cloud-bigtable-emulator/pom.xml b/google-cloud-bigtable-emulator/pom.xml index 744bbeb160..d24c5f3346 100644 --- a/google-cloud-bigtable-emulator/pom.xml +++ b/google-cloud-bigtable-emulator/pom.xml @@ -5,7 +5,7 @@ 4.0.0 google-cloud-bigtable-emulator - 0.161.1 + 0.162.0 Google Cloud Java - Bigtable Emulator https://github.com/googleapis/java-bigtable @@ -14,7 +14,7 @@ com.google.cloud google-cloud-bigtable-parent - 2.24.1 + 2.25.0 scm:git:git@github.com:googleapis/java-bigtable.git @@ -81,14 +81,14 @@ com.google.cloud google-cloud-bigtable-deps-bom - 2.24.1 + 2.25.0 pom import com.google.cloud google-cloud-bigtable-bom - 2.24.1 + 2.25.0 pom import @@ -99,7 +99,7 @@ com.google.cloud google-cloud-bigtable-emulator-core - 0.161.1 + 0.162.0 diff --git a/google-cloud-bigtable-stats/pom.xml b/google-cloud-bigtable-stats/pom.xml index 0eaa82c74e..84fe978b63 100644 --- a/google-cloud-bigtable-stats/pom.xml +++ b/google-cloud-bigtable-stats/pom.xml @@ -5,7 +5,7 @@ com.google.cloud google-cloud-bigtable-parent - 2.24.1 + 2.25.0 4.0.0 @@ -13,7 +13,7 @@ through Stackdriver. Built-in metrics will be implemented with shaded OpenCensus so it won't interfere with customer's application metrics. --> google-cloud-bigtable-stats - 2.24.1 + 2.25.0 Experimental project to shade OpenCensus dependencies. @@ -21,7 +21,7 @@ com.google.cloud google-cloud-bigtable-deps-bom - 2.24.1 + 2.25.0 pom import @@ -235,7 +235,7 @@ org.codehaus.mojo license-maven-plugin - 2.1.0 + 2.2.0 default-cli diff --git a/google-cloud-bigtable/pom.xml b/google-cloud-bigtable/pom.xml index bca053fe46..525aef8fdc 100644 --- a/google-cloud-bigtable/pom.xml +++ b/google-cloud-bigtable/pom.xml @@ -2,7 +2,7 @@ 4.0.0 google-cloud-bigtable - 2.24.1 + 2.25.0 jar Google Cloud Bigtable https://github.com/googleapis/java-bigtable @@ -12,11 +12,11 @@ com.google.cloud google-cloud-bigtable-parent - 2.24.1 + 2.25.0 - 2.24.1 + 2.25.0 google-cloud-bigtable @@ -38,8 +38,8 @@ batch-bigtable.googleapis.com:443 - 1.56.0 - 3.23.2 + 1.56.1 + 3.23.4 @@ -47,14 +47,14 @@ com.google.cloud google-cloud-bigtable-deps-bom - 2.24.1 + 2.25.0 pom import com.google.cloud google-cloud-bigtable-bom - 2.24.1 + 2.25.0 pom import diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/Version.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/Version.java index 6d87c1b3a2..6c92fd7dbf 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/Version.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/Version.java @@ -20,6 +20,6 @@ @InternalApi("For internal use only") public final class Version { // {x-version-update-start:google-cloud-bigtable:current} - public static String VERSION = "2.24.1"; + public static String VERSION = "2.25.0"; // {x-version-update-end} } diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClient.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClient.java index f44f70b630..6eb712e6ac 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClient.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClient.java @@ -50,6 +50,7 @@ import com.google.cloud.bigtable.admin.v2.models.RestoredTableResult; import com.google.cloud.bigtable.admin.v2.models.Table; import com.google.cloud.bigtable.admin.v2.models.UpdateBackupRequest; +import com.google.cloud.bigtable.admin.v2.models.UpdateTableRequest; import com.google.cloud.bigtable.admin.v2.stub.EnhancedBigtableTableAdminStub; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; @@ -258,6 +259,72 @@ public ApiFuture createTableAsync(CreateTableRequest request) { this.stub.createTableCallable().futureCall(request.toProto(projectId, instanceId))); } + /** + * Update a table with the specified configuration. + * + *

Sample code: + * + *

{@code
+   * // Alter change stream retention period.
+   * Table table = client.updateTable(
+   *   UpdateTableRequest.of("my-table")
+   *     .addChangeStreamRetention(Duration.ofHours(24))
+   * );
+   *
+   * // Disable change stream
+   * Table table = client.updateTable(
+   *   UpdateTableRequest.of("my-table")
+   *     .disableChangeStream()
+   * );
+   * }
+ * + * @see UpdateTableRequest for available options. + */ + public Table updateTable(UpdateTableRequest request) { + return ApiExceptions.callAndTranslateApiException(updateTableAsync(request)); + } + + /** + * Asynchronously update a table with the specified configuration. + * + *

Sample code: + * + *

{@code
+   * // Update table to 1 day change stream retention.
+   * ApiFuture
tableFuture = client.createTableAsync( + * UpdateTableRequest.of("my-table") + * .addChangeStreamRetention(Duration.ofHours(24)) + * ); + * + * ApiFutures.addCallback( + * tableFuture, + * new ApiFutureCallback
() { + * public void onSuccess(Table table) { + * System.out.println("Updated table: " + table.getTableName()); + * } + * + * public void onFailure(Throwable t) { + * t.printStackTrace(); + * } + * }, + * MoreExecutors.directExecutor() + * ); + * } + * + * @see UpdateTableRequest for available options. + */ + public ApiFuture
updateTableAsync(UpdateTableRequest request) { + return ApiFutures.transform( + stub.updateTableOperationCallable().futureCall(request.toProto(projectId, instanceId)), + new ApiFunction() { + @Override + public Table apply(com.google.bigtable.admin.v2.Table tableProto) { + return Table.fromProto(tableProto); + } + }, + MoreExecutors.directExecutor()); + } + /** * Creates, updates and drops column families as specified in the request. * diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/CreateTableRequest.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/CreateTableRequest.java index 03022b8763..6b315c3f59 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/CreateTableRequest.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/CreateTableRequest.java @@ -16,6 +16,7 @@ package com.google.cloud.bigtable.admin.v2.models; import com.google.api.core.InternalApi; +import com.google.bigtable.admin.v2.ChangeStreamConfig; import com.google.bigtable.admin.v2.ColumnFamily; import com.google.cloud.bigtable.admin.v2.internal.NameUtil; import com.google.cloud.bigtable.admin.v2.models.GCRules.GCRule; @@ -23,6 +24,7 @@ import com.google.common.base.Preconditions; import com.google.protobuf.ByteString; import javax.annotation.Nonnull; +import org.threeten.bp.Duration; /** * Fluent wrapper for {@link com.google.bigtable.admin.v2.CreateTableRequest} @@ -76,6 +78,22 @@ public CreateTableRequest addSplit(ByteString key) { return this; } + /** Add change stream retention period between 1 day and 7 days */ + public CreateTableRequest addChangeStreamRetention(Duration retention) { + Preconditions.checkNotNull(retention); + requestBuilder + .getTableBuilder() + .setChangeStreamConfig( + ChangeStreamConfig.newBuilder() + .setRetentionPeriod( + com.google.protobuf.Duration.newBuilder() + .setSeconds(retention.getSeconds()) + .setNanos(retention.getNano()) + .build()) + .build()); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/Table.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/Table.java index bb852b25ae..31aa612f18 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/Table.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/Table.java @@ -25,6 +25,7 @@ import java.util.Map; import java.util.Map.Entry; import javax.annotation.Nonnull; +import org.threeten.bp.Duration; /** Wrapper for {@link Table} protocol buffer object */ public final class Table { @@ -103,6 +104,8 @@ public com.google.bigtable.admin.v2.Table.ClusterState.ReplicationState toProto( private final Map replicationStatesByClusterId; private final List columnFamilies; + private final Duration changeStreamRetention; + @InternalApi public static Table fromProto(@Nonnull com.google.bigtable.admin.v2.Table proto) { ImmutableMap.Builder replicationStates = ImmutableMap.builder(); @@ -120,18 +123,31 @@ public static Table fromProto(@Nonnull com.google.bigtable.admin.v2.Table proto) columnFamilies.add(ColumnFamily.fromProto(entry.getKey(), entry.getValue())); } + Duration changeStreamConfig = null; + if (proto.hasChangeStreamConfig()) { + changeStreamConfig = + Duration.ofSeconds( + proto.getChangeStreamConfig().getRetentionPeriod().getSeconds(), + proto.getChangeStreamConfig().getRetentionPeriod().getNanos()); + } + return new Table( - TableName.parse(proto.getName()), replicationStates.build(), columnFamilies.build()); + TableName.parse(proto.getName()), + replicationStates.build(), + columnFamilies.build(), + changeStreamConfig); } private Table( TableName tableName, Map replicationStatesByClusterId, - List columnFamilies) { + List columnFamilies, + Duration changeStreamRetention) { this.instanceId = tableName.getInstance(); this.id = tableName.getTable(); this.replicationStatesByClusterId = replicationStatesByClusterId; this.columnFamilies = columnFamilies; + this.changeStreamRetention = changeStreamRetention; } /** Gets the table's id. */ @@ -152,6 +168,10 @@ public List getColumnFamilies() { return columnFamilies; } + public Duration getChangeStreamRetention() { + return changeStreamRetention; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -164,11 +184,13 @@ public boolean equals(Object o) { return Objects.equal(id, table.id) && Objects.equal(instanceId, table.instanceId) && Objects.equal(replicationStatesByClusterId, table.replicationStatesByClusterId) - && Objects.equal(columnFamilies, table.columnFamilies); + && Objects.equal(columnFamilies, table.columnFamilies) + && Objects.equal(changeStreamRetention, table.changeStreamRetention); } @Override public int hashCode() { - return Objects.hashCode(id, instanceId, replicationStatesByClusterId, columnFamilies); + return Objects.hashCode( + id, instanceId, replicationStatesByClusterId, columnFamilies, changeStreamRetention); } } diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/UpdateTableRequest.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/UpdateTableRequest.java new file mode 100644 index 0000000000..034736aa56 --- /dev/null +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/UpdateTableRequest.java @@ -0,0 +1,98 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.bigtable.admin.v2.models; + +import com.google.api.core.InternalApi; +import com.google.bigtable.admin.v2.ChangeStreamConfig; +import com.google.cloud.bigtable.admin.v2.internal.NameUtil; +import com.google.common.base.Preconditions; +import java.util.Objects; +import org.threeten.bp.Duration; + +/** + * Wrapper for {@link com.google.bigtable.admin.v2.UpdateTableRequest} + * + *

Allows for updating table: + * + *

    + *
  • Change stream retention period. + *
+ */ +public class UpdateTableRequest { + + private final String tableId; + + private final com.google.bigtable.admin.v2.UpdateTableRequest.Builder requestBuilder = + com.google.bigtable.admin.v2.UpdateTableRequest.newBuilder(); + + public static UpdateTableRequest of(String tableId) { + return new UpdateTableRequest(tableId); + } + + private UpdateTableRequest(String tableId) { + this.tableId = tableId; + } + + /** Update change stream retention period between 1 day and 7 days. */ + public UpdateTableRequest addChangeStreamRetention(Duration retention) { + Preconditions.checkNotNull(retention); + if (!retention.isZero()) { + requestBuilder + .getTableBuilder() + .setChangeStreamConfig( + ChangeStreamConfig.newBuilder() + .setRetentionPeriod( + com.google.protobuf.Duration.newBuilder() + .setSeconds(retention.getSeconds()) + .setNanos(retention.getNano()) + .build()) + .build()); + requestBuilder.getUpdateMaskBuilder().addPaths("change_stream_config.retention_period"); + } else { + requestBuilder.getTableBuilder().clearChangeStreamConfig(); + requestBuilder.getUpdateMaskBuilder().addPaths("change_stream_config"); + } + return this; + } + + /** Disable change stream for table */ + public UpdateTableRequest disableChangeStreamRetention() { + return addChangeStreamRetention(Duration.ZERO); + } + + @InternalApi + public com.google.bigtable.admin.v2.UpdateTableRequest toProto( + String projectId, String instanceId) { + requestBuilder + .getTableBuilder() + .setName(NameUtil.formatTableName(projectId, instanceId, tableId)); + return requestBuilder.build(); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof UpdateTableRequest)) return false; + UpdateTableRequest that = (UpdateTableRequest) o; + return Objects.equals(requestBuilder, that.requestBuilder); + } + + @Override + public int hashCode() { + return Objects.hash(requestBuilder); + } +} diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/BulkMutation.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/BulkMutation.java index 95d10872ec..a269370748 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/BulkMutation.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/BulkMutation.java @@ -15,6 +15,8 @@ */ package com.google.cloud.bigtable.data.v2.models; +import static com.google.cloud.bigtable.data.v2.models.RowMutationEntry.MAX_MUTATION; + import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; import com.google.bigtable.v2.MutateRowsRequest; @@ -40,6 +42,8 @@ public final class BulkMutation implements Serializable, Cloneable { private final String tableId; private transient MutateRowsRequest.Builder builder; + private long mutationCountSum = 0; + public static BulkMutation create(String tableId) { return new BulkMutation(tableId); } @@ -81,6 +85,14 @@ public BulkMutation add(@Nonnull ByteString rowKey, @Nonnull Mutation mutation) Preconditions.checkNotNull(rowKey); Preconditions.checkNotNull(mutation); + long mutationCount = mutation.getMutations().size(); + Preconditions.checkArgument( + mutationCountSum + mutationCount <= MAX_MUTATION, + String.format( + "Too many mutations, got %s, limit is %s", + mutationCountSum + mutationCount, MAX_MUTATION)); + this.mutationCountSum += mutationCount; + builder.addEntries( MutateRowsRequest.Entry.newBuilder() .setRowKey(rowKey) diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/RowMutationEntry.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/RowMutationEntry.java index 63ffe708a5..5e40bd999c 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/RowMutationEntry.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/RowMutationEntry.java @@ -33,6 +33,8 @@ public class RowMutationEntry implements MutationApi, Serializable { private static final long serialVersionUID = 1974738836742298192L; + static final int MAX_MUTATION = 100000; + private final ByteString key; private final Mutation mutation; @@ -180,6 +182,11 @@ public RowMutationEntry deleteRow() { @InternalApi public MutateRowsRequest.Entry toProto() { + Preconditions.checkArgument( + mutation.getMutations().size() <= MAX_MUTATION, + String.format( + "Too many mutations, got %s, limit is %s", + mutation.getMutations().size(), MAX_MUTATION)); return MutateRowsRequest.Entry.newBuilder() .setRowKey(key) .addAllMutations(mutation.getMutations()) diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/BigtableBatchingCallSettings.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/BigtableBatchingCallSettings.java index 21f837f87f..2ca5e10211 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/BigtableBatchingCallSettings.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/BigtableBatchingCallSettings.java @@ -294,28 +294,28 @@ public boolean isServerInitiatedFlowControlEnabled() { @Override public BigtableBatchingCallSettings build() { Preconditions.checkState(batchingSettings != null, "batchingSettings must be set"); - FlowControlSettings defaultSettings = batchingSettings.getFlowControlSettings(); + FlowControlSettings flowControlSettings = batchingSettings.getFlowControlSettings(); Preconditions.checkState( - defaultSettings.getMaxOutstandingElementCount() != null, + flowControlSettings.getMaxOutstandingElementCount() != null, "maxOutstandingElementCount must be set in BatchingSettings#FlowControlSettings"); Preconditions.checkState( - defaultSettings.getMaxOutstandingRequestBytes() != null, + flowControlSettings.getMaxOutstandingRequestBytes() != null, "maxOutstandingRequestBytes must be set in BatchingSettings#FlowControlSettings"); Preconditions.checkArgument( batchingSettings.getElementCountThreshold() == null - || defaultSettings.getMaxOutstandingElementCount() - >= batchingSettings.getElementCountThreshold(), - "if elementCountThreshold is set in BatchingSettings, maxOutstandingElementCount must be >= elementCountThreshold"); + || flowControlSettings.getMaxOutstandingElementCount() + > batchingSettings.getElementCountThreshold(), + "if batch elementCountThreshold is set in BatchingSettings, flow control maxOutstandingElementCount must be > elementCountThreshold"); Preconditions.checkArgument( batchingSettings.getRequestByteThreshold() == null - || defaultSettings.getMaxOutstandingRequestBytes() - >= batchingSettings.getRequestByteThreshold(), - "if requestByteThreshold is set in BatchingSettings, getMaxOutstandingRequestBytes must be >= getRequestByteThreshold"); + || flowControlSettings.getMaxOutstandingRequestBytes() + > batchingSettings.getRequestByteThreshold(), + "if batch requestByteThreshold is set in BatchingSettings, flow control maxOutstandingRequestBytes must be > getRequestByteThreshold"); // Combine static FlowControlSettings with latency based throttling settings to create // DynamicFlowControlSettings. if (isLatencyBasedThrottlingEnabled()) { - long maxThrottlingElementCount = defaultSettings.getMaxOutstandingElementCount(); - long maxThrottlingRequestByteCount = defaultSettings.getMaxOutstandingRequestBytes(); + long maxThrottlingElementCount = flowControlSettings.getMaxOutstandingElementCount(); + long maxThrottlingRequestByteCount = flowControlSettings.getMaxOutstandingRequestBytes(); // The maximum in flight element count is pretty high. Set the initial parallelism to 25% // of the maximum and then work up or down. This reduction should reduce the // impacts of a bursty job, such as those found in Dataflow. @@ -332,7 +332,7 @@ public BigtableBatchingCallSettings build() { } dynamicFlowControlSettings = DynamicFlowControlSettings.newBuilder() - .setLimitExceededBehavior(defaultSettings.getLimitExceededBehavior()) + .setLimitExceededBehavior(flowControlSettings.getLimitExceededBehavior()) .setInitialOutstandingElementCount(initialElementCount) .setMaxOutstandingElementCount(maxThrottlingElementCount) .setMinOutstandingElementCount(minElementCount) @@ -343,13 +343,15 @@ public BigtableBatchingCallSettings build() { } else { dynamicFlowControlSettings = DynamicFlowControlSettings.newBuilder() - .setLimitExceededBehavior(defaultSettings.getLimitExceededBehavior()) - .setInitialOutstandingElementCount(defaultSettings.getMaxOutstandingElementCount()) - .setMaxOutstandingElementCount(defaultSettings.getMaxOutstandingElementCount()) - .setMinOutstandingElementCount(defaultSettings.getMaxOutstandingElementCount()) - .setInitialOutstandingRequestBytes(defaultSettings.getMaxOutstandingRequestBytes()) - .setMinOutstandingRequestBytes(defaultSettings.getMaxOutstandingRequestBytes()) - .setMaxOutstandingRequestBytes(defaultSettings.getMaxOutstandingRequestBytes()) + .setLimitExceededBehavior(flowControlSettings.getLimitExceededBehavior()) + .setInitialOutstandingElementCount( + flowControlSettings.getMaxOutstandingElementCount()) + .setMaxOutstandingElementCount(flowControlSettings.getMaxOutstandingElementCount()) + .setMinOutstandingElementCount(flowControlSettings.getMaxOutstandingElementCount()) + .setInitialOutstandingRequestBytes( + flowControlSettings.getMaxOutstandingRequestBytes()) + .setMinOutstandingRequestBytes(flowControlSettings.getMaxOutstandingRequestBytes()) + .setMaxOutstandingRequestBytes(flowControlSettings.getMaxOutstandingRequestBytes()) .build(); } return new BigtableBatchingCallSettings(this); diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java index eba09a7464..ef6bed41ca 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java @@ -387,8 +387,8 @@ public ServerStreamingCallSettings readRowsSettings() { * starts} at 10ms and {@link RetrySettings.Builder#setRetryDelayMultiplier increases * exponentially} by a factor of 2 until a {@link RetrySettings.Builder#setMaxRetryDelay * maximum of} 1 minute. - *
  • The default timeout for {@link RetrySettings.Builder#setMaxRpcTimeout each attempt} is 20 - * seconds and the timeout for the {@link RetrySettings.Builder#setTotalTimeout entire + *
  • The default timeout for {@link RetrySettings.Builder#setMaxRpcTimeout each attempt} is 5 + * minutes and the timeout for the {@link RetrySettings.Builder#setTotalTimeout entire * operation} across all of the attempts is 10 mins. * */ @@ -659,7 +659,12 @@ private Builder() { sampleRowKeysSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); sampleRowKeysSettings .setRetryableCodes(IDEMPOTENT_RETRY_CODES) - .setRetrySettings(IDEMPOTENT_RETRY_SETTINGS); + .setRetrySettings( + IDEMPOTENT_RETRY_SETTINGS + .toBuilder() + .setInitialRpcTimeout(Duration.ofMinutes(5)) + .setMaxRpcTimeout(Duration.ofMinutes(5)) + .build()); mutateRowSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); copyRetrySettings(baseDefaults.mutateRowSettings(), mutateRowSettings); @@ -954,7 +959,6 @@ public UnaryCallSettings.Builder pingAndWarmSettings() public EnhancedBigtableStubSettings build() { Preconditions.checkState(projectId != null, "Project id must be set"); Preconditions.checkState(instanceId != null, "Instance id must be set"); - if (isRefreshingChannel) { Preconditions.checkArgument( getTransportChannelProvider() instanceof InstantiatingGrpcChannelProvider, diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/mutaterows/MutateRowsBatchResource.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/mutaterows/MutateRowsBatchResource.java new file mode 100644 index 0000000000..2702dcf642 --- /dev/null +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/mutaterows/MutateRowsBatchResource.java @@ -0,0 +1,60 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.bigtable.data.v2.stub.mutaterows; + +import com.google.api.gax.batching.BatchResource; +import com.google.auto.value.AutoValue; +import com.google.common.base.Preconditions; + +/** + * A custom implementation of {@link BatchResource} because MutateRowsRequest has a limit on number + * of mutations. + */ +@AutoValue +abstract class MutateRowsBatchResource implements BatchResource { + + static MutateRowsBatchResource create(long elementCount, long byteCount, long mutationCount) { + return new AutoValue_MutateRowsBatchResource(elementCount, byteCount, mutationCount); + } + + @Override + public BatchResource add(BatchResource batchResource) { + Preconditions.checkArgument( + batchResource instanceof MutateRowsBatchResource, + "Expected MutateRowsBatchResource, got " + batchResource.getClass()); + MutateRowsBatchResource mutateRowsResource = (MutateRowsBatchResource) batchResource; + + return new AutoValue_MutateRowsBatchResource( + getElementCount() + mutateRowsResource.getElementCount(), + getByteCount() + mutateRowsResource.getByteCount(), + getMutationCount() + mutateRowsResource.getMutationCount()); + } + + @Override + public abstract long getElementCount(); + + @Override + public abstract long getByteCount(); + + abstract long getMutationCount(); + + @Override + public boolean shouldFlush(long maxElementThreshold, long maxBytesThreshold) { + return getElementCount() > maxElementThreshold + || getByteCount() > maxBytesThreshold + || getMutationCount() > 100000; + } +} diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/mutaterows/MutateRowsBatchingDescriptor.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/mutaterows/MutateRowsBatchingDescriptor.java index a3ec50bc2d..65cc781169 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/mutaterows/MutateRowsBatchingDescriptor.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/mutaterows/MutateRowsBatchingDescriptor.java @@ -17,6 +17,7 @@ import com.google.api.core.InternalApi; import com.google.api.gax.batching.BatchEntry; +import com.google.api.gax.batching.BatchResource; import com.google.api.gax.batching.BatchingDescriptor; import com.google.api.gax.batching.BatchingRequestBuilder; import com.google.cloud.bigtable.data.v2.models.BulkMutation; @@ -90,6 +91,17 @@ public long countBytes(RowMutationEntry entry) { return entry.toProto().getSerializedSize(); } + @Override + public BatchResource createResource(RowMutationEntry element) { + long byteCount = countBytes(element); + return MutateRowsBatchResource.create(1, byteCount, element.toProto().getMutationsCount()); + } + + @Override + public BatchResource createEmptyResource() { + return MutateRowsBatchResource.create(0, 0, 0); + } + /** * A {@link BatchingRequestBuilder} that will spool mutations and send them out as a {@link * BulkMutation}. diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClientTests.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClientTests.java index a5ada34be5..17a2aa4a57 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClientTests.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClientTests.java @@ -29,6 +29,7 @@ import com.google.api.gax.rpc.testing.FakeOperationSnapshot; import com.google.bigtable.admin.v2.Backup.State; import com.google.bigtable.admin.v2.BackupInfo; +import com.google.bigtable.admin.v2.ChangeStreamConfig; import com.google.bigtable.admin.v2.ColumnFamily; import com.google.bigtable.admin.v2.CreateBackupMetadata; import com.google.bigtable.admin.v2.DeleteBackupRequest; @@ -45,6 +46,7 @@ import com.google.bigtable.admin.v2.Table.ClusterState; import com.google.bigtable.admin.v2.Table.View; import com.google.bigtable.admin.v2.TableName; +import com.google.bigtable.admin.v2.UpdateTableMetadata; import com.google.cloud.Identity; import com.google.cloud.Policy; import com.google.cloud.Role; @@ -68,6 +70,7 @@ import com.google.common.io.BaseEncoding; import com.google.longrunning.Operation; import com.google.protobuf.ByteString; +import com.google.protobuf.Duration; import com.google.protobuf.Empty; import com.google.protobuf.Timestamp; import com.google.protobuf.util.Timestamps; @@ -117,6 +120,13 @@ public class BigtableTableAdminClientTests { com.google.bigtable.admin.v2.CreateTableRequest, com.google.bigtable.admin.v2.Table> mockCreateTableCallable; + @Mock + private OperationCallable< + com.google.bigtable.admin.v2.UpdateTableRequest, + com.google.bigtable.admin.v2.Table, + UpdateTableMetadata> + mockUpdateTableOperationCallable; + @Mock private UnaryCallable< com.google.bigtable.admin.v2.ModifyColumnFamiliesRequest, @@ -204,6 +214,40 @@ public void testCreateTable() { assertThat(result).isEqualTo(Table.fromProto(expectedResponse)); } + @Test + public void testUpdateTable() { + // Setup + Mockito.when(mockStub.updateTableOperationCallable()) + .thenReturn(mockUpdateTableOperationCallable); + + com.google.cloud.bigtable.admin.v2.models.UpdateTableRequest request = + com.google.cloud.bigtable.admin.v2.models.UpdateTableRequest.of(TABLE_ID) + .addChangeStreamRetention(org.threeten.bp.Duration.ofHours(24)); + + com.google.bigtable.admin.v2.Table expectedResponse = + com.google.bigtable.admin.v2.Table.newBuilder() + .setName(TABLE_NAME) + .setChangeStreamConfig( + ChangeStreamConfig.newBuilder() + .setRetentionPeriod(Duration.newBuilder().setSeconds(86400).build()) + .build()) + .build(); + + mockOperationResult( + mockUpdateTableOperationCallable, + request.toProto(PROJECT_ID, INSTANCE_ID), + expectedResponse, + UpdateTableMetadata.newBuilder().setName(TABLE_NAME).build()); + + // Execute + Table actualResult = adminClient.updateTable(request); + + // Verify + assertThat(actualResult.getId()).isEqualTo(TABLE_ID); + assertThat(actualResult.getChangeStreamRetention()) + .isEqualTo(org.threeten.bp.Duration.ofHours(24)); + } + @Test public void testModifyFamilies() { // Setup diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/it/BigtableTableAdminClientIT.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/it/BigtableTableAdminClientIT.java index 65035c1184..a1b5c97e34 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/it/BigtableTableAdminClientIT.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/it/BigtableTableAdminClientIT.java @@ -21,6 +21,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import com.google.api.gax.rpc.NotFoundException; @@ -34,6 +35,7 @@ import com.google.cloud.bigtable.admin.v2.models.GCRules.VersionRule; import com.google.cloud.bigtable.admin.v2.models.ModifyColumnFamiliesRequest; import com.google.cloud.bigtable.admin.v2.models.Table; +import com.google.cloud.bigtable.admin.v2.models.UpdateTableRequest; import com.google.cloud.bigtable.test_helpers.env.EmulatorEnv; import com.google.cloud.bigtable.test_helpers.env.PrefixGenerator; import com.google.cloud.bigtable.test_helpers.env.TestEnvRule; @@ -85,7 +87,8 @@ public void createTable() { .addFamily("cf1") .addFamily("cf2", GCRULES.maxVersions(10)) .addSplit(ByteString.copyFromUtf8("b")) - .addSplit(ByteString.copyFromUtf8("q")); + .addSplit(ByteString.copyFromUtf8("q")) + .addChangeStreamRetention(Duration.ofDays(2)); Table tableResponse = tableAdmin.createTable(createTableReq); assertEquals(tableId, tableResponse.getId()); @@ -98,6 +101,39 @@ public void createTable() { assertFalse(columnFamilyById.get("cf1").hasGCRule()); assertTrue(columnFamilyById.get("cf2").hasGCRule()); assertEquals(10, ((VersionRule) columnFamilyById.get("cf2").getGCRule()).getMaxVersions()); + assertEquals(Duration.ofDays(2), tableResponse.getChangeStreamRetention()); + + // Disable change stream so the table can be deleted. + UpdateTableRequest updateTableRequest = + UpdateTableRequest.of(tableId).disableChangeStreamRetention(); + tableAdmin.updateTable(updateTableRequest); + } + + @Test + public void updateTable() { + assume() + .withMessage("Emulator doesn't return proper responses for CreateTable") + .that(testEnvRule.env()) + .isNotInstanceOf(EmulatorEnv.class); + + CreateTableRequest createTableReq = + CreateTableRequest.of(tableId) + .addFamily("cf1") + .addChangeStreamRetention(Duration.ofDays(2)); + Table tableResponse = tableAdmin.createTable(createTableReq); + assertEquals(tableId, tableResponse.getId()); + assertEquals(Duration.ofDays(2), tableResponse.getChangeStreamRetention()); + + UpdateTableRequest updateTableRequest = + UpdateTableRequest.of(tableId).addChangeStreamRetention(Duration.ofDays(4)); + tableResponse = tableAdmin.updateTable(updateTableRequest); + assertEquals(tableId, tableResponse.getId()); + assertEquals(Duration.ofDays(4), tableResponse.getChangeStreamRetention()); + + updateTableRequest = UpdateTableRequest.of(tableId).disableChangeStreamRetention(); + tableResponse = tableAdmin.updateTable(updateTableRequest); + assertEquals(tableId, tableResponse.getId()); + assertNull(tableResponse.getChangeStreamRetention()); } @Test diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/models/CreateTableRequestTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/models/CreateTableRequestTest.java index b12b3f24b7..5379b700e3 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/models/CreateTableRequestTest.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/models/CreateTableRequestTest.java @@ -18,6 +18,7 @@ import static com.google.cloud.bigtable.admin.v2.models.GCRules.GCRULES; import static com.google.common.truth.Truth.assertThat; +import com.google.bigtable.admin.v2.ChangeStreamConfig; import com.google.bigtable.admin.v2.ColumnFamily; import com.google.bigtable.admin.v2.GcRule; import com.google.bigtable.admin.v2.Table; @@ -46,7 +47,8 @@ public void testToProto() { .addFamily("family-id") .addFamily("another-family", GCRULES.maxAge(100, TimeUnit.HOURS)) .addSplit(splitKey) - .addSplit(secondSplitKey); + .addSplit(secondSplitKey) + .addChangeStreamRetention(Duration.ofHours(24)); com.google.bigtable.admin.v2.CreateTableRequest requestProto = com.google.bigtable.admin.v2.CreateTableRequest.newBuilder() @@ -63,6 +65,11 @@ public void testToProto() { com.google.protobuf.Duration.newBuilder() .setSeconds(100 * 60 * 60)) .build()) + .build()) + .setChangeStreamConfig( + ChangeStreamConfig.newBuilder() + .setRetentionPeriod( + com.google.protobuf.Duration.newBuilder().setSeconds(86400)) .build())) .setParent(NameUtil.formatInstanceName(PROJECT_ID, INSTANCE_ID)) .addInitialSplits( diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/models/UpdateTableRequestTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/models/UpdateTableRequestTest.java new file mode 100644 index 0000000000..fabebdccbf --- /dev/null +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/models/UpdateTableRequestTest.java @@ -0,0 +1,84 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.bigtable.admin.v2.models; + +import static com.google.common.truth.Truth.assertThat; + +import com.google.bigtable.admin.v2.ChangeStreamConfig; +import com.google.bigtable.admin.v2.Table; +import com.google.cloud.bigtable.admin.v2.internal.NameUtil; +import com.google.protobuf.FieldMask; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; +import org.threeten.bp.Duration; + +@RunWith(JUnit4.class) +public class UpdateTableRequestTest { + private static final String TABLE_ID = "my-table"; + private static final String PROJECT_ID = "my-project"; + private static final String INSTANCE_ID = "my-instance"; + + @Test + public void testEnableChangeStreamToProto() { + UpdateTableRequest request = + UpdateTableRequest.of(TABLE_ID).addChangeStreamRetention(Duration.ofHours(24)); + + com.google.bigtable.admin.v2.UpdateTableRequest requestProto = + com.google.bigtable.admin.v2.UpdateTableRequest.newBuilder() + .setTable( + Table.newBuilder() + .setName(NameUtil.formatTableName(PROJECT_ID, INSTANCE_ID, TABLE_ID)) + .setChangeStreamConfig( + ChangeStreamConfig.newBuilder() + .setRetentionPeriod( + com.google.protobuf.Duration.newBuilder().setSeconds(86400)) + .build())) + .setUpdateMask( + FieldMask.newBuilder().addPaths("change_stream_config.retention_period").build()) + .build(); + assertThat(request.toProto(PROJECT_ID, INSTANCE_ID)).isEqualTo(requestProto); + } + + @Test + public void testDisableChangeStreamToProto() { + UpdateTableRequest request = + UpdateTableRequest.of(TABLE_ID).addChangeStreamRetention(Duration.ofHours(0)); + + com.google.bigtable.admin.v2.UpdateTableRequest requestProto = + com.google.bigtable.admin.v2.UpdateTableRequest.newBuilder() + .setTable( + Table.newBuilder() + .setName(NameUtil.formatTableName(PROJECT_ID, INSTANCE_ID, TABLE_ID))) + .setUpdateMask(FieldMask.newBuilder().addPaths("change_stream_config").build()) + .build(); + assertThat(request.toProto(PROJECT_ID, INSTANCE_ID)).isEqualTo(requestProto); + } + + @Test + public void testNoChangeChangeStreamToProto() { + UpdateTableRequest request = UpdateTableRequest.of(TABLE_ID); + + com.google.bigtable.admin.v2.UpdateTableRequest requestProto = + com.google.bigtable.admin.v2.UpdateTableRequest.newBuilder() + .setTable( + Table.newBuilder() + .setName(NameUtil.formatTableName(PROJECT_ID, INSTANCE_ID, TABLE_ID))) + .build(); + assertThat(request.toProto(PROJECT_ID, INSTANCE_ID)).isEqualTo(requestProto); + } +} diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/BulkMutateIT.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/BulkMutateIT.java index 612cd7435a..a09d9415f5 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/BulkMutateIT.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/BulkMutateIT.java @@ -16,8 +16,10 @@ package com.google.cloud.bigtable.data.v2.it; import static com.google.common.truth.Truth.assertThat; +import static com.google.common.truth.TruthJUnit.assume; import com.google.api.gax.batching.BatcherImpl; +import com.google.api.gax.batching.BatchingSettings; import com.google.api.gax.batching.FlowControlEventStats; import com.google.cloud.bigtable.data.v2.BigtableDataClient; import com.google.cloud.bigtable.data.v2.BigtableDataSettings; @@ -25,6 +27,7 @@ import com.google.cloud.bigtable.data.v2.models.Query; import com.google.cloud.bigtable.data.v2.models.Row; import com.google.cloud.bigtable.data.v2.models.RowMutationEntry; +import com.google.cloud.bigtable.test_helpers.env.EmulatorEnv; import com.google.cloud.bigtable.test_helpers.env.TestEnvRule; import java.io.IOException; import java.util.Objects; @@ -33,6 +36,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; +import org.threeten.bp.Duration; @RunWith(JUnit4.class) public class BulkMutateIT { @@ -83,4 +87,52 @@ public void test() throws IOException, InterruptedException { assertThat(row.getCells()).hasSize(1); } } + + @Test + public void testManyMutations() throws IOException, InterruptedException { + // Emulator is very slow and will take a long time for the test to run + assume() + .withMessage("testManyMutations is not supported on Emulator") + .that(testEnvRule.env()) + .isNotInstanceOf(EmulatorEnv.class); + + BigtableDataSettings settings = testEnvRule.env().getDataClientSettings(); + String rowPrefix = UUID.randomUUID().toString(); + + BatchingSettings batchingSettings = + settings.getStubSettings().bulkMutateRowsSettings().getBatchingSettings(); + + settings + .toBuilder() + .stubSettings() + .bulkMutateRowsSettings() + .setBatchingSettings( + batchingSettings.toBuilder().setDelayThreshold(Duration.ofHours(1)).build()); + try (BigtableDataClient client = BigtableDataClient.create(settings); + BatcherImpl batcher = + (BatcherImpl) + client.newBulkMutationBatcher(testEnvRule.env().getTableId())) { + + String familyId = testEnvRule.env().getFamilyId(); + for (int i = 0; i < 2; i++) { + String key = rowPrefix + "test-key"; + RowMutationEntry rowMutationEntry = RowMutationEntry.create(key); + // Create mutation entries with many columns. The batcher should flush every time. + for (long j = 0; j < 50001; j++) { + rowMutationEntry.setCell(familyId, "q" + j + i, j); + } + batcher.add(rowMutationEntry); + } + batcher.flush(); + // Query a key to make sure the write succeeded + Row row = + testEnvRule + .env() + .getDataClient() + .readRowsCallable() + .first() + .call(Query.create(testEnvRule.env().getTableId()).rowKey(rowPrefix + "test-key")); + assertThat(row.getCells()).hasSize(100002); + } + } } diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/BulkMutationTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/BulkMutationTest.java index dc06a58f5c..0e4c992648 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/BulkMutationTest.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/BulkMutationTest.java @@ -28,6 +28,7 @@ import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; +import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -172,4 +173,31 @@ public void fromProtoTest() { .matches(NameUtil.formatTableName(projectId, instanceId, TABLE_ID)); assertThat(overriddenRequest.getAppProfileId()).matches(appProfile); } + + @Test + public void testManyMutations() { + BulkMutation bulkMutation = BulkMutation.create(TABLE_ID); + + try { + for (int i = 0; i < 3; i++) { + String key = "key" + i; + Mutation mutation = Mutation.create(); + for (int j = 0; j < 50000; j++) { + mutation.setCell("f", "q" + j, "value"); + } + bulkMutation.add(key, mutation); + } + Assert.fail("Test should fail with IllegalArgumentException"); + } catch (IllegalArgumentException e) { + assertThat(e.getMessage()).contains("Too many mutations"); + } + + // we should be able to add 10000 mutations + bulkMutation = BulkMutation.create(TABLE_ID); + Mutation mutation = Mutation.create(); + for (int i = 0; i < 100000; i++) { + mutation.setCell("f", "q" + i, "value"); + } + bulkMutation.add("key", mutation); + } } diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/BigtableBatchingCallSettingsTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/BigtableBatchingCallSettingsTest.java index 3337e12b6d..dcdef068a5 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/BigtableBatchingCallSettingsTest.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/BigtableBatchingCallSettingsTest.java @@ -176,8 +176,8 @@ public void testFlowControlMandatorySettings() { BatchingSettings.newBuilder() .setFlowControlSettings( FlowControlSettings.newBuilder() - .setMaxOutstandingElementCount(10L) - .setMaxOutstandingRequestBytes(10L) + .setMaxOutstandingElementCount(11L) + .setMaxOutstandingRequestBytes(11L) .build()) .setElementCountThreshold(10L) .setRequestByteThreshold(10L) diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/metrics/BuiltinMetricsTracerTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/metrics/BuiltinMetricsTracerTest.java index 3bc283a7f7..8a371cb2e7 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/metrics/BuiltinMetricsTracerTest.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/metrics/BuiltinMetricsTracerTest.java @@ -207,8 +207,8 @@ public void sendMessage(ReqT message) { .setDelayThreshold(Duration.ofHours(1)) .setFlowControlSettings( FlowControlSettings.newBuilder() - .setMaxOutstandingElementCount((long) batchElementCount) - .setMaxOutstandingRequestBytes(1000L) + .setMaxOutstandingElementCount((long) batchElementCount + 1) + .setMaxOutstandingRequestBytes(1001L) .build()) .build()); stubSettingsBuilder.setTracerFactory(mockFactory); @@ -478,6 +478,9 @@ public void testBatchBlockingLatencies() throws InterruptedException { batcher.add(RowMutationEntry.create("key").setCell("f", "q", "v")); } + // closing the batcher to trigger the third flush + batcher.close(); + int expectedNumRequests = 6 / batchElementCount; ArgumentCaptor throttledTime = ArgumentCaptor.forClass(Long.class); verify(statsRecorderWrapper, timeout(1000).times(expectedNumRequests)) diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/metrics/MetricsTracerTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/metrics/MetricsTracerTest.java index b1b966ee9d..bb5e89aab4 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/metrics/MetricsTracerTest.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/metrics/MetricsTracerTest.java @@ -20,6 +20,7 @@ import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.when; +import com.google.api.gax.batching.BatchResource; import com.google.api.gax.batching.Batcher; import com.google.api.gax.batching.BatcherImpl; import com.google.api.gax.batching.BatchingDescriptor; @@ -422,6 +423,8 @@ public Object answer(InvocationOnMock invocation) { public void testBatchMutateRowsThrottledTime() throws Exception { FlowController flowController = Mockito.mock(FlowController.class); BatchingDescriptor batchingDescriptor = Mockito.mock(MutateRowsBatchingDescriptor.class); + when(batchingDescriptor.createResource(any())).thenReturn(new FakeBatchResource()); + when(batchingDescriptor.createEmptyResource()).thenReturn(new FakeBatchResource()); // Mock throttling final long throttled = 50; doAnswer( @@ -436,7 +439,6 @@ public Object answer(InvocationOnMock invocation) throws Throwable { .reserve(any(Long.class), any(Long.class)); when(flowController.getMaxElementCountLimit()).thenReturn(null); when(flowController.getMaxRequestBytesLimit()).thenReturn(null); - when(batchingDescriptor.countBytes(any())).thenReturn(1l); when(batchingDescriptor.newRequestBuilder(any())).thenCallRealMethod(); doAnswer( @@ -486,4 +488,29 @@ public Object answer(InvocationOnMock invocation) { private static StreamObserver anyObserver(Class returnType) { return (StreamObserver) any(returnType); } + + private class FakeBatchResource implements BatchResource { + + FakeBatchResource() {} + + @Override + public BatchResource add(BatchResource resource) { + return new FakeBatchResource(); + } + + @Override + public long getElementCount() { + return 1; + } + + @Override + public long getByteCount() { + return 1; + } + + @Override + public boolean shouldFlush(long maxElementThreshold, long maxBytesThreshold) { + return false; + } + } } diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/mutaterows/MutateRowsBatchingDescriptorTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/mutaterows/MutateRowsBatchingDescriptorTest.java index 875a8e3885..81d5c67396 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/mutaterows/MutateRowsBatchingDescriptorTest.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/mutaterows/MutateRowsBatchingDescriptorTest.java @@ -19,6 +19,7 @@ import com.google.api.core.SettableApiFuture; import com.google.api.gax.batching.BatchEntry; +import com.google.api.gax.batching.BatchResource; import com.google.api.gax.batching.BatchingRequestBuilder; import com.google.api.gax.grpc.GrpcStatusCode; import com.google.api.gax.rpc.DeadlineExceededException; @@ -180,4 +181,23 @@ public void splitExceptionWithFailedMutationsTest() { .hasCauseThat() .isEqualTo(serverError.getFailedMutations().get(1).getError()); } + + @Test + public void shouldFlushTest() { + MutateRowsBatchingDescriptor underTest = new MutateRowsBatchingDescriptor(); + RowMutationEntry entryWithManyMutations = RowMutationEntry.create("key1"); + for (int i = 0; i < 100000; i++) { + entryWithManyMutations.setCell("f", "q", "v" + i); + } + RowMutationEntry entryWithSingleEntry = RowMutationEntry.create("key1").setCell("f", "q", "v"); + BatchResource resourceWithManyMutations = underTest.createResource(entryWithManyMutations); + BatchResource resourceWithSingleMutation = underTest.createResource(entryWithSingleEntry); + + assertThat(resourceWithManyMutations.shouldFlush(1, 20 * 1000 * 1000)).isFalse(); + assertThat( + resourceWithManyMutations + .add(resourceWithSingleMutation) + .shouldFlush(3, 20 * 1000 * 1000)) + .isTrue(); + } } diff --git a/grpc-google-cloud-bigtable-admin-v2/pom.xml b/grpc-google-cloud-bigtable-admin-v2/pom.xml index 78096aeab5..3d1e89ebec 100644 --- a/grpc-google-cloud-bigtable-admin-v2/pom.xml +++ b/grpc-google-cloud-bigtable-admin-v2/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-bigtable-admin-v2 - 2.24.1 + 2.25.0 grpc-google-cloud-bigtable-admin-v2 GRPC library for grpc-google-cloud-bigtable-admin-v2 com.google.cloud google-cloud-bigtable-parent - 2.24.1 + 2.25.0 @@ -18,14 +18,14 @@ com.google.cloud google-cloud-bigtable-deps-bom - 2.24.1 + 2.25.0 pom import com.google.cloud google-cloud-bigtable-bom - 2.24.1 + 2.25.0 pom import diff --git a/grpc-google-cloud-bigtable-v2/pom.xml b/grpc-google-cloud-bigtable-v2/pom.xml index a9be74a224..d1a9e7e6ba 100644 --- a/grpc-google-cloud-bigtable-v2/pom.xml +++ b/grpc-google-cloud-bigtable-v2/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-bigtable-v2 - 2.24.1 + 2.25.0 grpc-google-cloud-bigtable-v2 GRPC library for grpc-google-cloud-bigtable-v2 com.google.cloud google-cloud-bigtable-parent - 2.24.1 + 2.25.0 @@ -18,14 +18,14 @@ com.google.cloud google-cloud-bigtable-deps-bom - 2.24.1 + 2.25.0 pom import com.google.cloud google-cloud-bigtable-bom - 2.24.1 + 2.25.0 pom import diff --git a/pom.xml b/pom.xml index ff472c8fc6..6ff6b6a618 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ google-cloud-bigtable-parent pom - 2.24.1 + 2.25.0 Google Cloud Bigtable Parent https://github.com/googleapis/java-bigtable @@ -153,27 +153,27 @@ com.google.api.grpc proto-google-cloud-bigtable-v2 - 2.24.1 + 2.25.0 com.google.api.grpc proto-google-cloud-bigtable-admin-v2 - 2.24.1 + 2.25.0 com.google.api.grpc grpc-google-cloud-bigtable-v2 - 2.24.1 + 2.25.0 com.google.api.grpc grpc-google-cloud-bigtable-admin-v2 - 2.24.1 + 2.25.0 com.google.cloud google-cloud-bigtable - 2.24.1 + 2.25.0 diff --git a/proto-google-cloud-bigtable-admin-v2/pom.xml b/proto-google-cloud-bigtable-admin-v2/pom.xml index 4b55dd19ff..f444cb95ad 100644 --- a/proto-google-cloud-bigtable-admin-v2/pom.xml +++ b/proto-google-cloud-bigtable-admin-v2/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-bigtable-admin-v2 - 2.24.1 + 2.25.0 proto-google-cloud-bigtable-admin-v2 PROTO library for proto-google-cloud-bigtable-admin-v2 com.google.cloud google-cloud-bigtable-parent - 2.24.1 + 2.25.0 @@ -18,14 +18,14 @@ com.google.cloud google-cloud-bigtable-deps-bom - 2.24.1 + 2.25.0 pom import com.google.cloud google-cloud-bigtable-bom - 2.24.1 + 2.25.0 pom import diff --git a/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/Backup.java b/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/Backup.java index b4b2a32eb4..49e16b34c6 100644 --- a/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/Backup.java +++ b/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/Backup.java @@ -358,7 +358,7 @@ public com.google.protobuf.ByteString getSourceTableBytes() { * *
        * Required. The expiration time of the backup, with microseconds
    -   * granularity that must be at least 6 hours and at most 30 days
    +   * granularity that must be at least 6 hours and at most 90 days
        * from the time the request is received. Once the `expire_time`
        * has passed, Cloud Bigtable will delete the backup and free the
        * resources used by the backup.
    @@ -378,7 +378,7 @@ public boolean hasExpireTime() {
        *
        * 
        * Required. The expiration time of the backup, with microseconds
    -   * granularity that must be at least 6 hours and at most 30 days
    +   * granularity that must be at least 6 hours and at most 90 days
        * from the time the request is received. Once the `expire_time`
        * has passed, Cloud Bigtable will delete the backup and free the
        * resources used by the backup.
    @@ -398,7 +398,7 @@ public com.google.protobuf.Timestamp getExpireTime() {
        *
        * 
        * Required. The expiration time of the backup, with microseconds
    -   * granularity that must be at least 6 hours and at most 30 days
    +   * granularity that must be at least 6 hours and at most 90 days
        * from the time the request is received. Once the `expire_time`
        * has passed, Cloud Bigtable will delete the backup and free the
        * resources used by the backup.
    @@ -1454,7 +1454,7 @@ public Builder setSourceTableBytes(com.google.protobuf.ByteString value) {
          *
          * 
          * Required. The expiration time of the backup, with microseconds
    -     * granularity that must be at least 6 hours and at most 30 days
    +     * granularity that must be at least 6 hours and at most 90 days
          * from the time the request is received. Once the `expire_time`
          * has passed, Cloud Bigtable will delete the backup and free the
          * resources used by the backup.
    @@ -1473,7 +1473,7 @@ public boolean hasExpireTime() {
          *
          * 
          * Required. The expiration time of the backup, with microseconds
    -     * granularity that must be at least 6 hours and at most 30 days
    +     * granularity that must be at least 6 hours and at most 90 days
          * from the time the request is received. Once the `expire_time`
          * has passed, Cloud Bigtable will delete the backup and free the
          * resources used by the backup.
    @@ -1498,7 +1498,7 @@ public com.google.protobuf.Timestamp getExpireTime() {
          *
          * 
          * Required. The expiration time of the backup, with microseconds
    -     * granularity that must be at least 6 hours and at most 30 days
    +     * granularity that must be at least 6 hours and at most 90 days
          * from the time the request is received. Once the `expire_time`
          * has passed, Cloud Bigtable will delete the backup and free the
          * resources used by the backup.
    @@ -1525,7 +1525,7 @@ public Builder setExpireTime(com.google.protobuf.Timestamp value) {
          *
          * 
          * Required. The expiration time of the backup, with microseconds
    -     * granularity that must be at least 6 hours and at most 30 days
    +     * granularity that must be at least 6 hours and at most 90 days
          * from the time the request is received. Once the `expire_time`
          * has passed, Cloud Bigtable will delete the backup and free the
          * resources used by the backup.
    @@ -1549,7 +1549,7 @@ public Builder setExpireTime(com.google.protobuf.Timestamp.Builder builderForVal
          *
          * 
          * Required. The expiration time of the backup, with microseconds
    -     * granularity that must be at least 6 hours and at most 30 days
    +     * granularity that must be at least 6 hours and at most 90 days
          * from the time the request is received. Once the `expire_time`
          * has passed, Cloud Bigtable will delete the backup and free the
          * resources used by the backup.
    @@ -1579,7 +1579,7 @@ public Builder mergeExpireTime(com.google.protobuf.Timestamp value) {
          *
          * 
          * Required. The expiration time of the backup, with microseconds
    -     * granularity that must be at least 6 hours and at most 30 days
    +     * granularity that must be at least 6 hours and at most 90 days
          * from the time the request is received. Once the `expire_time`
          * has passed, Cloud Bigtable will delete the backup and free the
          * resources used by the backup.
    @@ -1603,7 +1603,7 @@ public Builder clearExpireTime() {
          *
          * 
          * Required. The expiration time of the backup, with microseconds
    -     * granularity that must be at least 6 hours and at most 30 days
    +     * granularity that must be at least 6 hours and at most 90 days
          * from the time the request is received. Once the `expire_time`
          * has passed, Cloud Bigtable will delete the backup and free the
          * resources used by the backup.
    @@ -1622,7 +1622,7 @@ public com.google.protobuf.Timestamp.Builder getExpireTimeBuilder() {
          *
          * 
          * Required. The expiration time of the backup, with microseconds
    -     * granularity that must be at least 6 hours and at most 30 days
    +     * granularity that must be at least 6 hours and at most 90 days
          * from the time the request is received. Once the `expire_time`
          * has passed, Cloud Bigtable will delete the backup and free the
          * resources used by the backup.
    @@ -1645,7 +1645,7 @@ public com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder() {
          *
          * 
          * Required. The expiration time of the backup, with microseconds
    -     * granularity that must be at least 6 hours and at most 30 days
    +     * granularity that must be at least 6 hours and at most 90 days
          * from the time the request is received. Once the `expire_time`
          * has passed, Cloud Bigtable will delete the backup and free the
          * resources used by the backup.
    diff --git a/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/BackupOrBuilder.java b/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/BackupOrBuilder.java
    index b29a3f788b..cf990353d5 100644
    --- a/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/BackupOrBuilder.java
    +++ b/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/BackupOrBuilder.java
    @@ -104,7 +104,7 @@ public interface BackupOrBuilder
        *
        * 
        * Required. The expiration time of the backup, with microseconds
    -   * granularity that must be at least 6 hours and at most 30 days
    +   * granularity that must be at least 6 hours and at most 90 days
        * from the time the request is received. Once the `expire_time`
        * has passed, Cloud Bigtable will delete the backup and free the
        * resources used by the backup.
    @@ -121,7 +121,7 @@ public interface BackupOrBuilder
        *
        * 
        * Required. The expiration time of the backup, with microseconds
    -   * granularity that must be at least 6 hours and at most 30 days
    +   * granularity that must be at least 6 hours and at most 90 days
        * from the time the request is received. Once the `expire_time`
        * has passed, Cloud Bigtable will delete the backup and free the
        * resources used by the backup.
    @@ -138,7 +138,7 @@ public interface BackupOrBuilder
        *
        * 
        * Required. The expiration time of the backup, with microseconds
    -   * granularity that must be at least 6 hours and at most 30 days
    +   * granularity that must be at least 6 hours and at most 90 days
        * from the time the request is received. Once the `expire_time`
        * has passed, Cloud Bigtable will delete the backup and free the
        * resources used by the backup.
    diff --git a/proto-google-cloud-bigtable-admin-v2/src/main/proto/google/bigtable/admin/v2/table.proto b/proto-google-cloud-bigtable-admin-v2/src/main/proto/google/bigtable/admin/v2/table.proto
    index 1e6e0e3836..e597850ebf 100644
    --- a/proto-google-cloud-bigtable-admin-v2/src/main/proto/google/bigtable/admin/v2/table.proto
    +++ b/proto-google-cloud-bigtable-admin-v2/src/main/proto/google/bigtable/admin/v2/table.proto
    @@ -1,4 +1,4 @@
    -// Copyright 2022 Google LLC
    +// Copyright 2023 Google LLC
     //
     // Licensed under the Apache License, Version 2.0 (the "License");
     // you may not use this file except in compliance with the License.
    @@ -363,7 +363,7 @@ message Backup {
       ];
     
       // Required. The expiration time of the backup, with microseconds
    -  // granularity that must be at least 6 hours and at most 30 days
    +  // granularity that must be at least 6 hours and at most 90 days
       // from the time the request is received. Once the `expire_time`
       // has passed, Cloud Bigtable will delete the backup and free the
       // resources used by the backup.
    diff --git a/proto-google-cloud-bigtable-v2/pom.xml b/proto-google-cloud-bigtable-v2/pom.xml
    index 2e3187c395..d8eacdb383 100644
    --- a/proto-google-cloud-bigtable-v2/pom.xml
    +++ b/proto-google-cloud-bigtable-v2/pom.xml
    @@ -4,13 +4,13 @@
       4.0.0
       com.google.api.grpc
       proto-google-cloud-bigtable-v2
    -  2.24.1
    +  2.25.0
       proto-google-cloud-bigtable-v2
       PROTO library for proto-google-cloud-bigtable-v2
       
         com.google.cloud
         google-cloud-bigtable-parent
    -    2.24.1
    +    2.25.0
       
     
       
    @@ -18,14 +18,14 @@
           
             com.google.cloud
             google-cloud-bigtable-deps-bom
    -        2.24.1
    +        2.25.0
             pom
             import
           
           
             com.google.cloud
             google-cloud-bigtable-bom
    -        2.24.1
    +        2.25.0
             pom
             import
           
    diff --git a/proto-google-cloud-bigtable-v2/src/main/java/com/google/bigtable/v2/ReadRowsRequest.java b/proto-google-cloud-bigtable-v2/src/main/java/com/google/bigtable/v2/ReadRowsRequest.java
    index 3101db169a..60351c5c6d 100644
    --- a/proto-google-cloud-bigtable-v2/src/main/java/com/google/bigtable/v2/ReadRowsRequest.java
    +++ b/proto-google-cloud-bigtable-v2/src/main/java/com/google/bigtable/v2/ReadRowsRequest.java
    @@ -506,9 +506,13 @@ public com.google.bigtable.v2.ReadRowsRequest.RequestStatsView getRequestStatsVi
        *
        * Return rows in lexiographical descending order of the row keys. The row
        * contents will not be affected by this flag.
    -   * Example result set: [
    -   * {key: "k2", "f:col1": "v1", "f:col2": "v1"}, {key: "k1", "f:col1": "v2",
    -   * "f:col2": "v2"} ].
    +   *
    +   * Example result set:
    +   *
    +   *     [
    +   *       {key: "k2", "f:col1": "v1", "f:col2": "v1"},
    +   *       {key: "k1", "f:col1": "v2", "f:col2": "v2"}
    +   *     ]
        * 
    * * bool reversed = 7; @@ -1788,9 +1792,13 @@ public Builder clearRequestStatsView() { * * Return rows in lexiographical descending order of the row keys. The row * contents will not be affected by this flag. - * Example result set: [ - * {key: "k2", "f:col1": "v1", "f:col2": "v1"}, {key: "k1", "f:col1": "v2", - * "f:col2": "v2"} ]. + * + * Example result set: + * + * [ + * {key: "k2", "f:col1": "v1", "f:col2": "v1"}, + * {key: "k1", "f:col1": "v2", "f:col2": "v2"} + * ] *
    * * bool reversed = 7; @@ -1810,9 +1818,13 @@ public boolean getReversed() { * * Return rows in lexiographical descending order of the row keys. The row * contents will not be affected by this flag. - * Example result set: [ - * {key: "k2", "f:col1": "v1", "f:col2": "v1"}, {key: "k1", "f:col1": "v2", - * "f:col2": "v2"} ]. + * + * Example result set: + * + * [ + * {key: "k2", "f:col1": "v1", "f:col2": "v1"}, + * {key: "k1", "f:col1": "v2", "f:col2": "v2"} + * ] *
    * * bool reversed = 7; @@ -1836,9 +1848,13 @@ public Builder setReversed(boolean value) { * * Return rows in lexiographical descending order of the row keys. The row * contents will not be affected by this flag. - * Example result set: [ - * {key: "k2", "f:col1": "v1", "f:col2": "v1"}, {key: "k1", "f:col1": "v2", - * "f:col2": "v2"} ]. + * + * Example result set: + * + * [ + * {key: "k2", "f:col1": "v1", "f:col2": "v1"}, + * {key: "k1", "f:col1": "v2", "f:col2": "v2"} + * ] *
    * * bool reversed = 7; diff --git a/proto-google-cloud-bigtable-v2/src/main/java/com/google/bigtable/v2/ReadRowsRequestOrBuilder.java b/proto-google-cloud-bigtable-v2/src/main/java/com/google/bigtable/v2/ReadRowsRequestOrBuilder.java index f3f1a10e95..1ebbf6d820 100644 --- a/proto-google-cloud-bigtable-v2/src/main/java/com/google/bigtable/v2/ReadRowsRequestOrBuilder.java +++ b/proto-google-cloud-bigtable-v2/src/main/java/com/google/bigtable/v2/ReadRowsRequestOrBuilder.java @@ -207,9 +207,13 @@ public interface ReadRowsRequestOrBuilder * * Return rows in lexiographical descending order of the row keys. The row * contents will not be affected by this flag. - * Example result set: [ - * {key: "k2", "f:col1": "v1", "f:col2": "v1"}, {key: "k1", "f:col1": "v2", - * "f:col2": "v2"} ]. + * + * Example result set: + * + * [ + * {key: "k2", "f:col1": "v1", "f:col2": "v1"}, + * {key: "k1", "f:col1": "v2", "f:col2": "v2"} + * ] *
    * * bool reversed = 7; diff --git a/proto-google-cloud-bigtable-v2/src/main/proto/google/bigtable/v2/bigtable.proto b/proto-google-cloud-bigtable-v2/src/main/proto/google/bigtable/v2/bigtable.proto index 0e8c38f168..aca13f586c 100644 --- a/proto-google-cloud-bigtable-v2/src/main/proto/google/bigtable/v2/bigtable.proto +++ b/proto-google-cloud-bigtable-v2/src/main/proto/google/bigtable/v2/bigtable.proto @@ -277,9 +277,13 @@ message ReadRowsRequest { // // Return rows in lexiographical descending order of the row keys. The row // contents will not be affected by this flag. - // Example result set: [ - // {key: "k2", "f:col1": "v1", "f:col2": "v1"}, {key: "k1", "f:col1": "v2", - // "f:col2": "v2"} ]. + // + // Example result set: + // + // [ + // {key: "k2", "f:col1": "v1", "f:col2": "v1"}, + // {key: "k1", "f:col1": "v2", "f:col2": "v2"} + // ] bool reversed = 7; } diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 7de0ecbe50..692745e13c 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -29,7 +29,7 @@ com.google.cloud google-cloud-bigtable - 2.23.3 + 2.24.1 diff --git a/samples/native-image-sample/pom.xml b/samples/native-image-sample/pom.xml index 3206ecdc8c..915af24e99 100644 --- a/samples/native-image-sample/pom.xml +++ b/samples/native-image-sample/pom.xml @@ -29,7 +29,7 @@ com.google.cloud libraries-bom - 26.17.0 + 26.18.0 pom import diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 67a692197f..46323684ca 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -28,7 +28,7 @@ com.google.cloud google-cloud-bigtable - 2.24.1 + 2.25.0 diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index 2a54e834ac..1887fb27f3 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -30,7 +30,7 @@ com.google.cloud libraries-bom - 26.17.0 + 26.18.0 pom import diff --git a/test-proxy/pom.xml b/test-proxy/pom.xml index ba06bde3d4..6b3be22be1 100644 --- a/test-proxy/pom.xml +++ b/test-proxy/pom.xml @@ -12,11 +12,11 @@ google-cloud-bigtable-parent com.google.cloud - 2.24.1 + 2.25.0 - 2.24.1 + 2.25.0 diff --git a/versions.txt b/versions.txt index 7471e42ac8..1e8f8cd8d5 100644 --- a/versions.txt +++ b/versions.txt @@ -1,10 +1,10 @@ # Format: # module:released-version:current-version -google-cloud-bigtable:2.24.1:2.24.1 -grpc-google-cloud-bigtable-admin-v2:2.24.1:2.24.1 -grpc-google-cloud-bigtable-v2:2.24.1:2.24.1 -proto-google-cloud-bigtable-admin-v2:2.24.1:2.24.1 -proto-google-cloud-bigtable-v2:2.24.1:2.24.1 -google-cloud-bigtable-emulator:0.161.1:0.161.1 -google-cloud-bigtable-emulator-core:2.24.1:2.24.1 +google-cloud-bigtable:2.25.0:2.25.0 +grpc-google-cloud-bigtable-admin-v2:2.25.0:2.25.0 +grpc-google-cloud-bigtable-v2:2.25.0:2.25.0 +proto-google-cloud-bigtable-admin-v2:2.25.0:2.25.0 +proto-google-cloud-bigtable-v2:2.25.0:2.25.0 +google-cloud-bigtable-emulator:0.162.0:0.162.0 +google-cloud-bigtable-emulator-core:2.25.0:2.25.0