-
Notifications
You must be signed in to change notification settings - Fork 145
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
Conversation
a17fcb4
to
1a3f6d6
Compare
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
dev/src/bulk-writer.ts
Outdated
@@ -316,10 +316,14 @@ export class BulkWriter { | |||
* @private | |||
*/ | |||
private _errorFn: (error: BulkWriterError) => boolean = error => { | |||
const isRstStreamError = | |||
(error.code as number) === Status.INTERNAL && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- We should be able to retry Status.INTERNAL regardless of whether this is a RST_STREAM error.
- We should only add this retry for deletes.
There was a problem hiding this comment.
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.
dev/src/bulk-writer.ts
Outdated
@@ -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 && |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope! removed.
🤖 I have created a release \*beep\* \*boop\* --- ### [4.9.7](https://www.github.com/googleapis/nodejs-firestore/compare/v4.9.6...v4.9.7) (2021-03-09) ### Bug Fixes * export v1 and v1beta1 client class types correctly ([#1445](https://www.github.com/googleapis/nodejs-firestore/issues/1445)) ([6c9319e](https://www.github.com/googleapis/nodejs-firestore/commit/6c9319ed6e2ac0dfe0fcf45853f0b38dc0784686)) * retry BulkWriter deletes that fail with RST_STREAM error ([#1442](https://www.github.com/googleapis/nodejs-firestore/issues/1442)) ([cccf48d](https://www.github.com/googleapis/nodejs-firestore/commit/cccf48de4963403a2e77ba241641a2b77fb993da)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
No description provided.