Skip to content

feat(bigtable): add explicit instance MakeDataConnection#16191

Open
scotthart wants to merge 2 commits into
googleapis:mainfrom
scotthart:bigtable_instance_connections
Open

feat(bigtable): add explicit instance MakeDataConnection#16191
scotthart wants to merge 2 commits into
googleapis:mainfrom
scotthart:bigtable_instance_connections

Conversation

@scotthart

@scotthart scotthart commented Jun 24, 2026

Copy link
Copy Markdown
Member

This pull request introduces a new overload of MakeDataConnection that accepts a vector of InstanceResource objects to encourage explicit instance declaration during client initialization, enabling dynamic channel pooling and channel priming. Instances not initially named can be used, but will incur additionally latency on first use as a dynamic channel pool is created for that instance and priming is skipped in favor of immediately sending the RPC.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new overload of MakeDataConnection that accepts a vector of InstanceResource objects to encourage explicit instance declaration during client initialization, enabling dynamic channel pooling. The previous overload has been deprecated, and examples, benchmarks, and tests have been updated accordingly. The review feedback suggests using std::move on Options objects passed to MakeDataConnection to avoid unnecessary copies, aligning with the repository's style guide.

Comment thread google/cloud/bigtable/examples/client_samples.cc
Comment thread google/cloud/bigtable/examples/client_samples.cc Outdated
Comment thread google/cloud/bigtable/examples/client_samples.cc
Comment thread google/cloud/bigtable/examples/client_samples.cc
Comment thread google/cloud/bigtable/testing/table_integration_test.cc Outdated
@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.62238% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.23%. Comparing base (0a8f509) to head (6db9498).
⚠️ Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
...ogle/cloud/bigtable/tests/data_integration_test.cc 14.28% 24 Missing ⚠️
google/cloud/bigtable/examples/data_snippets.cc 72.72% 6 Missing ⚠️
...loud/bigtable/examples/bigtable_examples_common.cc 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16191      +/-   ##
==========================================
- Coverage   92.24%   92.23%   -0.01%     
==========================================
  Files        2265     2265              
  Lines      210126   210218      +92     
==========================================
+ Hits       193832   193898      +66     
- Misses      16294    16320      +26     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@scotthart scotthart force-pushed the bigtable_instance_connections branch from 2850839 to f2ebcbd Compare June 24, 2026 22:41
@product-auto-label product-auto-label Bot added the api: bigtable Issues related to the Bigtable API. label Jun 25, 2026
@scotthart scotthart force-pushed the bigtable_instance_connections branch from f2ebcbd to 09e636c Compare June 25, 2026 19:43
@scotthart scotthart force-pushed the bigtable_instance_connections branch from 09e636c to f70e8fa Compare June 25, 2026 20:08
@scotthart scotthart force-pushed the bigtable_instance_connections branch from f70e8fa to 6db9498 Compare June 25, 2026 20:42
@scotthart scotthart marked this pull request as ready for review June 26, 2026 15:48
@scotthart scotthart requested a review from a team as a code owner June 26, 2026 15:48
Comment on lines +43 to +44
GCP_LOG(INFO) << "Dynamic connection resolution adding new channel pool "
<< "for instance: " << instance_name;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

unrelated?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is to help alert users of the new overload that they're sending RPCs to an instance that was not named at time of construction. This may be anticipated behavior for some applications, but may prompt other applications to update the instances named when creating the DataConnection.

Comment on lines +126 to +128
EXPECT_THAT(log.ExtractLines(),
Contains(HasSubstr(
"Dynamic connection resolution adding new channel pool")));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same

Comment on lines +214 to +215
GOOGLE_CLOUD_CPP_DEPRECATED(
"Use the MakeDataConnection overload that accepts a vector of instances.")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

comment: deprecating an API that 100% of customers use seems like a big push for an optional feature.

I am sure @igorbernstein2 told you to do it though.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Replacing the existing fixed connection pool with the dynamic pool is less of an optional feature and more of an evolution of the library. The dynamic pool has performance benefits from channel priming and is more efficient with resources. Deprecating the existing MakeDataConnection helps provide "better defaults" when using the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: bigtable Issues related to the Bigtable API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants