fix(bigtable): Retry correct mutations #11388
Merged
+3
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
b/387315971
TestMutateRows_Retry_TransientErrors fails with below errors:
These are requests and responses sent by the mock server setup by the test
Tests send requests for 4 row mutations (row-0, row-1, row-2, row-3). The mock server returns 'Unavailable' error for row-1 and row-2.
Expected: The library should retry mutations for row-1 and row-2
Actual: The library retries mutations for row-2 and row-3
Cause: The library assumes that responses are returned in the same order of the requests. This is not true.
The server may return the response in any order. The Index field should be used to determine the request for which the response was sent. In this test, for req [row-0, row-1, row-2, row-3], the response sent by the server is [{Index: 0, Err:nil}, {Index: 3, Err:nil}, {Index: 1, Err: Unavailable}, {Index: 2, Err: Unavailable}]. The library incorrectly assumes one on one mapping of error array to req array i.e. it assumes that unavailable response was received for row-2 and row-3 and retries them.
Fix: This PR fixes the test by using
Index
field to determine which rows need to be retriedAfter fix: