|
53 | 53 | _MAX_BULK_MUTATIONS = 100000 |
54 | 54 | VIEW_NAME_ONLY = enums.Table.View.NAME_ONLY |
55 | 55 |
|
| 56 | +RETRYABLE_MUTATION_ERRORS = (Aborted, DeadlineExceeded, ServiceUnavailable) |
| 57 | +"""Errors which can be retried during row mutation.""" |
| 58 | + |
56 | 59 |
|
57 | 60 | class _BigtableRetryableError(Exception): |
58 | 61 | """Retry-able error expected by the default retry strategy.""" |
@@ -1039,10 +1042,8 @@ class _RetryableMutateRowsWorker(object): |
1039 | 1042 | are retryable, any subsequent call on this callable will be a no-op. |
1040 | 1043 | """ |
1041 | 1044 |
|
1042 | | - RETRY_CODES = ( |
1043 | | - Aborted.grpc_status_code.value[0], |
1044 | | - DeadlineExceeded.grpc_status_code.value[0], |
1045 | | - ServiceUnavailable.grpc_status_code.value[0], |
| 1045 | + RETRY_CODES = tuple( |
| 1046 | + retryable.grpc_status_code.value[0] for retryable in RETRYABLE_MUTATION_ERRORS |
1046 | 1047 | ) |
1047 | 1048 |
|
1048 | 1049 | def __init__(self, client, table_name, rows, app_profile_id=None, timeout=None): |
@@ -1125,7 +1126,7 @@ def _do_mutate_retryable_rows(self): |
1125 | 1126 | retry=None, |
1126 | 1127 | **kwargs |
1127 | 1128 | ) |
1128 | | - except (ServiceUnavailable, DeadlineExceeded, Aborted): |
| 1129 | + except RETRYABLE_MUTATION_ERRORS: |
1129 | 1130 | # If an exception, considered retryable by `RETRY_CODES`, is |
1130 | 1131 | # returned from the initial call, consider |
1131 | 1132 | # it to be retryable. Wrap as a Bigtable Retryable Error. |
|
0 commit comments