Skip to content

mpl(bigtable): error when read_buffer is not empty and stream finishes#15775

Merged
scotthart merged 2 commits intogoogleapis:mainfrom
scotthart:bigquery_conf_empty_resume_token
Nov 18, 2025
Merged

mpl(bigtable): error when read_buffer is not empty and stream finishes#15775
scotthart merged 2 commits intogoogleapis:mainfrom
scotthart:bigquery_conf_empty_resume_token

Conversation

@scotthart
Copy link
Member

We were checking for buffered_rows_ not empty but we also needed to check for read_buffer_ not empty which indicates the stream finished with uncommited rows or unprocessed data.

@scotthart scotthart requested a review from a team November 17, 2025 23:19
@product-auto-label product-auto-label bot added the api: bigtable Issues related to the Bigtable API. label Nov 17, 2025
@gemini-code-assist
Copy link

Summary of Changes

Hello @scotthart, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical bug in the Bigtable client library where ExecuteQuery streams could terminate with unprocessed data without proper error reporting. It introduces a more comprehensive check for uncommitted data at the end of a stream. Concurrently, the PR refactors the query plan refresh retry mechanism, centralizing and enhancing the logic for detecting expired query plans by parsing gRPC status payloads. These changes improve the robustness of stream processing and error handling within the Bigtable client.

Highlights

  • Bug Fix: Uncommitted Rows Error: Corrected an issue where the ExecuteQuery stream could finish with uncommitted rows or unprocessed data in the read_buffer_ without reporting an error. The fix now explicitly checks read_buffer_ in addition to buffered_rows_ to catch this condition.
  • Refactor: Query Plan Refresh Retry Logic: The SafeGrpcRetryAllowingQueryPlanRefresh struct has been renamed to QueryPlanRefreshRetry and its IsQueryPlanExpired logic has been moved to a new .cc file (internal/retry_traits.cc). This change allows for more robust parsing of gRPC status payloads to determine if a query plan has expired, improving retry behavior.
  • Improved Error Reporting: Error reporting in data_connection_impl.cc and partial_result_set_source.cc has been enhanced by utilizing internal::AbortedError and internal::InternalError with GCP_ERROR_INFO(), providing more detailed context for debugging.
  • Build System Updates: The CMakeLists.txt and google_cloud_cpp_bigtable.bzl files have been updated to include the newly introduced internal/retry_traits.cc source file.
  • Conformance Test Adjustments: The run_conformance_tests_proxy_bazel.sh script has been modified to include new TestExecuteQuery cases related to plan refresh and to adjust the list of skipped tests.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

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

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 correctly fixes a bug where data in read_buffer_ could be lost if a stream finished before the buffer was processed. The check is now correctly performed against both buffered_rows_ and read_buffer_.

Additionally, the PR includes a nice refactoring of the query plan refresh retry logic. The new QueryPlanRefreshRetry trait improves robustness by inspecting the structured error details in the Status payload, not just the error message. The new tests for this logic are comprehensive and well-written.

I have a couple of minor points for consideration regarding a typo in a copyright header and a clarification on a change in retry behavior for kInternal errors.

@codecov
Copy link

codecov bot commented Nov 17, 2025

Codecov Report

❌ Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.95%. Comparing base (2366ddf) to head (1e2a567).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...oud/bigtable/internal/partial_result_set_source.cc 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15775      +/-   ##
==========================================
+ Coverage   92.94%   92.95%   +0.01%     
==========================================
  Files        2449     2449              
  Lines      226518   226520       +2     
==========================================
+ Hits       210531   210563      +32     
+ Misses      15987    15957      -30     

☔ View full report in Codecov by Sentry.
📢 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 merged commit 00a3e10 into googleapis:main Nov 18, 2025
68 of 70 checks passed
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