Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup(bigtable)!: remove async functions that take CompletionQueue as a param #6921

Merged
merged 1 commit into from
Jul 1, 2021
Merged
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
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,19 @@

## v1.30.0 - TBD

### Bigtable:

**BREAKING CHANGES**:
* `Async*` functions in `Table` that took `CompletionQueue&` as a parameter
have been removed. Users that need to update their code should use the
identically named functions which do not require a `CompletionQueue&`. If
users absolutely require a custom `CompletionQueue`, one can be supplied to
the `DataClient` used to construct the `Table`, via
`ClientOptions::DisableBackgroundThreads(CompletionQueue const&)`.
Copy link
Member Author

Choose a reason for hiding this comment

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

  1. Is this even worth saying?
  2. The change to prefer Options > ClientOptions will be done in this release. I am making a mental note to come back and update CHANGELOG.md accordingly

Copy link
Contributor

Choose a reason for hiding this comment

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

In general, I think "You cannot use Foo() anymore, use Bar() instead" is more friendly/useful than "Foo() was removed."

It is also better to assume that folks have not memorized our reference manual, so they may not be familiar with every option in the library.

With those caveats, pointing folks to the recommended way to do things is the "Right Thing":tm:

Copy link
Contributor

Choose a reason for hiding this comment

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

The change is Okay as-is, we just need to update the CHANGELOG on the PRs where we start recommending Options{} instead.

See [#2567][issue-2567] for more details.

[issue-2567]: https://github.com/googleapis/google-cloud-cpp/issues/2567

## v1.29.0 - 2021-07

### Bigtable:
Expand Down
23 changes: 0 additions & 23 deletions google/cloud/bigtable/table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,6 @@ future<Status> Table::AsyncApplyImpl(SingleRowMutation mut,
});
}

future<Status> Table::AsyncApply(SingleRowMutation mut, CompletionQueue& cq) {
return AsyncApplyImpl(std::move(mut), cq);
}

future<Status> Table::AsyncApply(SingleRowMutation mut) {
auto cq = background_threads_->cq();
return AsyncApplyImpl(std::move(mut), cq);
Expand Down Expand Up @@ -194,11 +190,6 @@ future<std::vector<FailedMutation>> Table::AsyncBulkApplyImpl(
app_profile_id_, table_name(), std::move(mut));
}

future<std::vector<FailedMutation>> Table::AsyncBulkApply(BulkMutation mut,
CompletionQueue& cq) {
return AsyncBulkApplyImpl(std::move(mut), cq);
}

future<std::vector<FailedMutation>> Table::AsyncBulkApply(BulkMutation mut) {
auto cq = background_threads_->cq();
return AsyncBulkApplyImpl(std::move(mut), cq);
Expand Down Expand Up @@ -316,14 +307,6 @@ future<StatusOr<MutationBranch>> Table::AsyncCheckAndMutateRowImpl(
});
}

future<StatusOr<MutationBranch>> Table::AsyncCheckAndMutateRow(
std::string row_key, Filter filter, std::vector<Mutation> true_mutations,
std::vector<Mutation> false_mutations, CompletionQueue& cq) {
return AsyncCheckAndMutateRowImpl(std::move(row_key), std::move(filter),
std::move(true_mutations),
std::move(false_mutations), cq);
}

future<StatusOr<MutationBranch>> Table::AsyncCheckAndMutateRow(
std::string row_key, Filter filter, std::vector<Mutation> true_mutations,
std::vector<Mutation> false_mutations) {
Expand Down Expand Up @@ -490,12 +473,6 @@ future<StatusOr<std::pair<bool, Row>>> Table::AsyncReadRowImpl(
return handler->GetFuture();
}

future<StatusOr<std::pair<bool, Row>>> Table::AsyncReadRow(CompletionQueue& cq,
std::string row_key,
Filter filter) {
return AsyncReadRowImpl(cq, std::move(row_key), std::move(filter));
}

future<StatusOr<std::pair<bool, Row>>> Table::AsyncReadRow(std::string row_key,
Filter filter) {
auto cq = background_threads_->cq();
Expand Down
258 changes: 0 additions & 258 deletions google/cloud/bigtable/table.h
Original file line number Diff line number Diff line change
Expand Up @@ -381,32 +381,6 @@ class Table {
*/
Status Apply(SingleRowMutation mut);

/**
* Makes asynchronous attempts to apply the mutation to a row.
*
* @warning This is an early version of the asynchronous APIs for Cloud
* Bigtable. These APIs might be changed in backward-incompatible ways. It
* is not subject to any SLA or deprecation policy.
*
* @param mut the mutation. Note that this function takes ownership
* (and then discards) the data in the mutation. In general, a
* `SingleRowMutation` can be used to modify and/or delete
* multiple cells, across different columns and column families.
* @param cq the completion queue that will execute the asynchronous
* calls, the application must ensure that one or more threads are
* blocked on `cq.Run()`.
*
* @par Idempotency
* This operation is idempotent if the provided mutations are idempotent. Note
* that `google::cloud::bigtable::SetCell()` without an explicit timestamp is
* **not** an idempotent operation.
*
* @par Example
* @snippet data_async_snippets.cc async-apply
*/
GOOGLE_CLOUD_CPP_BIGTABLE_ASYNC_CQ_PARAM_DEPRECATED
future<Status> AsyncApply(SingleRowMutation mut, CompletionQueue& cq);

/**
* Makes asynchronous attempts to apply the mutation to a row.
*
Expand Down Expand Up @@ -453,39 +427,6 @@ class Table {
*/
std::vector<FailedMutation> BulkApply(BulkMutation mut);

/**
* Makes asynchronous attempts to apply mutations to multiple rows.
*
* @warning This is an early version of the asynchronous APIs for Cloud
* Bigtable. These APIs might be changed in backward-incompatible ways. It
* is not subject to any SLA or deprecation policy.
*
* @param mut the mutations, note that this function takes
* ownership (and then discards) the data in the mutation. In general, a
* `BulkMutation` can modify multiple rows, and the modifications for each
* row can change (or create) multiple cells, across different columns and
* column families.
* @param cq the completion queue that will execute the asynchronous calls,
* the application must ensure that one or more threads are blocked on
* `cq.Run()`.
*
* @par Idempotency
* This operation is idempotent if the provided mutations are idempotent. Note
* that `google::cloud::bigtable::SetCell()` without an explicit timestamp is
* **not** an idempotent operation.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread.
*
* @par Example
* @snippet data_async_snippets.cc bulk async-bulk-apply
*/
GOOGLE_CLOUD_CPP_BIGTABLE_ASYNC_CQ_PARAM_DEPRECATED
future<std::vector<FailedMutation>> AsyncBulkApply(BulkMutation mut,
CompletionQueue& cq);

/**
* Makes asynchronous attempts to apply mutations to multiple rows.
*
Expand Down Expand Up @@ -615,41 +556,6 @@ class Table {
std::string row_key, Filter filter, std::vector<Mutation> true_mutations,
std::vector<Mutation> false_mutations);

/**
* Make an asynchronous request to conditionally mutate a row.
*
* @warning This is an early version of the asynchronous APIs for Cloud
* Bigtable. These APIs might be changed in backward-incompatible ways. It
* is not subject to any SLA or deprecation policy.
*
* @param row_key the row key on which the conditional mutation will be
* performed
* @param filter the condition, depending on which the mutation will be
* performed
* @param true_mutations the mutations which will be performed if @p filter is
* true
* @param false_mutations the mutations which will be performed if @p filter
* is false
* @param cq the completion queue that will execute the asynchronous calls,
* the application must ensure that one or more threads are blocked on
* `cq.Run()`.
*
* @par Idempotency
* This operation is always treated as non-idempotent.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread.
*
* @par Example
* @snippet data_async_snippets.cc async check and mutate
*/
GOOGLE_CLOUD_CPP_BIGTABLE_ASYNC_CQ_PARAM_DEPRECATED
future<StatusOr<MutationBranch>> AsyncCheckAndMutateRow(
std::string row_key, Filter filter, std::vector<Mutation> true_mutations,
std::vector<Mutation> false_mutations, CompletionQueue& cq);

/**
* Make an asynchronous request to conditionally mutate a row.
*
Expand Down Expand Up @@ -773,46 +679,6 @@ class Table {
return ReadModifyWriteRowImpl(std::move(request));
}

/**
* Make an asynchronous request to atomically read and modify a row.
*
* @warning This is an early version of the asynchronous APIs for Cloud
* Bigtable. These APIs might be changed in backward-incompatible ways. It
* is not subject to any SLA or deprecation policy.
*
* @param row_key the row key on which modification will be performed
* @param cq the completion queue that will execute the asynchronous calls,
* the application must ensure that one or more threads are blocked on
* `cq.Run()`.
*
* @param rule to modify the row. Two types of rules are applied here
* AppendValue which will read the existing value and append the
* text provided to the value.
* IncrementAmount which will read the existing uint64 big-endian-int
* and add the value provided.
* Both rules accept the family and column identifier to modify.
* @param rules is the zero or more ReadModifyWriteRules to apply on a row.
* @returns A future, that becomes satisfied when the operation completes,
* at that point the future has the contents of all modified cells.
*
* @par Idempotency
* This operation is always treated as non-idempotent.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work.
*
* @par Example
* @snippet data_async_snippets.cc async read modify write
*/
template <typename... Args>
GOOGLE_CLOUD_CPP_BIGTABLE_ASYNC_CQ_PARAM_DEPRECATED future<StatusOr<Row>>
AsyncReadModifyWriteRow(std::string row_key, CompletionQueue& cq,
bigtable::ReadModifyWriteRule rule, Args&&... rules) {
return AsyncReadModifyWriteRowImpl(std::move(row_key), cq, std::move(rule),
std::forward<Args>(rules)...);
}

/**
* Make an asynchronous request to atomically read and modify a row.
*
Expand Down Expand Up @@ -851,47 +717,6 @@ class Table {
std::forward<Args>(rules)...);
}

/**
* Asynchronously reads a set of rows from the table.
*
* @warning This is an early version of the asynchronous APIs for Cloud
* Bigtable. These APIs might be changed in backward-incompatible ways. It
* is not subject to any SLA or deprecation policy.
*
* @param cq the completion queue that will execute the asynchronous calls,
* the application must ensure that one or more threads are blocked on
* `cq.Run()`.
* @param on_row the callback to be invoked on each successfully read row; it
* should be invocable with `Row` and return a future<bool>; the returned
* `future<bool>` should be satisfied with `true` when the user is ready
* to receive the next callback and with `false` when the user doesn't
* want any more rows; if `on_row` throws, the results are undefined
* @param on_finish the callback to be invoked when the stream is closed; it
* should be invocable with `Status` and not return anything; it will
* always be called as the last callback; if `on_finish` throws, the
* results are undefined
* @param row_set the rows to read from.
* @param filter is applied on the server-side to data in the rows.
*
* @tparam RowFunctor the type of the @p on_row callback.
* @tparam FinishFunctor the type of the @p on_finish callback.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread.
*
* @par Example
* @snippet data_async_snippets.cc async read rows
*/
template <typename RowFunctor, typename FinishFunctor>
GOOGLE_CLOUD_CPP_BIGTABLE_ASYNC_CQ_PARAM_DEPRECATED void AsyncReadRows(
CompletionQueue& cq, RowFunctor on_row, FinishFunctor on_finish,
RowSet row_set, Filter filter) {
return AsyncReadRowsImpl(cq, std::move(on_row), std::move(on_finish),
std::move(row_set), std::move(filter));
}

/**
* Asynchronously reads a set of rows from the table.
*
Expand Down Expand Up @@ -930,52 +755,6 @@ class Table {
std::move(row_set), std::move(filter));
}

/**
* Asynchronously reads a set of rows from the table.
*
* @warning This is an early version of the asynchronous APIs for Cloud
* Bigtable. These APIs might be changed in backward-incompatible ways. It
* is not subject to any SLA or deprecation policy.
*
* @param cq the completion queue that will execute the asynchronous calls,
* the application must ensure that one or more threads are blocked on
* `cq.Run()`.
* @param on_row the callback to be invoked on each successfully read row; it
* should be invocable with `Row` and return a future<bool>; the returned
* `future<bool>` should be satisfied with `true` when the user is ready
* to receive the next callback and with `false` when the user doesn't
* want any more rows; if `on_row` throws, the results are undefined
* @param on_finish the callback to be invoked when the stream is closed; it
* should be invocable with `Status` and not return anything; it will
* always be called as the last callback; if `on_finish` throws, the
* results are undefined
* @param row_set the rows to read from.
* @param rows_limit the maximum number of rows to read. Cannot be a negative
* number or zero. Use `AsyncReadRows(CompletionQueue, RowSet, Filter)` to
* read all matching rows.
* @param filter is applied on the server-side to data in the rows.
*
* @tparam RowFunctor the type of the @p on_row callback.
* @tparam FinishFunctor the type of the @p on_finish callback.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread. The callbacks passed to this
* function may be executed on any thread running the provided completion
* queue.
*
* @par Example
* @snippet data_async_snippets.cc async read rows with limit
*/
template <typename RowFunctor, typename FinishFunctor>
GOOGLE_CLOUD_CPP_BIGTABLE_ASYNC_CQ_PARAM_DEPRECATED void AsyncReadRows(
CompletionQueue& cq, RowFunctor on_row, FinishFunctor on_finish,
RowSet row_set, std::int64_t rows_limit, Filter filter) {
AsyncReadRowsImpl(cq, std::move(on_row), std::move(on_finish),
std::move(row_set), rows_limit, std::move(filter));
}

/**
* Asynchronously reads a set of rows from the table.
*
Expand Down Expand Up @@ -1019,43 +798,6 @@ class Table {
std::move(row_set), rows_limit, std::move(filter));
}

/**
* Asynchronously read and return a single row from the table.
*
* @warning This is an early version of the asynchronous APIs for Cloud
* Bigtable. These APIs might be changed in backward-incompatible ways. It
* is not subject to any SLA or deprecation policy.
*
* @param cq the completion queue that will execute the asynchronous calls,
* the application must ensure that one or more threads are blocked on
* `cq.Run()`.
* @param row_key the row to read.
* @param filter a filter expression, can be used to select a subset of the
* column families and columns in the row.
* @returns a future satisfied when the operation completes, fails
* permanently or keeps failing transiently, but the retry policy has been
* exhausted. The future will return a tuple. The first element is a
* boolean, with value `false` if the row does not exist. If the first
* element is `true` the second element has the contents of the Row. Note
* that the contents may be empty if the filter expression removes all
* column families and columns.
*
* @par Idempotency
* This is a read-only operation and therefore it is always idempotent.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread.
*
* @par Example
* @snippet data_async_snippets.cc async read row
*/
GOOGLE_CLOUD_CPP_BIGTABLE_ASYNC_CQ_PARAM_DEPRECATED
future<StatusOr<std::pair<bool, Row>>> AsyncReadRow(CompletionQueue& cq,
std::string row_key,
Filter filter);

/**
* Asynchronously read and return a single row from the table.
*
Expand Down
6 changes: 0 additions & 6 deletions google/cloud/bigtable/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@
" instead. The function will be removed on 2022-04-01 or shortly " \
"after. See GitHub issue #5929 for more information.")

#define GOOGLE_CLOUD_CPP_BIGTABLE_ASYNC_CQ_PARAM_DEPRECATED \
GOOGLE_CLOUD_CPP_DEPRECATED( \
"this experimental function will be removed on or shortly after " \
"2021-07-01. See GitHub issue #2567 for more information. Please use " \
"an overload without the cq parameter.")

#define BIGTABLE_CLIENT_NS \
GOOGLE_CLOUD_CPP_VEVAL(BIGTABLE_CLIENT_VERSION_MAJOR, \
BIGTABLE_CLIENT_VERSION_MINOR)
Expand Down