-
Notifications
You must be signed in to change notification settings - Fork 382
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
feat(bigtable): cheap Table creation with different resource name #8172
Conversation
Google Cloud Build Logs
ℹ️ NOTE: Kokoro logs are linked from "Details" below. |
Codecov Report
@@ Coverage Diff @@
## main #8172 +/- ##
=======================================
Coverage 94.61% 94.61%
=======================================
Files 1323 1323
Lines 118191 118256 +65
=======================================
+ Hits 111821 111884 +63
- Misses 6370 6372 +2
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It strikes me as odd that I can change the project and instance ids, but not the table id? That seems like a fairly uncommon use-case?
google/cloud/bigtable/table.h
Outdated
std::string const& table_id() const { return table_id_; } | ||
|
||
/// Override the project id | ||
void set_project_id(std::string project_id) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An alternative would be:
Table WithNewTarget(std::string instance_id, std::string project_id, std::string table_id) const {
auto table = *this;
table.instance_id_ = std::move(instance_id);
table.project_id_ = std::move(project_id);
table.table_id_ = std::move(table_id);
return table;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. Thanks for the idea.
Google Cloud Build Logs
ℹ️ NOTE: Kokoro logs are linked from "Details" below. |
Google Cloud Build Logs
ℹ️ NOTE: Kokoro logs are linked from "Details" below. |
Google Cloud Build Logs
ℹ️ NOTE: Kokoro logs are linked from "Details" below. |
Related to #5934
We have customers that use our
Table
clients to interact with tables spread across various instances and projects. Because the project and instance ids are stored in theDataClient
, the customer is forced to create multiple connections, which is redundant and slow. While this issue will be addressed as part of the effort to modernize the Data API, that will take time. This PR doesn't hurt, and it adds value now.This PR stores the project and instance ids in the
Table
. Customers can now produce a copy of aTable
with a modified resource name, without needing to make a new connection to the service.I think the PR is in line with our thread safety guarantees, but the reviewer should check this.
google-cloud-cpp/google/cloud/bigtable/table.h
Lines 86 to 90 in 9e5ac67
Should there be another version of this method that sets the app profile id as well?
This change is