feat: Rerouted ReadRows to data client - #18198
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the Bigtable client to delegate row reading and streaming to the underlying _table_impl data client, deprecating legacy classes like _RowMerger and several attributes on PartialRowsData. The review feedback identifies potential AttributeError risks when accessing retry.deadline directly (since google.api_core.retry.Retry typically uses _deadline internally) in table.py and unit tests, as well as when calling close() on _generator in row_data.py if the generator does not support it.
**Changes made:** - `Row` objects hold `Mutation` and `ReadModifyWriteRowRule` objects from the data client rather than raw protos. - Rerouted `ConditionalRow.commit` and `AppendRow.commit` (CheckAndMutateRows and ReadModifyWriteRows respectively) to use the data client, or more specifically, `self._table._table_impl` - Added function `DirectRow._to_mutation_pbs` for retrieving mutations in proto form for the current `MutateRows` implementation, as well as for `DirectRow.get_mutations_size`. - Removed unnecessary helper functions and tests for helper functions
**Changes Made:** - Use MutateRow instead of MutateRows for DirectRow.commit instead of Table.MutateRows - Added system test for DirectRow.commit because of the decoupling of DirectRow.commit and Table.MutateRows - Adjusted input error system test because of slight changes in error behavior - Adjusted unit tests for DirectRow.commit
**Changes made:** - Refactored `_MappableAttributesMixin` to `helpers.py` for use in `RowRange`. - Used `RowRange` and `ReadRowsQuery` from the data client as backing data sources for `RowRange` and `RowSet` respectively.
According to go/rst_stream, `INTERNAL` errors with error messages related to an `rst_stream` error should be interpreted as `UNAVAILABLE` errors instead of internal errors. This PR creates a custom retry predicate to allow retrying of `INTERNAL` errors with rst_stream specific error messages if the `ServiceUnavailable` exception is allowed to be retried. --------- Co-authored-by: Daniel Sanche <sanche@google.com>
**Changes Made:** - Added methods to convert `Row` and `Cell` objects in the data client to `PartialRowData` and `Cell` objects in the legacy client. - Removed legacy client code related to processing `ReadRowResponse` chunks and testing `ReadRowResponse` chunks. - Removed `_update_message_request` from `RowSet` because it's no longer needed to create a `ReadRowQuery` - Rerouted `read_row` and `read_rows` to use their data client counterparts in `table.py`.
92da437 to
e435179
Compare
**Changes made:** - Refactored `_MappableAttributesMixin` to `helpers.py` for use in `RowRange`. - Used `RowRange` and `ReadRowsQuery` from the data client as backing data sources for `RowRange` and `RowSet` respectively.
According to go/rst_stream, `INTERNAL` errors with error messages related to an `rst_stream` error should be interpreted as `UNAVAILABLE` errors instead of internal errors. This PR creates a custom retry predicate to allow retrying of `INTERNAL` errors with rst_stream specific error messages if the `ServiceUnavailable` exception is allowed to be retried. --------- Co-authored-by: Daniel Sanche <sanche@google.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
**Changes made:** - Refactored `_MappableAttributesMixin` to `helpers.py` for use in `RowRange`. - Used `RowRange` and `ReadRowsQuery` from the data client as backing data sources for `RowRange` and `RowSet` respectively.
According to go/rst_stream, `INTERNAL` errors with error messages related to an `rst_stream` error should be interpreted as `UNAVAILABLE` errors instead of internal errors. This PR creates a custom retry predicate to allow retrying of `INTERNAL` errors with rst_stream specific error messages if the `ServiceUnavailable` exception is allowed to be retried. --------- Co-authored-by: Daniel Sanche <sanche@google.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
|
||
| self.rows = {} | ||
| @property | ||
| def last_scanned_row_key(self): |
There was a problem hiding this comment.
I think this property was only used in the internal method? Would it actually be called? Is it safe to just remove it?
Same question with read_method and retry, and request
| :type row_key: bytes | ||
| :param row_key: The key of the row to read from. | ||
|
|
||
| :type filter_: :class:`.RowFilter` |
There was a problem hiding this comment.
Did we rewrite the RowFilter class?
Migrating over @gkevinzheng PR from bigtable monorepo googleapis/python-bigtable#1308
Original description:
Additional Changes:
Applied some guards against removed semi-private APIs, after internal discussion:
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