Skip to content

Commit e08fb0e

Browse files
committed
Merge branch 'main' into PR #2663 to update
2 parents 7c7892c + 77952d2 commit e08fb0e

26 files changed

Lines changed: 1108 additions & 153 deletions

File tree

.github/scripts/update_generation_config.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,14 @@ function update_config() {
4848
}
4949

5050
# Update an action to a new version in GitHub action.
51+
# the second argument must have the git tag (including "v").
5152
function update_action() {
5253
local key_word=$1
5354
local new_value=$2
5455
local file=$3
5556
echo "Update ${key_word} to ${new_value} in ${file}"
5657
# use a different delimiter because the key_word contains "/".
57-
sed -i -e "s|${key_word}@v.*$|${key_word}@v${new_value}|" "${file}"
58+
sed -i -e "s|${key_word}@[^ ]*$|${key_word}@${new_value}|" "${file}"
5859
}
5960

6061
# The parameters of this script is:
@@ -143,12 +144,16 @@ rm -rf tmp-googleapis
143144
update_config "googleapis_commitish" "${latest_commit}" "${generation_config}"
144145

145146
# Update gapic-generator-java version to the latest
146-
latest_version=$(get_latest_released_version "com.google.api" "gapic-generator-java")
147-
update_config "gapic_generator_version" "${latest_version}" "${generation_config}"
148-
149-
# Update composite action version to latest gapic-generator-java version
147+
latest_gapic_generator_version=$(get_latest_released_version "com.google.api" "gapic-generator-java")
148+
update_config "gapic_generator_version" "${latest_gapic_generator_version}" "${generation_config}"
149+
150+
# Update the GitHub Actions reference to the latest.
151+
# After the google-cloud-java monorepo migration of sdk-platform-java,
152+
# we cannot rely on the gapic-generator-java version tag. Let's use
153+
# the gapic-libraries-bom version
154+
latest_gapic_libraries_bom_version=$(get_latest_released_version "com.google.cloud" "gapic-libraries-bom")
150155
update_action "googleapis/google-cloud-java/sdk-platform-java/.github/scripts" \
151-
"${latest_version}" \
156+
"v${latest_gapic_libraries_bom_version}" \
152157
"${workflow}"
153158

154159
# Update libraries-bom version to the latest

.github/workflows/renovate_config_check.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
pull_request:
55
paths:
66
- 'renovate.json'
7+
- '.github/workflows/renovate_config_check.yaml'
78

89
jobs:
910
renovate_bot_config_validation:
@@ -18,8 +19,6 @@ jobs:
1819
with:
1920
node-version: '22'
2021

21-
- name: Install Renovate and Config Validator
22+
- name: Run Renovate Config Validator
2223
run: |
23-
npm install -g npm@latest
24-
npm install --global renovate
25-
renovate-config-validator
24+
npx --package renovate@43.136.0 renovate-config-validator

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ If you are using Maven without the BOM, add this to your dependencies:
4949
If you are using Gradle 5.x or later, add this to your dependencies:
5050

5151
```Groovy
52-
implementation platform('com.google.cloud:libraries-bom:26.79.0')
52+
implementation platform('com.google.cloud:libraries-bom:26.80.0')
5353
5454
implementation 'com.google.cloud:google-cloud-bigtable'
5555
```

generation_config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
gapic_generator_version: 2.69.0
2-
googleapis_commitish: 9a832ccde3f3ca4d4e1c39593b1cbf9aa62a75b3
3-
libraries_bom_version: 26.79.0
1+
gapic_generator_version: 2.71.0
2+
googleapis_commitish: 939ba3bf8408af83f0f73ae35c76c4b11a8c8c8d
3+
libraries_bom_version: 26.80.0
44
template_excludes:
55
- .gitignore
66
- .kokoro/presubmit/integration.cfg

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,7 @@ public class BaseBigtableInstanceAdminClient implements BackgroundResource {
777777
private final OperationsClient operationsClient;
778778

779779
/** Constructs an instance of BaseBigtableInstanceAdminClient with default settings. */
780-
public static final BaseBigtableInstanceAdminClient create() throws IOException {
780+
protected static BaseBigtableInstanceAdminClient create() throws IOException {
781781
return create(BaseBigtableInstanceAdminSettings.newBuilder().build());
782782
}
783783

@@ -786,7 +786,7 @@ public static final BaseBigtableInstanceAdminClient create() throws IOException
786786
* channels are created based on the settings passed in, or defaults for any settings that are not
787787
* set.
788788
*/
789-
public static final BaseBigtableInstanceAdminClient create(
789+
protected static BaseBigtableInstanceAdminClient create(
790790
BaseBigtableInstanceAdminSettings settings) throws IOException {
791791
return new BaseBigtableInstanceAdminClient(settings);
792792
}
@@ -795,7 +795,7 @@ public static final BaseBigtableInstanceAdminClient create(
795795
* Constructs an instance of BaseBigtableInstanceAdminClient, using the given stub for making
796796
* calls. This is for advanced usage - prefer using create(BaseBigtableInstanceAdminSettings).
797797
*/
798-
public static final BaseBigtableInstanceAdminClient create(BigtableInstanceAdminStub stub) {
798+
protected static BaseBigtableInstanceAdminClient create(BigtableInstanceAdminStub stub) {
799799
return new BaseBigtableInstanceAdminClient(stub);
800800
}
801801

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -870,15 +870,15 @@ public class BaseBigtableTableAdminClient implements BackgroundResource {
870870
private final OperationsClient operationsClient;
871871

872872
/** Constructs an instance of BaseBigtableTableAdminClient with default settings. */
873-
public static final BaseBigtableTableAdminClient create() throws IOException {
873+
protected static BaseBigtableTableAdminClient create() throws IOException {
874874
return create(BaseBigtableTableAdminSettings.newBuilder().build());
875875
}
876876

877877
/**
878878
* Constructs an instance of BaseBigtableTableAdminClient, using the given settings. The channels
879879
* are created based on the settings passed in, or defaults for any settings that are not set.
880880
*/
881-
public static final BaseBigtableTableAdminClient create(BaseBigtableTableAdminSettings settings)
881+
protected static BaseBigtableTableAdminClient create(BaseBigtableTableAdminSettings settings)
882882
throws IOException {
883883
return new BaseBigtableTableAdminClient(settings);
884884
}
@@ -887,7 +887,7 @@ public static final BaseBigtableTableAdminClient create(BaseBigtableTableAdminSe
887887
* Constructs an instance of BaseBigtableTableAdminClient, using the given stub for making calls.
888888
* This is for advanced usage - prefer using create(BaseBigtableTableAdminSettings).
889889
*/
890-
public static final BaseBigtableTableAdminClient create(BigtableTableAdminStub stub) {
890+
protected static BaseBigtableTableAdminClient create(BigtableTableAdminStub stub) {
891891
return new BaseBigtableTableAdminClient(stub);
892892
}
893893

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

Lines changed: 83 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ public abstract class ConsistencyRequest {
4343
@Nullable
4444
public abstract String getConsistencyToken();
4545

46+
protected abstract boolean isFullyQualified();
47+
4648
public static ConsistencyRequest forReplication(String tableId) {
4749
return new AutoValue_ConsistencyRequest(
48-
tableId, CheckConsistencyRequest.ModeCase.STANDARD_READ_REMOTE_WRITES, null);
50+
tableId, CheckConsistencyRequest.ModeCase.STANDARD_READ_REMOTE_WRITES, null, false);
4951
}
5052

5153
/**
@@ -59,37 +61,110 @@ public static ConsistencyRequest forReplication(String tableId, String consisten
5961
Preconditions.checkNotNull(consistencyToken, "consistencyToken must not be null");
6062

6163
return new AutoValue_ConsistencyRequest(
62-
tableId, CheckConsistencyRequest.ModeCase.STANDARD_READ_REMOTE_WRITES, consistencyToken);
64+
tableId,
65+
CheckConsistencyRequest.ModeCase.STANDARD_READ_REMOTE_WRITES,
66+
consistencyToken,
67+
false);
6368
}
6469

6570
public static ConsistencyRequest forDataBoost(String tableId) {
6671
return new AutoValue_ConsistencyRequest(
67-
tableId, CheckConsistencyRequest.ModeCase.DATA_BOOST_READ_LOCAL_WRITES, null);
72+
tableId, CheckConsistencyRequest.ModeCase.DATA_BOOST_READ_LOCAL_WRITES, null, false);
6873
}
6974

7075
@InternalApi
71-
public CheckConsistencyRequest toCheckConsistencyProto(
72-
TableAdminRequestContext requestContext, String token) {
76+
public static ConsistencyRequest forReplicationFromTableName(String tableName) {
77+
Preconditions.checkArgument(
78+
TableName.isParsableFrom(tableName), "tableName must be a fully qualified table name");
79+
return new AutoValue_ConsistencyRequest(
80+
tableName, CheckConsistencyRequest.ModeCase.STANDARD_READ_REMOTE_WRITES, null, true);
81+
}
82+
83+
@InternalApi
84+
public static ConsistencyRequest forReplicationFromTableName(
85+
String tableName, String consistencyToken) {
86+
Preconditions.checkArgument(
87+
TableName.isParsableFrom(tableName), "tableName must be a fully qualified table name");
88+
Preconditions.checkNotNull(consistencyToken, "consistencyToken must not be null");
89+
90+
return new AutoValue_ConsistencyRequest(
91+
tableName,
92+
CheckConsistencyRequest.ModeCase.STANDARD_READ_REMOTE_WRITES,
93+
consistencyToken,
94+
true);
95+
}
96+
97+
private CheckConsistencyRequest.Builder buildBaseRequest(String name, String token) {
7398
CheckConsistencyRequest.Builder builder = CheckConsistencyRequest.newBuilder();
74-
TableName tableName =
75-
TableName.of(requestContext.getProjectId(), requestContext.getInstanceId(), getTableId());
7699

77100
if (getMode().equals(CheckConsistencyRequest.ModeCase.STANDARD_READ_REMOTE_WRITES)) {
78101
builder.setStandardReadRemoteWrites(StandardReadRemoteWrites.newBuilder().build());
79102
} else {
80103
builder.setDataBoostReadLocalWrites(DataBoostReadLocalWrites.newBuilder().build());
81104
}
82105

83-
return builder.setName(tableName.toString()).setConsistencyToken(token).build();
106+
return builder.setName(name).setConsistencyToken(token);
107+
}
108+
109+
/**
110+
* Creates a CheckConsistencyRequest proto. This variant is used when the ConsistencyRequest was
111+
* initialized with a short table ID, relying on the TableAdminRequestContext to construct the
112+
* fully qualified table name.
113+
*/
114+
@InternalApi
115+
public CheckConsistencyRequest toCheckConsistencyProto(
116+
TableAdminRequestContext requestContext, String token) {
117+
Preconditions.checkState(
118+
!isFullyQualified(),
119+
"Use toCheckConsistencyProto(String token) for fully qualified table names.");
120+
TableName tableName =
121+
TableName.of(requestContext.getProjectId(), requestContext.getInstanceId(), getTableId());
122+
123+
return buildBaseRequest(tableName.toString(), token).build();
84124
}
85125

126+
/**
127+
* Creates a CheckConsistencyRequest proto. This variant is used when the ConsistencyRequest was
128+
* initialized with a fully qualified table name, eliminating the need for a request context.
129+
*/
130+
@InternalApi
131+
public CheckConsistencyRequest toCheckConsistencyProto(String token) {
132+
Preconditions.checkState(
133+
isFullyQualified(),
134+
"Use toCheckConsistencyProto(TableAdminRequestContext, String) for non-qualified table"
135+
+ " names.");
136+
137+
return buildBaseRequest(getTableId(), token).build();
138+
}
139+
140+
/**
141+
* Creates a GenerateConsistencyTokenRequest proto. This variant is used when the
142+
* ConsistencyRequest was initialized with a short table ID, relying on the
143+
* TableAdminRequestContext to construct the fully qualified table name.
144+
*/
86145
@InternalApi
87146
public GenerateConsistencyTokenRequest toGenerateTokenProto(
88147
TableAdminRequestContext requestContext) {
148+
Preconditions.checkState(
149+
!isFullyQualified(), "Use toGenerateTokenProto() for fully qualified table names.");
89150
GenerateConsistencyTokenRequest.Builder builder = GenerateConsistencyTokenRequest.newBuilder();
90151
TableName tableName =
91152
TableName.of(requestContext.getProjectId(), requestContext.getInstanceId(), getTableId());
92153

93154
return builder.setName(tableName.toString()).build();
94155
}
156+
157+
/**
158+
* Creates a GenerateConsistencyTokenRequest proto. This variant is used when the
159+
* ConsistencyRequest was initialized with a fully qualified table name, eliminating the need for
160+
* a request context.
161+
*/
162+
@InternalApi
163+
public GenerateConsistencyTokenRequest toGenerateTokenProto() {
164+
Preconditions.checkState(
165+
isFullyQualified(),
166+
"Use toGenerateTokenProto(TableAdminRequestContext) for non-qualified table names.");
167+
GenerateConsistencyTokenRequest.Builder builder = GenerateConsistencyTokenRequest.newBuilder();
168+
return builder.setName(getTableId()).build();
169+
}
95170
}

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

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import com.google.common.util.concurrent.MoreExecutors;
4343
import java.util.concurrent.Callable;
4444
import java.util.concurrent.CancellationException;
45+
import javax.annotation.Nullable;
4546

4647
/**
4748
* Callable that waits until either replication or Data Boost has caught up to the point it was
@@ -56,15 +57,15 @@ class AwaitConsistencyCallable extends UnaryCallable<ConsistencyRequest, Void> {
5657
private final UnaryCallable<CheckConsistencyRequest, CheckConsistencyResponse> checkCallable;
5758
private final RetryingExecutor<CheckConsistencyResponse> executor;
5859

59-
private final TableAdminRequestContext requestContext;
60+
@Nullable private final TableAdminRequestContext requestContext;
6061

6162
static AwaitConsistencyCallable create(
6263
UnaryCallable<GenerateConsistencyTokenRequest, GenerateConsistencyTokenResponse>
6364
generateCallable,
6465
UnaryCallable<CheckConsistencyRequest, CheckConsistencyResponse> checkCallable,
6566
ClientContext clientContext,
6667
RetrySettings pollingSettings,
67-
TableAdminRequestContext requestContext) {
68+
@Nullable TableAdminRequestContext requestContext) {
6869

6970
RetryAlgorithm<CheckConsistencyResponse> retryAlgorithm =
7071
new RetryAlgorithm<>(
@@ -78,13 +79,22 @@ static AwaitConsistencyCallable create(
7879
generateCallable, checkCallable, retryingExecutor, requestContext);
7980
}
8081

82+
static AwaitConsistencyCallable create(
83+
UnaryCallable<GenerateConsistencyTokenRequest, GenerateConsistencyTokenResponse>
84+
generateCallable,
85+
UnaryCallable<CheckConsistencyRequest, CheckConsistencyResponse> checkCallable,
86+
ClientContext clientContext,
87+
RetrySettings pollingSettings) {
88+
return create(generateCallable, checkCallable, clientContext, pollingSettings, null);
89+
}
90+
8191
@VisibleForTesting
8292
AwaitConsistencyCallable(
8393
UnaryCallable<GenerateConsistencyTokenRequest, GenerateConsistencyTokenResponse>
8494
generateCallable,
8595
UnaryCallable<CheckConsistencyRequest, CheckConsistencyResponse> checkCallable,
8696
RetryingExecutor<CheckConsistencyResponse> executor,
87-
TableAdminRequestContext requestContext) {
97+
@Nullable TableAdminRequestContext requestContext) {
8898
this.generateCallable = generateCallable;
8999
this.checkCallable = checkCallable;
90100
this.executor = executor;
@@ -98,22 +108,30 @@ public ApiFuture<Void> futureCall(
98108
// If the token is already provided, skip generation and poll directly.
99109
if (consistencyRequest.getConsistencyToken() != null) {
100110
CheckConsistencyRequest request =
101-
consistencyRequest.toCheckConsistencyProto(
102-
requestContext, consistencyRequest.getConsistencyToken());
111+
requestContext == null
112+
? consistencyRequest.toCheckConsistencyProto(consistencyRequest.getConsistencyToken())
113+
: consistencyRequest.toCheckConsistencyProto(
114+
requestContext, consistencyRequest.getConsistencyToken());
103115
return pollToken(request, apiCallContext);
104116
}
105117

106118
ApiFuture<GenerateConsistencyTokenResponse> tokenFuture =
107-
generateToken(consistencyRequest.toGenerateTokenProto(requestContext), apiCallContext);
119+
generateToken(
120+
requestContext == null
121+
? consistencyRequest.toGenerateTokenProto()
122+
: consistencyRequest.toGenerateTokenProto(requestContext),
123+
apiCallContext);
108124

109125
return ApiFutures.transformAsync(
110126
tokenFuture,
111127
new ApiAsyncFunction<GenerateConsistencyTokenResponse, Void>() {
112128
@Override
113129
public ApiFuture<Void> apply(GenerateConsistencyTokenResponse input) {
114130
CheckConsistencyRequest request =
115-
consistencyRequest.toCheckConsistencyProto(
116-
requestContext, input.getConsistencyToken());
131+
requestContext == null
132+
? consistencyRequest.toCheckConsistencyProto(input.getConsistencyToken())
133+
: consistencyRequest.toCheckConsistencyProto(
134+
requestContext, input.getConsistencyToken());
117135
return pollToken(request, apiCallContext);
118136
}
119137
},

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

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,38 @@ public class EnhancedBigtableTableAdminStub extends GrpcBigtableTableAdminStub {
5454
private final BigtableTableAdminStubSettings settings;
5555
private final ClientContext clientContext;
5656

57-
private final TableAdminRequestContext requestContext;
57+
@javax.annotation.Nullable private final TableAdminRequestContext requestContext;
5858

5959
@Deprecated private final AwaitReplicationCallable awaitReplicationCallable;
6060

6161
private final AwaitConsistencyCallable awaitConsistencyCallable;
6262
private final OperationCallable<Void, Empty, OptimizeRestoredTableMetadata>
6363
optimizeRestoredTableOperationBaseCallable;
6464

65+
/**
66+
* Creates an instance of {@link EnhancedBigtableTableAdminStub} using the provided settings. This
67+
* variant is used by the V2 client stack which relies on fully qualified table names and
68+
* therefore does not require a {@link TableAdminRequestContext}.
69+
*
70+
* @param settings The settings used to configure the stub.
71+
* @return A new instance of {@code EnhancedBigtableTableAdminStub}.
72+
* @throws IOException If there are errors creating the underlying client context.
73+
*/
74+
public static EnhancedBigtableTableAdminStub createEnhanced(
75+
BigtableTableAdminStubSettings settings) throws IOException {
76+
return new EnhancedBigtableTableAdminStub(settings, ClientContext.create(settings), null);
77+
}
78+
79+
/**
80+
* Creates an instance of {@link EnhancedBigtableTableAdminStub} using the provided settings. This
81+
* variant is used by the legacy client stack which relies on short table IDs and requires a
82+
* {@link TableAdminRequestContext} to construct fully qualified table names.
83+
*
84+
* @param settings The settings used to configure the stub.
85+
* @param requestContext The context used to format short table IDs.
86+
* @return A new instance of {@code EnhancedBigtableTableAdminStub}.
87+
* @throws IOException If there are errors creating the underlying client context.
88+
*/
6589
public static EnhancedBigtableTableAdminStub createEnhanced(
6690
BigtableTableAdminStubSettings settings, TableAdminRequestContext requestContext)
6791
throws IOException {
@@ -72,7 +96,7 @@ public static EnhancedBigtableTableAdminStub createEnhanced(
7296
private EnhancedBigtableTableAdminStub(
7397
BigtableTableAdminStubSettings settings,
7498
ClientContext clientContext,
75-
TableAdminRequestContext requestContext)
99+
@javax.annotation.Nullable TableAdminRequestContext requestContext)
76100
throws IOException {
77101
super(settings, clientContext);
78102

0 commit comments

Comments
 (0)