Skip to content

feat(bigtable): add explicit instance MakeDataConnection#16191

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

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

Conversation

@scotthart

Copy link
Copy Markdown
Member

No description provided.

@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 on lines +43 to +48
return bigtable::Table(
bigtable::MakeDataConnection(
{bigtable::InstanceResource(google::cloud::Project(project_id),
instance_id)},
options),
resource);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The options object is passed by value to MakeDataConnection but is not used afterward in this scope. Moving it using std::move(options) avoids an unnecessary copy of the Options object, adhering to the repository style guide regarding unnecessary copies.

    return bigtable::Table(
        bigtable::MakeDataConnection(
            {bigtable::InstanceResource(google::cloud::Project(project_id),
                                        instance_id)},
            std::move(options)),
        resource);
References
  1. Scrutinize copies of non-fundamental C++ types. Is it necessary to copy the data? Can we move the data instead? (link)

Comment on lines +74 to +77
auto connection = cbt::MakeDataConnection(
{cbt::InstanceResource(google::cloud::Project(project_id),
instance_id)},
options);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The options object is passed by value to MakeDataConnection but is not used afterward in this scope. Moving it using std::move(options) avoids an unnecessary copy of the Options object, adhering to the repository style guide regarding unnecessary copies.

    auto connection = cbt::MakeDataConnection(
        {cbt::InstanceResource(google::cloud::Project(project_id),
                               instance_id)},
        std::move(options));
References
  1. Scrutinize copies of non-fundamental C++ types. Is it necessary to copy the data? Can we move the data instead? (link)

Comment on lines +122 to +127
return bigtable::Table(
bigtable::MakeDataConnection(
{bigtable::InstanceResource(google::cloud::Project(project_id),
instance_id)},
options),
resource);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The options object is passed by value to MakeDataConnection but is not used afterward in this scope. Moving it using std::move(options) avoids an unnecessary copy of the Options object, adhering to the repository style guide regarding unnecessary copies.

    return bigtable::Table(
        bigtable::MakeDataConnection(
            {bigtable::InstanceResource(google::cloud::Project(project_id),
                                        instance_id)},
            std::move(options)),
        resource);
References
  1. Scrutinize copies of non-fundamental C++ types. Is it necessary to copy the data? Can we move the data instead? (link)

Comment on lines +153 to +158
return bigtable::Table(
bigtable::MakeDataConnection(
{bigtable::InstanceResource(google::cloud::Project(project_id),
instance_id)},
*ud_options),
resource);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The *ud_options object is passed by value to MakeDataConnection but is not used afterward in this scope. Moving it using std::move(*ud_options) avoids an unnecessary copy of the Options object, adhering to the repository style guide regarding unnecessary copies.

    return bigtable::Table(
        bigtable::MakeDataConnection(
            {bigtable::InstanceResource(google::cloud::Project(project_id),
                                        instance_id)},
            std::move(*ud_options)),
        resource);
References
  1. Scrutinize copies of non-fundamental C++ types. Is it necessary to copy the data? Can we move the data instead? (link)

Comment on lines +131 to +132
data_connection_ = MakeDataConnection(
{InstanceResource(Project(project_id()), instance_id())}, options);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The options object is passed by value to MakeDataConnection but is not used afterward in this scope. Moving it using std::move(options) avoids an unnecessary copy of the Options object, adhering to the repository style guide regarding unnecessary copies.

Suggested change
data_connection_ = MakeDataConnection(
{InstanceResource(Project(project_id()), instance_id())}, options);
data_connection_ = MakeDataConnection(
{InstanceResource(Project(project_id()), instance_id())}, std::move(options));
References
  1. Scrutinize copies of non-fundamental C++ types. Is it necessary to copy the data? Can we move the data instead? (link)

@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.98198% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.23%. Comparing base (0a8f509) to head (2850839).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ogle/cloud/bigtable/tests/data_integration_test.cc 18.18% 18 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   210199      +73     
==========================================
+ Hits       193832   193884      +52     
- Misses      16294    16315      +21     

☔ 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
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.

1 participant