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
Binary file modified ci/abi-dumps/google_cloud_cpp_bigtable.expected.abi.dump.gz
Binary file not shown.
116 changes: 116 additions & 0 deletions doc/v3-migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,122 @@ internal legacy files.

</details>

<details>
<summary>Removed <code>bigtable::AdminClient</code> and <code>bigtable::TableAdmin</code></summary>

The `bigtable::AdminClient` class and `bigtable::TableAdmin` class have been
replaced with `bigtable_admin::BigtableTableAdminClient`.

**Before:**

```cpp

std::shared_ptr<bigtable::AdminClient> admin_client =
bigtable::MakeAdminClient("project-id");
auto table_admin = std::make_unique<bigtable::TableAdmin>(
admin_client, "instance-id");

// Drop a selection of rows by key prefix.
auto result = table_admin.DropRowByPrefix("table-id", "row-key-prefix");

// Drop all rows.
result = table_admin.DropAllRows("table-id");
```

**After:**

```cpp
#include "google/cloud/bigtable/admin/bigtable_table_admin_client.h"

auto table_admin = bigtable_admin::BigtableTableAdminClient(
bigtable_admin::MakeBigtableAdminConnection());
auto table_name = bigtable::TableName("project-id", "instance-id", "table-id");

// Drop a selection of rows by key prefix.
google::bigtable::admin::v2::DropRowRangeRequest drop_rows_by_prefix;
drop_rows_by_prefix.set_name(table_name);
drop_rows_by_prefix.set_row_key_prefix("row-key-prefix");
auto result = table_admin.DropRowRange(drop_rows_by_prefix);

// Drop all rows.
google::bigtable::admin::v2::DropRowRangeRequest drop_all_rows;
drop_all_rows.set_name(table_name);
drop_all_rows.set_delete_all_data_from_table(true);
result = table_admin.DropRowRange(drop_all_rows);
```

</details>

<details><summary><code>WaitForConsistency</code> is now a free function</summary>

With the removal of the `bigtable::TableAdmin` class, `WaitForConsistency` has
been moved to `bigtable_admin::BigtableTableAdminClient::WaitForConsistency`.

**Before:**

```cpp

std::shared_ptr<bigtable::AdminClient> admin_client =
bigtable::MakeAdminClient("project-id");
auto table_admin = std::make_unique<bigtable::TableAdmin>(
admin_client, "instance-id");

auto token = table_admin.GenerateConsistencyToken("table-id");
if (!token) throw std::runtime_error(token.status().message());
auto result = table_admin.WaitForConsistency("table-id", *token);
```

**After:**

```cpp
#include "google/cloud/bigtable/admin/bigtable_table_admin_client.h"

auto connection = bigtable_admin::MakeBigtableAdminConnection();
auto table_admin = bigtable_admin::BigtableTableAdminClient(connection);
auto table_name = bigtable::TableName("project-id", "instance-id", "table-id");

auto token = table_admin.GenerateConsistencyToken(table_name);
if (!token) throw std::runtime_error(token.status().message());

google::bigtable::admin::v2::CheckConsistencyRequest wait_request;
wait_request.set_name(table_name);
wait_request.set_consistency_token(token->consistency_token());
auto wait_response = table_admin.WaitForConsistency(wait_request).get();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The example for WaitForConsistency is a bit too brief. It retrieves the StatusOr from the future but doesn't demonstrate how to handle potential errors or use the result. Providing a more complete example would be beneficial for users migrating their code.

Suggested change
auto wait_response = table_admin.WaitForConsistency(wait_request).get();
auto wait_future = table_admin.WaitForConsistency(wait_request);
auto wait_response = wait_future.get();
if (!wait_response) throw std::runtime_error(wait_response.status().message());
// The table is now consistent.

```

</details>

<details>
<summary>Removed <code>bigtable::InstanceAdminClient</code> and <code>bigtable::InstanceAdmin</code></summary>

The `bigtable::InstanceAdminClient` class and `bigtable::InstanceAdmin` class
have been replaced with `bigtable_admin::BigtableInstanceAdminClient`.

**Before:**

```cpp
auto instance_admin_client = bigtable::MakeInstanceAdminClient("project-id");
auto instance_admin =
std::make_unique<bigtable::InstanceAdmin>(instance_admin_client);

auto clusters = instance_admin->ListClusters();
```

**After:**

```cpp
#include "google/cloud/bigtable/admin/bigtable_instance_admin_client.h"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The example uses InstanceName, which is defined in google/cloud/bigtable/resource_names.h. This header should be included to ensure the code snippet is complete and compiles for users who copy it.

Suggested change
#include "google/cloud/bigtable/admin/bigtable_instance_admin_client.h"
#include "google/cloud/bigtable/admin/bigtable_instance_admin_client.h"
#include "google/cloud/bigtable/resource_names.h"


auto instance_admin =
std::make_unique<bigtable_admin::BigtableInstanceAdminClient>(
bigtable_admin::MakeBigtableInstanceAdminConnection());

auto clusters = instance_admin->ListClusters(
InstanceName("project-id", "instance-id"));
Comment on lines +600 to +601

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The example for ListClusters is a bit brief. Since ListClusters returns a StatusOr, it would be more helpful for users to see how to handle the status and iterate over the results.

Suggested change
auto clusters = instance_admin->ListClusters(
InstanceName("project-id", "instance-id"));
auto clusters = instance_admin->ListClusters(
InstanceName("project-id", "instance-id"));
if (!clusters) throw std::runtime_error(clusters.status().message());
for (auto const& c : clusters->clusters()) {
std::cout << c.name() << "\n";
}

```

</details>

### Pubsub

<details>
Expand Down
19 changes: 2 additions & 17 deletions google/cloud/bigtable/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ add_library(
admin/internal/bigtable_table_admin_tracing_connection.h
admin/internal/bigtable_table_admin_tracing_stub.cc
admin/internal/bigtable_table_admin_tracing_stub.h
admin_client.cc
admin_client.h
app_profile_config.cc
app_profile_config.h
bound_query.cc
Expand All @@ -132,10 +130,6 @@ add_library(
iam_policy.h
idempotent_mutation_policy.cc
idempotent_mutation_policy.h
instance_admin.cc
instance_admin.h
instance_admin_client.cc
instance_admin_client.h
instance_config.cc
instance_config.h
instance_list_responses.h
Expand Down Expand Up @@ -260,8 +254,6 @@ add_library(
sql_statement.h
table.cc
table.h
table_admin.cc
table_admin.h
table_config.cc
table_config.h
table_resource.cc
Expand All @@ -272,9 +264,7 @@ add_library(
value.h
version.cc
version.h
version_info.h
wait_for_consistency.cc
wait_for_consistency.h)
version_info.h)
target_link_libraries(
google_cloud_cpp_bigtable
PUBLIC absl::memory
Expand Down Expand Up @@ -425,7 +415,6 @@ if (BUILD_TESTING)
# List the unit tests, then setup the targets and dependencies.
set(bigtable_client_unit_tests
# cmake-format: sort
admin_client_test.cc
app_profile_config_test.cc
async_read_stream_test.cc
bigtable_version_test.cc
Expand All @@ -442,8 +431,6 @@ if (BUILD_TESTING)
iam_binding_test.cc
iam_policy_test.cc
idempotent_mutation_policy_test.cc
instance_admin_client_test.cc
instance_admin_test.cc
instance_config_test.cc
instance_resource_test.cc
instance_update_config_test.cc
Expand Down Expand Up @@ -491,15 +478,13 @@ if (BUILD_TESTING)
rpc_backoff_policy_test.cc
rpc_retry_policy_test.cc
sql_statement_test.cc
table_admin_test.cc
table_config_test.cc
table_resource_test.cc
table_test.cc
testing/cleanup_stale_resources_test.cc
testing/random_names_test.cc
timestamp_test.cc
value_test.cc
wait_for_consistency_test.cc)
value_test.cc)

# Export the list of unit tests so the Bazel BUILD file can pick it up.
export_list_to_bazel("bigtable_client_unit_tests.bzl"
Expand Down
34 changes: 0 additions & 34 deletions google/cloud/bigtable/admin_client.cc

This file was deleted.

73 changes: 0 additions & 73 deletions google/cloud/bigtable/admin_client.h

This file was deleted.

34 changes: 0 additions & 34 deletions google/cloud/bigtable/admin_client_test.cc

This file was deleted.

5 changes: 0 additions & 5 deletions google/cloud/bigtable/bigtable_client_unit_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"""Automatically generated unit tests list - DO NOT EDIT."""

bigtable_client_unit_tests = [
"admin_client_test.cc",
"app_profile_config_test.cc",
"async_read_stream_test.cc",
"bigtable_version_test.cc",
Expand All @@ -34,8 +33,6 @@ bigtable_client_unit_tests = [
"iam_binding_test.cc",
"iam_policy_test.cc",
"idempotent_mutation_policy_test.cc",
"instance_admin_client_test.cc",
"instance_admin_test.cc",
"instance_config_test.cc",
"instance_resource_test.cc",
"instance_update_config_test.cc",
Expand Down Expand Up @@ -83,13 +80,11 @@ bigtable_client_unit_tests = [
"rpc_backoff_policy_test.cc",
"rpc_retry_policy_test.cc",
"sql_statement_test.cc",
"table_admin_test.cc",
"table_config_test.cc",
"table_resource_test.cc",
"table_test.cc",
"testing/cleanup_stale_resources_test.cc",
"testing/random_names_test.cc",
"timestamp_test.cc",
"value_test.cc",
"wait_for_consistency_test.cc",
]
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ source module /google/cloud/bigtable/tools/run_emulator_utils.sh
production_only_targets=(
"//google/cloud/bigtable/examples:bigtable_table_admin_backup_snippets"
"//google/cloud/bigtable/examples:table_admin_iam_policy_snippets"
"//google/cloud/bigtable/tests:admin_backup_integration_test"
"//google/cloud/bigtable/tests:admin_iam_policy_integration_test"
"//google/cloud/bigtable/tests:table_admin_backup_integration_test"
"//google/cloud/bigtable/tests:table_admin_iam_policy_integration_test"
)

# Coverage builds are more subject to flakiness, as we must explicitly disable
Expand Down
2 changes: 0 additions & 2 deletions google/cloud/bigtable/examples/table_admin_snippets.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@

#include "google/cloud/bigtable/admin/bigtable_table_admin_client.h"
#include "google/cloud/bigtable/examples/bigtable_examples_common.h"
#include "google/cloud/bigtable/table_admin.h"
#include "google/cloud/bigtable/testing/cleanup_stale_resources.h"
#include "google/cloud/bigtable/testing/random_names.h"
#include "google/cloud/bigtable/wait_for_consistency.h"
#include "google/cloud/internal/getenv.h"
#include "google/cloud/log.h"
#include <chrono>
Expand Down
Loading
Loading