Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: retry BulkWriter deletes that fail with RST_STREAM error #1442

Merged
merged 7 commits into from Mar 9, 2021

Conversation

thebrianchen
Copy link

No description provided.

@thebrianchen thebrianchen self-assigned this Mar 5, 2021
@thebrianchen thebrianchen requested review from a team as code owners March 5, 2021 22:02
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Mar 5, 2021
@product-auto-label product-auto-label bot added the api: firestore Issues related to the googleapis/nodejs-firestore API. label Mar 5, 2021
@codecov
Copy link

codecov bot commented Mar 5, 2021

Codecov Report

Merging #1442 (0a6ca1b) into master (6c9319e) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1442   +/-   ##
=======================================
  Coverage   98.20%   98.20%           
=======================================
  Files          32       32           
  Lines       19507    19509    +2     
  Branches     1363     1363           
=======================================
+ Hits        19157    19159    +2     
  Misses        346      346           
  Partials        4        4           
Impacted Files Coverage Δ
dev/src/bulk-writer.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6c9319e...0a6ca1b. Read the comment docs.

@@ -316,10 +316,14 @@ export class BulkWriter {
* @private
*/
private _errorFn: (error: BulkWriterError) => boolean = error => {
const isRstStreamError =
(error.code as number) === Status.INTERNAL &&
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. We should be able to retry Status.INTERNAL regardless of whether this is a RST_STREAM error.
  2. We should only add this retry for deletes.

Copy link

Choose a reason for hiding this comment

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

Would you please explain why the retry should be only for deletes?
The RST could happen on any other methods, this limitation comes from idempotency?

For example, Spanner automatically retries transaction commits, regardless of the queries within the txn. I wonder if there is a firestore specific thing here.

@@ -316,10 +316,13 @@ export class BulkWriter {
* @private
*/
private _errorFn: (error: BulkWriterError) => boolean = error => {
const isRetryableDeleteError =
error.operationType === 'delete' &&
(error.code as number) === Status.INTERNAL;
const retryCodes = getRetryCodes('batchWrite');
return (
error.code !== undefined &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we actually need this undefined check? Would retryCodes.include() just return false?

Copy link
Author

Choose a reason for hiding this comment

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

nope! removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the googleapis/nodejs-firestore API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants