Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion google-cloud-bigtable/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@
<compilerArgs>
<arg>-XDcompilePolicy=simple</arg>
<arg>--should-stop=ifError=FLOW</arg>
<arg>-Xplugin:ErrorProne -XepDisableWarningsInGeneratedCode -Xep:MissingSummary:OFF -Xep:InlineMeSuggester:OFF -Xep:AutoValueImmutableFields:OFF -Xep:ObjectEqualsForPrimitives:OFF</arg>
<arg>-Xplugin:ErrorProne -XepDisableWarningsInGeneratedCode -Xep:MissingSummary:OFF -Xep:InlineMeSuggester:OFF -Xep:AutoValueImmutableFields:OFF -Xep:ObjectEqualsForPrimitives:OFF -Xep:JavaDurationGetSecondsToToSeconds:OFF</arg>

<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,7 @@ public ApiFuture<Void> dropAllRowsAsync(String tableId) {
* @throws com.google.api.gax.retrying.PollException when polling exceeds the total timeout
*/
@ObsoleteApi("Use getBaseClient() to access the auto-generated proto-based methods instead.")
@Deprecated
public void awaitReplication(String tableId) {
// TODO(igorbernstein2): remove usage of typesafe names
com.google.bigtable.admin.v2.TableName tableName =
Expand Down Expand Up @@ -1667,6 +1668,7 @@ public Backup apply(com.google.bigtable.admin.v2.Backup backupProto) {
*/
@SuppressWarnings("WeakerAccess")
@ObsoleteApi("Use getBaseClient() to access the auto-generated proto-based methods instead.")
@Deprecated
public ApiFuture<Void> awaitReplicationAsync(final String tableId) {
// TODO(igorbernstein2): remove usage of typesafe names
com.google.bigtable.admin.v2.TableName tableName =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public com.google.bigtable.admin.v2.AuthorizedView.SubsetView toProto() {
}

@Override
@SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ static Type fromProto(com.google.bigtable.admin.v2.Type source) {
return Aggregate.fromProto(source.getAggregateType());
case KIND_NOT_SET:
return Raw.create();
default:
throw new UnsupportedOperationException();
}
throw new UnsupportedOperationException();
}

/** The raw type denotes the absence of a type. */
Expand Down Expand Up @@ -204,8 +205,9 @@ static Encoding fromProto(com.google.bigtable.admin.v2.Type.Int64.Encoding sourc
return BigEndianBytes.create();
case ENCODING_NOT_SET:
return BigEndianBytes.create();
default:
throw new UnsupportedOperationException();
}
throw new UnsupportedOperationException();
}

@AutoValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
import com.google.api.core.ApiFutures;
import com.google.api.gax.retrying.ExponentialPollAlgorithm;
import com.google.api.gax.retrying.NonCancellableFuture;
import com.google.api.gax.retrying.ResultRetryAlgorithm;
import com.google.api.gax.retrying.ResultRetryAlgorithmWithContext;
import com.google.api.gax.retrying.RetryAlgorithm;
import com.google.api.gax.retrying.RetrySettings;
import com.google.api.gax.retrying.RetryingContext;
import com.google.api.gax.retrying.RetryingExecutor;
import com.google.api.gax.retrying.RetryingFuture;
import com.google.api.gax.retrying.ScheduledRetryingExecutor;
Expand Down Expand Up @@ -149,7 +150,7 @@ private static class AttemptCallable<RequestT, ResponseT> implements Callable<Re
private final RequestT request;

private volatile RetryingFuture<ResponseT> externalFuture;
private volatile ApiCallContext callContext;
private final ApiCallContext callContext;

AttemptCallable(
UnaryCallable<RequestT, ResponseT> callable, RequestT request, ApiCallContext callContext) {
Expand Down Expand Up @@ -186,7 +187,8 @@ public ResponseT call() {
* handle this.
*/
private static class PollResultAlgorithm
implements ResultRetryAlgorithm<CheckConsistencyResponse> {
implements ResultRetryAlgorithmWithContext<CheckConsistencyResponse> {

@Override
public TimedAttemptSettings createNextAttempt(
Throwable prevThrowable,
Expand All @@ -195,6 +197,22 @@ public TimedAttemptSettings createNextAttempt(
return null;
}

@Override
public TimedAttemptSettings createNextAttempt(
RetryingContext context,
Throwable previousThrowable,
CheckConsistencyResponse previousResponse,
TimedAttemptSettings previousSettings) {
return null;
}

@Override
public boolean shouldRetry(
RetryingContext context, Throwable previousThrowable, CheckConsistencyResponse prevResponse)
throws CancellationException {
return prevResponse != null && !prevResponse.getConsistent();
}

@Override
public boolean shouldRetry(Throwable prevThrowable, CheckConsistencyResponse prevResponse)
throws CancellationException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
* <p>This callable wraps GenerateConsistencyToken and CheckConsistency RPCs. It will generate a
* token then poll until isConsistent is true.
*/
/** @deprecated Please use {@link AwaitConsistencyCallable instead. */
/**
* @deprecated Please use {@link AwaitConsistencyCallable} instead.
*/
@Deprecated
class AwaitReplicationCallable extends UnaryCallable<TableName, Void> {
private final AwaitConsistencyCallable awaitConsistencyCallable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class EnhancedBigtableTableAdminStub extends GrpcBigtableTableAdminStub {

private final TableAdminRequestContext requestContext;

private final AwaitReplicationCallable awaitReplicationCallable;
@Deprecated private final AwaitReplicationCallable awaitReplicationCallable;

private final AwaitConsistencyCallable awaitConsistencyCallable;
private final OperationCallable<Void, Empty, OptimizeRestoredTableMetadata>
Expand Down Expand Up @@ -85,6 +85,7 @@ private EnhancedBigtableTableAdminStub(
createOptimizeRestoredTableOperationBaseCallable();
}

@Deprecated
private AwaitReplicationCallable createAwaitReplicationCallable() {
return AwaitReplicationCallable.create(awaitConsistencyCallable);
}
Expand Down Expand Up @@ -207,6 +208,7 @@ public Empty apply(OperationSnapshot input) {
unusedInitialCallSettings, operationCallSettings, clientContext, getOperationsStub());
}

@Deprecated
public UnaryCallable<TableName, Void> awaitReplicationCallable() {
return awaitReplicationCallable;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ public SqlType<?> getType(java.lang.String fieldName) {
}

@Override
@SuppressWarnings("EqualsGetClass")
public boolean equals(Object obj) {
if (this == obj) {
return true;
Expand Down Expand Up @@ -457,12 +458,12 @@ public Code getCode() {
}

@Override
public java.lang.String toString() {
public final java.lang.String toString() {
return getCode().name() + "{enum=" + getEnumName() + "}";
}

@Override
public boolean equals(Object o) {
public final boolean equals(Object o) {
if (this == o) {
return true;
}
Expand All @@ -486,7 +487,7 @@ public boolean equals(Object o) {
}

@Override
public int hashCode() {
public final int hashCode() {
T thisEnum = getForNumber().apply(0);
if (thisEnum == null) {
return getForNumber().hashCode();
Expand Down Expand Up @@ -561,6 +562,7 @@ public static SchemalessEnum create(
return new AutoValue_Type_SchemalessEnum(enumName, schemaBundleId);
}

@Override
public abstract java.lang.String getEnumName();

public abstract java.lang.String schemaBundleId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2697,8 +2697,8 @@ public void readChangeStreamAsync(
* Executes a SQL Query and returns a ResultSet to iterate over the results. The returned
* ResultSet instance is not threadsafe, it can only be used from single thread.
*
* <p> The {@link BoundStatement} must be built from a {@link PreparedStatement} created using
* the same instance and app profile.
* <p>The {@link BoundStatement} must be built from a {@link PreparedStatement} created using the
* same instance and app profile.
*
* <p>Sample code:
*
Expand All @@ -2719,9 +2719,11 @@ public void readChangeStreamAsync(
* } catch (RuntimeException e) {
* e.printStackTrace();
* }
* }
* }</pre>
*
* @see {@link PreparedStatement} & {@link BoundStatement} for query options.
* @see PreparedStatement for query options.
* @see BoundStatement for query options.
*/
public ResultSet executeQuery(BoundStatement boundStatement) {
boundStatement.assertUsingSameStub(stub);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,65 +119,65 @@ public static Builder newBuilderForEmulator(int port) {
* port number.
*/
public static Builder newBuilderForEmulator(String hostname, int port) {
Builder builder = new Builder();

builder
.stubSettings()
.setCredentialsProvider(NoCredentialsProvider.create())
.setEndpoint(hostname + ":" + port)
// disable channel refreshing when creating an emulator
.setRefreshingChannel(false)
.setMetricsProvider(NoopMetricsProvider.INSTANCE) // disable exporting metrics for emulator
.disableInternalMetrics()
.setTransportChannelProvider(
InstantiatingGrpcChannelProvider.newBuilder()
.setMaxInboundMessageSize(256 * 1024 * 1024)
.setChannelPoolSettings(ChannelPoolSettings.staticallySized(1))
.setChannelConfigurator(ManagedChannelBuilder::usePlaintext)
.setKeepAliveTimeDuration(
java.time.Duration.ofSeconds(61)) // sends ping in this interval
.setKeepAliveTimeoutDuration(
java.time.Duration.ofSeconds(
10)) // wait this long before considering the connection dead
.build());
BigtableDataSettings.Builder builder = new BigtableDataSettings.Builder();

// TODO: remove the suppression once setRefreshingChannel is no longer necessary
@SuppressWarnings({"deprecation", "VariableUnused"})
EnhancedBigtableStubSettings.Builder ignored =
builder
.stubSettings()
.setCredentialsProvider(NoCredentialsProvider.create())
.setEndpoint(hostname + ":" + port)
// disable channel refreshing when creating an emulator
.setRefreshingChannel(false)
.setMetricsProvider(
NoopMetricsProvider.INSTANCE) // disable exporting metrics for emulator
.disableInternalMetrics()
.setTransportChannelProvider(
InstantiatingGrpcChannelProvider.newBuilder()
.setMaxInboundMessageSize(256 * 1024 * 1024)
.setChannelPoolSettings(ChannelPoolSettings.staticallySized(1))
.setChannelConfigurator(ManagedChannelBuilder::usePlaintext)
.setKeepAliveTimeDuration(
java.time.Duration.ofSeconds(61)) // sends ping in this interval
.setKeepAliveTimeoutDuration(
java.time.Duration.ofSeconds(
10)) // wait this long before considering the connection dead
.build());

LOGGER.info("Connecting to the Bigtable emulator at " + hostname + ":" + port);
return builder;
}

/**
* @deprecated OpenCensus support is deprecated and will be removed in a future version
* Enables OpenCensus metric aggregations.
*
* <p>This will register Bigtable client relevant {@link io.opencensus.stats.View}s. When coupled
* with an exporter, it allows users to monitor client behavior.
*
* <p>Please note that in addition to calling this method, the application must:
* <ul>
* <li>Include openensus-impl dependency on the classpath
* <li>Configure an exporter like opencensus-exporter-stats-stackdriver
* </ul>
*
* <p>Example usage for maven:
* <pre>{@code
* <dependency>
* <groupId>io.opencensus</groupId>
* <artifactId>opencensus-impl</artifactId>
* <version>${opencensus.version}</version>
* <scope>runtime</scope>
* </dependency>
*
* <dependency>
* <groupId>io.opencensus</groupId>
* <artifactId>opencensus-exporter-stats-stackdriver</artifactId>
* <version>${opencensus.version}</version>
* </dependency>
* </pre>
* @deprecated OpenCensus support is deprecated and will be removed in a future version Enables
* OpenCensus metric aggregations.
* <p>This will register Bigtable client relevant {@link io.opencensus.stats.View}s. When
* coupled with an exporter, it allows users to monitor client behavior.
* <p>Please note that in addition to calling this method, the application must:
* <ul>
* <li>Include openensus-impl dependency on the classpath
* <li>Configure an exporter like opencensus-exporter-stats-stackdriver
* </ul>
* <p>Example usage for maven:
* <pre>{@code
* <dependency>
* <groupId>io.opencensus</groupId>
* <artifactId>opencensus-impl</artifactId>
* <version>${opencensus.version}</version>
* <scope>runtime</scope>
* </dependency>
*
* Java:
* <pre>{@code
* StackdriverStatsExporter.createAndRegister();
* BigtableDataSettings.enableOpenCensusStats();
* <dependency>
* <groupId>io.opencensus</groupId>
* <artifactId>opencensus-exporter-stats-stackdriver</artifactId>
* <version>${opencensus.version}</version>
* </dependency>
* }</pre>
* Java:
* <pre>{@code
* StackdriverStatsExporter.createAndRegister();
* BigtableDataSettings.enableOpenCensusStats();
* }</pre>
*/
@Deprecated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ public abstract class AbstractProtoStructReader implements StructReader {
abstract List<Value> values();

// Force subclasses to override equals and hashcode. We need this for tests.
@Override
public abstract boolean equals(Object other);

@Override
public abstract int hashCode();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import com.google.api.core.InternalApi;
import com.google.auto.value.AutoValue;
import com.google.cloud.bigtable.data.v2.models.sql.BoundStatement;
import com.google.cloud.bigtable.data.v2.models.sql.BoundStatement.Builder;
import com.google.cloud.bigtable.data.v2.models.sql.PreparedStatement;
import com.google.cloud.bigtable.data.v2.models.sql.SqlType;
import com.google.cloud.bigtable.data.v2.stub.EnhancedBigtableStub;
Expand Down Expand Up @@ -76,7 +75,7 @@ public static PreparedStatement create(

@Override
public BoundStatement.Builder bind() {
return new Builder(this, paramTypes);
return new BoundStatement.Builder(this, paramTypes);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*/
@InternalApi
public final class RegexUtil {
private static final byte[] NULL_BYTES = "\\x00".getBytes();
private static final byte[] NULL_BYTES = {0};

private RegexUtil() {}

Expand Down
Loading
Loading