GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: Mutations Batcher shim by gkevinzheng · Pull Request #1309 · googleapis/python-bigtable

This repository was archived by the owner on Aug 30, 2026. It is now read-only.

Conversation

@gkevinzheng

@gkevinzheng gkevinzheng commented Mar 16, 2026

Copy link
Copy Markdown
Contributor

Changes Made:

  • Replaced mutations batcher implementation with one based off of the data client.
  • Reworked unit tests.
  • Added additional system tests.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gemini-code-assist[bot] reacted with eyes emoji
All reactions
  • 👀 1 reaction
@gkevinzheng
feat: Mutations Batcher shim
cd2cc45
@gkevinzheng
gkevinzheng requested a review from a team March 16, 2026 16:22
@product-auto-label product-auto-label Bot added size: l Pull request size is large. api: bigtable Issues related to the googleapis/python-bigtable API. labels Mar 16, 2026
@gkevinzheng
gkevinzheng requested a review from daniel-sanche March 16, 2026 16:22
@gemini-code-assist

gemini-code-assist Bot commented Mar 16, 2026

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 refactors the MutationsBatcher to act as a shim, delegating its core batching responsibilities to an internal batcher provided by the data client. This change streamlines the batching mechanism, leveraging the data client's capabilities for more robust and efficient mutation operations, while maintaining the existing public interface.

Highlights

  • Mutations Batcher Implementation: The underlying implementation of the Mutations Batcher has been replaced with one based on the new data client, simplifying the batching logic.
  • Unit Tests Reworked: Existing unit tests have been refactored to align with the new batcher implementation and improve testability.
  • System Tests Added: New system tests have been introduced to cover exception handling and manual flushing scenarios for the Mutations Batcher.
Changelog
  • google/cloud/bigtable/batcher.py
    • Removed deprecated internal batching classes and methods, including _MutationsBatchQueue, _BatchInfo, _FlowControl, _flush_async, and related helpers.
    • Updated imports to utilize MutationsExceptionGroup and RowMutationEntry from the google.cloud.bigtable.data module.
    • Modified the MutationsBatcher constructor to initialize and manage an internal batcher instance from table._table_impl.mutations_batcher.
    • Implemented _init_batcher and _close_batcher methods to control the lifecycle and exception handling of the internal batcher.
    • Updated the mutate method to append mutations directly to the new internal batcher.
    • Refactored the flush method to close and re-initialize the internal batcher, ensuring pending mutations are processed.
    • Adjusted the close method to properly shut down the internal batcher and collect any exceptions.
  • google/cloud/bigtable/data/_async/client.py
    • Removed unused Callable and status_pb2 imports.
  • google/cloud/bigtable/data/_async/mutations_batcher.py
    • Removed unused Callable and Optional imports.
  • tests/system/v2_client/test_data_api.py
    • Added test_mutations_batcher_exceptions to verify the batcher's error propagation and handling.
    • Added test_mutations_batcher_manual_flush to confirm correct behavior when manually flushing mutations.
  • tests/unit/v2_client/test_batcher.py
    • Refactored unit tests to use _setup_batcher and _atexit_mock fixtures for improved test setup and isolation.
    • Updated constructor tests to verify the correct initialization parameters are passed to the internal batcher.
    • Modified tests for mutate_rows, mutate, flush, and close to assert interactions with the mocked internal batcher operations.
    • Updated exception handling tests to reflect the new MutationsExceptionGroup and FailedMutationEntryError types.
    • Removed obsolete test helper classes and functions related to the old batcher implementation.
Activity
  • No specific activity has been recorded for this pull request yet.
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. ↩

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gemini-code-assist[bot]
gemini-code-assist Bot reviewed Mar 16, 2026
View reviewed changes

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

Copy link
Copy Markdown
Contributor

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.

Code Review

The pull request successfully refactors the MutationsBatcher to leverage the new data client's batching capabilities. This significantly simplifies the batcher.py file by removing a substantial amount of custom queueing, flow control, and asynchronous flushing logic. The updated unit and system tests adequately cover the new implementation, including exception handling and manual flushing behavior. The changes align with the goal of migrating to the new data client.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread google/cloud/bigtable/batcher.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@gkevinzheng
mypy
f47e606
daniel-sanche
daniel-sanche suggested changes Mar 18, 2026
View reviewed changes
Comment thread google/cloud/bigtable/batcher.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/bigtable/batcher.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/bigtable/data/_async/mutations_batcher.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/bigtable/batcher.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/bigtable/batcher.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/bigtable/batcher.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@gkevinzheng
addressed review feedback
6aca433
daniel-sanche
daniel-sanche suggested changes Mar 20, 2026
View reviewed changes

@daniel-sanche daniel-sanche left a comment

Copy link
Copy Markdown
Contributor

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.

We need to be careful with that zip call, and there are a couple docstrings to update. Otherwise looks good

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread google/cloud/bigtable/data/_async/mutations_batcher.py Outdated
waits for them to complete, and returns a list of errors encountered.

Args:
*tasks: futures representing _execute_mutate_rows or _flush_internal tasks

@daniel-sanche daniel-sanche Mar 20, 2026

Copy link
Copy Markdown
Contributor

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.

this Args needs to be updated

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread google/cloud/bigtable/data/_async/mutations_batcher.py Outdated
exceptions: list[Exception] = []
for task in tasks:
exceptions: list[FailedMutationEntryError] = []
for task, batch in list(zip(tasks, batches)):

@daniel-sanche daniel-sanche Mar 20, 2026

Copy link
Copy Markdown
Contributor

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.

This feels risky, since zip will stop early if one list is a different size than the other. This could turn into a data loss issue in the future

Maybe we should have a single list of tuples, so we have a bit more type safety there?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread google/cloud/bigtable/data/exceptions.py Outdated

@daniel-sanche daniel-sanche Mar 20, 2026

Copy link
Copy Markdown
Contributor

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.

remove this TODO. And update the docstring:

Exceptions will typically be of type FailedMutationEntryError, but other exceptions may
be included if they are raised during the mutation operation

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gkevinzheng
addressed more feedback
3fc658a
daniel-sanche
daniel-sanche approved these changes Mar 20, 2026
View reviewed changes

@daniel-sanche daniel-sanche left a comment

Copy link
Copy Markdown
Contributor

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.

LGTM

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gkevinzheng
gkevinzheng merged commit 29a736d into v3_staging Mar 24, 2026
6 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@gkevinzheng
gkevinzheng deleted the mutations-batcher branch March 24, 2026 14:01
@daniel-sanche daniel-sanche mentioned this pull request Aug 21, 2026
feat(bigtable): Reroute Mutations Batcher to use data client googleapis/google-cloud-python#18200
Merged
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

2 more reviewers
@gemini-code-assist gemini-code-assist[bot] gemini-code-assist[bot] left review comments
@daniel-sanche daniel-sanche daniel-sanche approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

api: bigtable Issues related to the googleapis/python-bigtable API. size: l Pull request size is large.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@gkevinzheng @daniel-sanche
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.