Skip to content

Commit bc87eda

Browse files
committed
wait consistency wip
1 parent dc126b9 commit bc87eda

8 files changed

Lines changed: 31 additions & 25 deletions

google/cloud/bigtable/admin/bigtable_table_admin_client.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -822,13 +822,13 @@ BigtableTableAdminClient::AsyncCheckConsistency(
822822
}
823823

824824
future<StatusOr<google::bigtable::admin::v2::CheckConsistencyResponse>>
825-
BigtableTableAdminClient::WaitForConsistency(google::bigtable::admin::v2::CheckConsistencyRequest const& request,
826-
Options opts) {
825+
BigtableTableAdminClient::WaitForConsistency(
826+
google::bigtable::admin::v2::CheckConsistencyRequest const& request,
827+
Options opts) {
827828
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
828829
return connection_->WaitForConsistency(request);
829830
}
830831

831-
832832
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
833833
} // namespace bigtable_admin
834834
} // namespace cloud

google/cloud/bigtable/admin/bigtable_table_admin_client.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2581,9 +2581,10 @@ class BigtableTableAdminClient {
25812581
google::bigtable::admin::v2::CheckConsistencyRequest const& request,
25822582
Options opts = {});
25832583

2584-
future<StatusOr<google::bigtable::admin::v2::CheckConsistencyResponse>>
2585-
WaitForConsistency(google::bigtable::admin::v2::CheckConsistencyRequest const& request,
2586-
Options opts = {});
2584+
future<StatusOr<google::bigtable::admin::v2::CheckConsistencyResponse>>
2585+
WaitForConsistency(
2586+
google::bigtable::admin::v2::CheckConsistencyRequest const& request,
2587+
Options opts = {});
25872588

25882589
private:
25892590
std::shared_ptr<BigtableTableAdminConnection> connection_;

google/cloud/bigtable/admin/bigtable_table_admin_connection.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,9 @@ BigtableTableAdminConnection::AsyncCheckConsistency(
383383
}
384384

385385
future<StatusOr<google::bigtable::admin::v2::CheckConsistencyResponse>>
386-
BigtableTableAdminConnection::WaitForConsistency(google::bigtable::admin::v2::CheckConsistencyRequest const& request) {
387-
return google::cloud::make_ready_future<
386+
BigtableTableAdminConnection::WaitForConsistency(
387+
google::bigtable::admin::v2::CheckConsistencyRequest const&) {
388+
return google::cloud::make_ready_future<
388389
StatusOr<google::bigtable::admin::v2::CheckConsistencyResponse>>(
389390
Status(StatusCode::kUnimplemented, "not implemented"));
390391
}

google/cloud/bigtable/admin/bigtable_table_admin_connection.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,10 @@ class BigtableTableAdminConnection {
382382
AsyncCheckConsistency(
383383
google::bigtable::admin::v2::CheckConsistencyRequest const& request);
384384

385-
virtual future<StatusOr<google::bigtable::admin::v2::CheckConsistencyResponse>>
386-
WaitForConsistency(google::bigtable::admin::v2::CheckConsistencyRequest const& request);
385+
virtual future<
386+
StatusOr<google::bigtable::admin::v2::CheckConsistencyResponse>>
387+
WaitForConsistency(
388+
google::bigtable::admin::v2::CheckConsistencyRequest const& request);
387389

388390
protected:
389391
friend StatusOr<CompletionQueue> bigtable_admin_internal::completion_queue(

google/cloud/bigtable/admin/internal/bigtable_table_admin_connection_impl.cc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,18 +1299,17 @@ BigtableTableAdminConnectionImpl::AsyncCheckConsistency(
12991299
}
13001300

13011301
future<StatusOr<google::bigtable::admin::v2::CheckConsistencyResponse>>
1302-
BigtableTableAdminConnectionImpl::WaitForConsistency(
1302+
BigtableTableAdminConnectionImpl::WaitForConsistency(
13031303
google::bigtable::admin::v2::CheckConsistencyRequest const& request) {
1304-
auto current = google::cloud::internal::SaveCurrentOptions();
1304+
auto current = google::cloud::internal::SaveCurrentOptions();
13051305
auto request_copy = request;
13061306
auto const idempotent =
13071307
idempotency_policy(*current)->CheckConsistency(request_copy);
13081308
auto retry = retry_policy(*current);
13091309
auto backoff = backoff_policy(*current);
1310-
auto attempt_predicate = [](
1311-
StatusOr<google::bigtable::admin::v2::CheckConsistencyResponse> const& r) {
1312-
return r.ok() && r->consistent();
1313-
};
1310+
auto attempt_predicate =
1311+
[](StatusOr<google::bigtable::admin::v2::CheckConsistencyResponse> const&
1312+
r) { return r.ok() && r->consistent(); };
13141313
return google::cloud::internal::AsyncRetryLoop(
13151314
std::move(retry), std::move(backoff), idempotent, background_->cq(),
13161315
[stub = stub_](

google/cloud/bigtable/admin/internal/bigtable_table_admin_connection_impl.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,8 @@ class BigtableTableAdminConnectionImpl
235235
override;
236236

237237
future<StatusOr<google::bigtable::admin::v2::CheckConsistencyResponse>>
238-
WaitForConsistency(google::bigtable::admin::v2::CheckConsistencyRequest const& request) override;
238+
WaitForConsistency(google::bigtable::admin::v2::CheckConsistencyRequest const&
239+
request) override;
239240

240241
private:
241242
std::unique_ptr<google::cloud::BackgroundThreads> background_;

google/cloud/bigtable/examples/table_admin_snippets.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -643,8 +643,8 @@ void WaitForConsistencyCheck(
643643
throw std::move(consistency_token).status();
644644
}
645645
auto token = consistency_token->consistency_token();
646-
// auto consistency_future =
647-
// cbta::WaitForConsistency(connection, table_name, token);
646+
// auto consistency_future =
647+
// cbta::WaitForConsistency(connection, table_name, token);
648648

649649
google::bigtable::admin::v2::CheckConsistencyRequest wait_request;
650650
wait_request.set_name(table_name);

google/cloud/bigtable/tests/table_admin_integration_test.cc

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -322,16 +322,18 @@ TEST_F(TableAdminIntegrationTest, WaitForConsistencyCheck) {
322322

323323
// Wait until all the mutations before the `consistency_token` have propagated
324324
// everywhere.
325-
// google::cloud::future<google::cloud::StatusOr<bigtable_admin::Consistency>>
326-
// result = google::cloud::bigtable_admin::WaitForConsistency(
327-
// table_admin_connection, table_created->name(),
328-
// consistency_token->consistency_token());
325+
// google::cloud::future<google::cloud::StatusOr<bigtable_admin::Consistency>>
326+
// result = google::cloud::bigtable_admin::WaitForConsistency(
327+
// table_admin_connection, table_created->name(),
328+
// consistency_token->consistency_token());
329329

330330
google::bigtable::admin::v2::CheckConsistencyRequest wait_request;
331331
wait_request.set_name(table_created->name());
332332
wait_request.set_consistency_token(consistency_token->consistency_token());
333-
future<StatusOr<google::bigtable::admin::v2::CheckConsistencyResponse>> result = table_admin->WaitForConsistency(wait_request);
334-
StatusOr<google::bigtable::admin::v2::CheckConsistencyResponse> is_consistent = result.get();
333+
future<StatusOr<google::bigtable::admin::v2::CheckConsistencyResponse>>
334+
result = table_admin->WaitForConsistency(wait_request);
335+
StatusOr<google::bigtable::admin::v2::CheckConsistencyResponse>
336+
is_consistent = result.get();
335337
ASSERT_STATUS_OK(is_consistent);
336338
EXPECT_TRUE(is_consistent->consistent());
337339

0 commit comments

Comments
 (0)