Bigtable: smart retry logic to cover errors in 'read_rows()' and 'read_rows(rows_limit)' requests#5966
Conversation
read_rows() and read_rows(lows_limit) requests
aec7df2 to
f325197
Compare
* add clarifying comments
* cover erros from request with row_range where
end_key only is set and start_key is empty (read from beginning till
end key)
f325197 to
794ea2e
Compare
|
@sduskis I think changes that we spoke about offline are done. |
| else: | ||
| new_row_ranges.append(row_range) | ||
| # if current end_key (open or closed) is set, return its value, | ||
| # if not, set to empty string ('') |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| continue | ||
|
|
||
| # if current start_key (open or closed) is set, return its value, | ||
| # if not, then set to empty string ('') |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| return new_row_ranges | ||
|
|
||
| def _key_already_read(self, key): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| expected_result.rows.row_ranges.add(**self.row_range1. | ||
| expected_result_row_range = RowRange(last_scanned_key, b"row_key29", | ||
| False) | ||
| expected_result.rows.row_ranges.add(**expected_result_row_range. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| rows_limit=8, | ||
| table_name=self.table_name) | ||
| row_range = RowRange(end_key=b"row_key29") | ||
| request.rows.row_ranges.add(**row_range.get_range_kwargs()) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| rows_limit=6) | ||
| expected_result_row_range = RowRange(last_scanned_key, b"row_key29", | ||
| False) | ||
| expected_result.rows.row_ranges.add(**expected_result_row_range. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| rows_limit=6) | ||
| expected_result_row_range = RowRange(last_scanned_key, | ||
| start_inclusive=False) | ||
| expected_result.rows.row_ranges.add(**expected_result_row_range. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| rows_limit=8, | ||
| table_name=self.table_name) | ||
| row_range = RowRange(start_key=b"row_key20") | ||
| request.rows.row_ranges.add(**row_range.get_range_kwargs()) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| self.assertEqual(expected_result, result) | ||
|
|
||
| def test_buil_updated_request_rows_limit(self): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| get_range_kwargs()) | ||
| self.assertEqual(expected_result, result) | ||
|
|
||
| def test_buil_updated_request_plain(self): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
@GoogleCloudPlatform/yoshi-python, can we please get a review for this? This fixes a P1 issue: #5876. |
| expected_result = _ReadRowsRequestPB(table_name=self.table_name, | ||
| filter=row_filter.to_pb(), | ||
| rows_limit=6) | ||
| expected_result.rows.row_ranges.add(start_key_open=last_scanned_key) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
into test_build_updated_request_read_whole_table
Attempt to fix #5876
Added logic to create a
RowRange(start_key_open=last_scanned_key)ifcurrent_request.rowsis empty.This will cover
table.read_rows()andtable.read_rows(rows_limit)requests.