Skip to content

fix(bigtable): restore the mutation lifecycle in mutate_rows and DirectRow.commit - #18856

Merged
mutianf merged 3 commits into
mainfrom
fix-bigtable-mutation-lifecycle
Oct 27, 2026
Merged

mutianf merged 3 commits into
mainfrom
fix-bigtable-mutation-lifecycle

Conversation

@mutianf

@mutianf mutianf commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Table.mutate_rows documents that rows which fail keep their mutations so they
can be applied again, and rows that succeed are cleaned up, but the reroute to
the data client dropped the clearing entirely — so the retry idiom the docstring
describes resent mutations that had already committed. DirectRow.commit kept
its own documented behaviour of clearing after every returned status, but it
reported the synthetic DeadlineExceeded on timeout instead of the real error
from the wire, and the migration's finally had started discarding the mutations
even when the call raised and left the caller nothing to act on. Also documents
MutationsBatcher.mutate, which keeps no reference to the rows it batches and so
cannot clear them.

@mutianf
mutianf requested a review from a team as a code owner October 26, 2026 19:02

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

Copy link
Copy Markdown
Contributor

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 improves mutation handling and error reporting in the Bigtable client. It updates mutate_rows to clear mutations only for successfully applied rows, documents mutation lifecycle behaviors, and introduces _get_status_from_operation_error to unwrap synthetic DeadlineExceeded exceptions and expose the underlying terminal wire errors. Additionally, feedback was provided to use exc.details or [] in _get_status to prevent a potential TypeError in protobuf when exc.details is None.

@mutianf
mutianf force-pushed the fix-bigtable-mutation-lifecycle branch from d80e09f to 7e49603 Compare October 26, 2026 19:22
…ctRow.commit

Change-Id: Ie61267e3c48af161c0a1a0d8d06ee1e68ebb10f9
@mutianf
mutianf force-pushed the fix-bigtable-mutation-lifecycle branch from 7e49603 to 403ca01 Compare October 27, 2026 16:56
Comment thread packages/google-cloud-bigtable/google/cloud/bigtable/row.py Outdated
Change-Id: Ice21169fa5a2c0063ab5542d94db2eb1b7bccb1f
# is what commit() has always done. An exception that cannot be turned
# into a status escapes instead (it did before the reroute too, where
# clear() ran after mutate_rows returned), and the caller gets no
# outcome to act on, so the mutations are left in place for them.

@daniel-sanche daniel-sanche Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: this comment is a bit long, and it currently reads more like a commit message referencing past states ("before the reroute"). It could be confusing in the future, reviewing the code in isolation

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good call — reworded so it describes the behaviour rather than the history:

# Clear once a status is produced, success or failure. An error that
# cannot be turned into a status propagates instead, and the mutations
# stay on the row so the caller can retry them.

Fixed in 1d27cbb.

Change-Id: I3b960f653adc766c6e703d4da1e95a4e37442546
@mutianf
mutianf enabled auto-merge (squash) October 27, 2026 20:03
@mutianf
mutianf disabled auto-merge October 27, 2026 20:44
@mutianf
mutianf merged commit d0ce8e3 into main Oct 27, 2026
57 checks passed
@mutianf
mutianf deleted the fix-bigtable-mutation-lifecycle branch October 27, 2026 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants