chore(bigtable): Added an internal batch completed callback to the data client mutations batcher - #18199
chore(bigtable): Added an internal batch completed callback to the data client mutations batcher#18199daniel-sanche wants to merge 3 commits into
Conversation
…atcher (#1308) **Changes made:** - Refactored logic from `Table.mutate_rows` from producing a list of `Status` protos from a `MutationsExceptionGroup` - Added private keyword argument for a batch completion callback in the MutationsBatcher. - Added unit tests/system tests.
There was a problem hiding this comment.
Code Review
This pull request introduces a user batch completed callback to both the async and sync auto-generated MutationsBatcher classes, and refactors status-extraction logic into a shared helper function _get_statuses_from_mutations_exception_group in _helpers.py. The review feedback highlights critical issues with using list multiplication (e.g., [status_pb2.Status(...)] * size) which creates multiple references to the same mutable Status object, recommending list comprehensions instead. Additionally, the reviewer advises wrapping the user callback execution in a try-except block within the finally clause to prevent callback exceptions from masking other active exceptions, and suggests using module-level protobuf constants for consistency.
Migrating over @gkevinzheng PR from bigtable monorepo googleapis/python-bigtable#1308
Original description:
Additional Changes:
Note to reviewers: This PR has already been reviewed and merged to a staging branch, with the intention of doing a single merge to main. We are now planning to slowly rollout these changes back to the main branch. Minimal re-review should be necessary