Skip to content
This repository was archived by the owner on May 8, 2026. It is now read-only.

Commit a0990e7

Browse files
committed
Merge branch 'main' into PR #2663 to update
2 parents 6c2d94d + b6cb64a commit a0990e7

104 files changed

Lines changed: 586 additions & 498 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

google-cloud-bigtable/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@
427427
<compilerArgs>
428428
<arg>-XDcompilePolicy=simple</arg>
429429
<arg>--should-stop=ifError=FLOW</arg>
430-
<arg>-Xplugin:ErrorProne -XepDisableWarningsInGeneratedCode -Xep:MissingSummary:OFF -Xep:InlineMeSuggester:OFF -Xep:AutoValueImmutableFields:OFF -Xep:ObjectEqualsForPrimitives:OFF</arg>
430+
<arg>-Xplugin:ErrorProne -XepDisableWarningsInGeneratedCode -Xep:MissingSummary:OFF -Xep:InlineMeSuggester:OFF -Xep:AutoValueImmutableFields:OFF -Xep:ObjectEqualsForPrimitives:OFF -Xep:JavaDurationGetSecondsToToSeconds:OFF</arg>
431431

432432
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
433433
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClient.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,6 +1042,7 @@ public ApiFuture<Void> dropAllRowsAsync(String tableId) {
10421042
* @throws com.google.api.gax.retrying.PollException when polling exceeds the total timeout
10431043
*/
10441044
@ObsoleteApi("Use getBaseClient() to access the auto-generated proto-based methods instead.")
1045+
@Deprecated
10451046
public void awaitReplication(String tableId) {
10461047
// TODO(igorbernstein2): remove usage of typesafe names
10471048
com.google.bigtable.admin.v2.TableName tableName =
@@ -1667,6 +1668,7 @@ public Backup apply(com.google.bigtable.admin.v2.Backup backupProto) {
16671668
*/
16681669
@SuppressWarnings("WeakerAccess")
16691670
@ObsoleteApi("Use getBaseClient() to access the auto-generated proto-based methods instead.")
1671+
@Deprecated
16701672
public ApiFuture<Void> awaitReplicationAsync(final String tableId) {
16711673
// TODO(igorbernstein2): remove usage of typesafe names
16721674
com.google.bigtable.admin.v2.TableName tableName =

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/SubsetView.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ public com.google.bigtable.admin.v2.AuthorizedView.SubsetView toProto() {
105105
}
106106

107107
@Override
108+
@SuppressWarnings("EqualsGetClass")
108109
public boolean equals(Object o) {
109110
if (this == o) {
110111
return true;

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/Table.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.util.Map;
2828
import java.util.Map.Entry;
2929
import javax.annotation.Nonnull;
30+
import javax.annotation.Nullable;
3031
import org.threeten.bp.Duration;
3132

3233
/** Wrapper for {@link Table} protocol buffer object */
@@ -111,6 +112,7 @@ public static class AutomatedBackupPolicy {
111112
@InternalApi
112113
public static AutomatedBackupPolicy fromProto(
113114
com.google.bigtable.admin.v2.Table.AutomatedBackupPolicy proto) {
115+
Preconditions.checkNotNull(proto);
114116
return new AutomatedBackupPolicy(proto);
115117
}
116118

@@ -143,7 +145,7 @@ public String viewConfig() {
143145

144146
private final Duration changeStreamRetention;
145147
private final boolean deletionProtection;
146-
private static AutomatedBackupPolicy automatedBackupPolicy;
148+
@Nullable private final AutomatedBackupPolicy automatedBackupPolicy;
147149

148150
@InternalApi
149151
public static Table fromProto(@Nonnull com.google.bigtable.admin.v2.Table proto) {
@@ -170,10 +172,9 @@ public static Table fromProto(@Nonnull com.google.bigtable.admin.v2.Table proto)
170172
proto.getChangeStreamConfig().getRetentionPeriod().getNanos());
171173
}
172174

175+
AutomatedBackupPolicy automatedBackupPolicy = null;
173176
if (proto.hasAutomatedBackupPolicy()) {
174177
automatedBackupPolicy = AutomatedBackupPolicy.fromProto(proto.getAutomatedBackupPolicy());
175-
} else {
176-
automatedBackupPolicy = null;
177178
}
178179

179180
return new Table(
@@ -191,14 +192,14 @@ private Table(
191192
List<ColumnFamily> columnFamilies,
192193
Duration changeStreamRetention,
193194
boolean deletionProtection,
194-
AutomatedBackupPolicy automatedBackupPolicy) {
195+
@Nullable AutomatedBackupPolicy automatedBackupPolicy) {
195196
this.instanceId = tableName.getInstance();
196197
this.id = tableName.getTable();
197198
this.replicationStatesByClusterId = replicationStatesByClusterId;
198199
this.columnFamilies = columnFamilies;
199200
this.changeStreamRetention = changeStreamRetention;
200201
this.deletionProtection = deletionProtection;
201-
Table.automatedBackupPolicy = automatedBackupPolicy;
202+
this.automatedBackupPolicy = automatedBackupPolicy;
202203
}
203204

204205
/** Gets the table's id. */
@@ -230,10 +231,11 @@ public boolean isDeletionProtected() {
230231

231232
/** Returns whether this table has automated backups enabled. */
232233
public boolean isAutomatedBackupEnabled() {
233-
return automatedBackupPolicy == null ? false : true;
234+
return automatedBackupPolicy != null;
234235
}
235236

236237
/** Returns the automated backup policy config. */
238+
@Nullable
237239
public AutomatedBackupPolicy getAutomatedBackupPolicy() {
238240
return automatedBackupPolicy;
239241
}
@@ -253,7 +255,7 @@ public boolean equals(Object o) {
253255
&& Objects.equal(columnFamilies, table.columnFamilies)
254256
&& Objects.equal(changeStreamRetention, table.changeStreamRetention)
255257
&& Objects.equal(deletionProtection, table.deletionProtection)
256-
&& Objects.equal(automatedBackupPolicy, Table.automatedBackupPolicy);
258+
&& Objects.equal(automatedBackupPolicy, table.automatedBackupPolicy);
257259
}
258260

259261
@Override

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/Type.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ static Type fromProto(com.google.bigtable.admin.v2.Type source) {
5252
return Aggregate.fromProto(source.getAggregateType());
5353
case KIND_NOT_SET:
5454
return Raw.create();
55+
default:
56+
throw new UnsupportedOperationException();
5557
}
56-
throw new UnsupportedOperationException();
5758
}
5859

5960
/** The raw type denotes the absence of a type. */
@@ -204,8 +205,9 @@ static Encoding fromProto(com.google.bigtable.admin.v2.Type.Int64.Encoding sourc
204205
return BigEndianBytes.create();
205206
case ENCODING_NOT_SET:
206207
return BigEndianBytes.create();
208+
default:
209+
throw new UnsupportedOperationException();
207210
}
208-
throw new UnsupportedOperationException();
209211
}
210212

211213
@AutoValue

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/AwaitConsistencyCallable.java

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@
2121
import com.google.api.core.ApiFutures;
2222
import com.google.api.gax.retrying.ExponentialPollAlgorithm;
2323
import com.google.api.gax.retrying.NonCancellableFuture;
24-
import com.google.api.gax.retrying.ResultRetryAlgorithm;
24+
import com.google.api.gax.retrying.ResultRetryAlgorithmWithContext;
2525
import com.google.api.gax.retrying.RetryAlgorithm;
2626
import com.google.api.gax.retrying.RetrySettings;
27+
import com.google.api.gax.retrying.RetryingContext;
2728
import com.google.api.gax.retrying.RetryingExecutor;
2829
import com.google.api.gax.retrying.RetryingFuture;
2930
import com.google.api.gax.retrying.ScheduledRetryingExecutor;
@@ -149,7 +150,7 @@ private static class AttemptCallable<RequestT, ResponseT> implements Callable<Re
149150
private final RequestT request;
150151

151152
private volatile RetryingFuture<ResponseT> externalFuture;
152-
private volatile ApiCallContext callContext;
153+
private final ApiCallContext callContext;
153154

154155
AttemptCallable(
155156
UnaryCallable<RequestT, ResponseT> callable, RequestT request, ApiCallContext callContext) {
@@ -186,7 +187,8 @@ public ResponseT call() {
186187
* handle this.
187188
*/
188189
private static class PollResultAlgorithm
189-
implements ResultRetryAlgorithm<CheckConsistencyResponse> {
190+
implements ResultRetryAlgorithmWithContext<CheckConsistencyResponse> {
191+
190192
@Override
191193
public TimedAttemptSettings createNextAttempt(
192194
Throwable prevThrowable,
@@ -195,6 +197,22 @@ public TimedAttemptSettings createNextAttempt(
195197
return null;
196198
}
197199

200+
@Override
201+
public TimedAttemptSettings createNextAttempt(
202+
RetryingContext context,
203+
Throwable previousThrowable,
204+
CheckConsistencyResponse previousResponse,
205+
TimedAttemptSettings previousSettings) {
206+
return null;
207+
}
208+
209+
@Override
210+
public boolean shouldRetry(
211+
RetryingContext context, Throwable previousThrowable, CheckConsistencyResponse prevResponse)
212+
throws CancellationException {
213+
return prevResponse != null && !prevResponse.getConsistent();
214+
}
215+
198216
@Override
199217
public boolean shouldRetry(Throwable prevThrowable, CheckConsistencyResponse prevResponse)
200218
throws CancellationException {

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/AwaitReplicationCallable.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
* <p>This callable wraps GenerateConsistencyToken and CheckConsistency RPCs. It will generate a
2929
* token then poll until isConsistent is true.
3030
*/
31-
/** @deprecated Please use {@link AwaitConsistencyCallable instead. */
31+
/**
32+
* @deprecated Please use {@link AwaitConsistencyCallable} instead.
33+
*/
3234
@Deprecated
3335
class AwaitReplicationCallable extends UnaryCallable<TableName, Void> {
3436
private final AwaitConsistencyCallable awaitConsistencyCallable;

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/EnhancedBigtableTableAdminStub.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public class EnhancedBigtableTableAdminStub extends GrpcBigtableTableAdminStub {
5656

5757
private final TableAdminRequestContext requestContext;
5858

59-
private final AwaitReplicationCallable awaitReplicationCallable;
59+
@Deprecated private final AwaitReplicationCallable awaitReplicationCallable;
6060

6161
private final AwaitConsistencyCallable awaitConsistencyCallable;
6262
private final OperationCallable<Void, Empty, OptimizeRestoredTableMetadata>
@@ -85,6 +85,7 @@ private EnhancedBigtableTableAdminStub(
8585
createOptimizeRestoredTableOperationBaseCallable();
8686
}
8787

88+
@Deprecated
8889
private AwaitReplicationCallable createAwaitReplicationCallable() {
8990
return AwaitReplicationCallable.create(awaitConsistencyCallable);
9091
}
@@ -207,6 +208,7 @@ public Empty apply(OperationSnapshot input) {
207208
unusedInitialCallSettings, operationCallSettings, clientContext, getOperationsStub());
208209
}
209210

211+
@Deprecated
210212
public UnaryCallable<TableName, Void> awaitReplicationCallable() {
211213
return awaitReplicationCallable;
212214
}

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/common/Type.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ public SqlType<?> getType(java.lang.String fieldName) {
306306
}
307307

308308
@Override
309+
@SuppressWarnings("EqualsGetClass")
309310
public boolean equals(Object obj) {
310311
if (this == obj) {
311312
return true;
@@ -457,12 +458,12 @@ public Code getCode() {
457458
}
458459

459460
@Override
460-
public java.lang.String toString() {
461+
public final java.lang.String toString() {
461462
return getCode().name() + "{enum=" + getEnumName() + "}";
462463
}
463464

464465
@Override
465-
public boolean equals(Object o) {
466+
public final boolean equals(Object o) {
466467
if (this == o) {
467468
return true;
468469
}
@@ -486,7 +487,7 @@ public boolean equals(Object o) {
486487
}
487488

488489
@Override
489-
public int hashCode() {
490+
public final int hashCode() {
490491
T thisEnum = getForNumber().apply(0);
491492
if (thisEnum == null) {
492493
return getForNumber().hashCode();
@@ -561,6 +562,7 @@ public static SchemalessEnum create(
561562
return new AutoValue_Type_SchemalessEnum(enumName, schemaBundleId);
562563
}
563564

565+
@Override
564566
public abstract java.lang.String getEnumName();
565567

566568
public abstract java.lang.String schemaBundleId();

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClient.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2697,8 +2697,8 @@ public void readChangeStreamAsync(
26972697
* Executes a SQL Query and returns a ResultSet to iterate over the results. The returned
26982698
* ResultSet instance is not threadsafe, it can only be used from single thread.
26992699
*
2700-
* <p> The {@link BoundStatement} must be built from a {@link PreparedStatement} created using
2701-
* the same instance and app profile.
2700+
* <p>The {@link BoundStatement} must be built from a {@link PreparedStatement} created using the
2701+
* same instance and app profile.
27022702
*
27032703
* <p>Sample code:
27042704
*
@@ -2719,9 +2719,11 @@ public void readChangeStreamAsync(
27192719
* } catch (RuntimeException e) {
27202720
* e.printStackTrace();
27212721
* }
2722+
* }
27222723
* }</pre>
27232724
*
2724-
* @see {@link PreparedStatement} & {@link BoundStatement} for query options.
2725+
* @see PreparedStatement for query options.
2726+
* @see BoundStatement for query options.
27252727
*/
27262728
public ResultSet executeQuery(BoundStatement boundStatement) {
27272729
boundStatement.assertUsingSameStub(stub);

0 commit comments

Comments
 (0)