feat: enable write retry and nack pending writes on reconnect#443
feat: enable write retry and nack pending writes on reconnect#443alvarowolfx merged 26 commits intogoogleapis:mainfrom
Conversation
| it('should manage to send data in scenario where every 10 request drops the connection', async () => { | ||
| bqWriteClient.initialize(); | ||
| const client = new WriterClient(); | ||
| client.enableWriteRetries(true); |
There was a problem hiding this comment.
You should also be able to test the nonretried behavior.
| this.trace('data arrived', response); | ||
| const pw = this.getNextPendingWrite(); | ||
| if (!pw) { | ||
| this.trace('data arrived', response, this._pendingWrites.length); |
There was a problem hiding this comment.
This might be a place that could benefit from the logger I'm working on elsewhere. (Probably said that already, but specifically here...)
| this._open = false; | ||
| this._retrySettings = { | ||
| enableWriteRetries: false, | ||
| maxRetryAttempts: 4, |
There was a problem hiding this comment.
Why these values? Can they be overridden?
There was a problem hiding this comment.
they can be overwritten via the enableWriteRetries and setMaxRetryAttempts methods. The default values came from the Go ManagedWriter - https://github.com/googleapis/google-cloud-go/blob/5a8c88956ea11eaf3e8aa8cffadfca06bf58c51d/bigquery/storage/managedwriter/retry.go#L31
alvarowolfx
left a comment
There was a problem hiding this comment.
answered some question and pushed updates to the PR cc @leahecole @feywind
| this._open = false; | ||
| this._retrySettings = { | ||
| enableWriteRetries: false, | ||
| maxRetryAttempts: 4, |
There was a problem hiding this comment.
they can be overwritten via the enableWriteRetries and setMaxRetryAttempts methods. The default values came from the Go ManagedWriter - https://github.com/googleapis/google-cloud-go/blob/5a8c88956ea11eaf3e8aa8cffadfca06bf58c51d/bigquery/storage/managedwriter/retry.go#L31
This PR fix an issue that can happen when an error is returned by the service side and we trigger a reconnect, in some cases where a in-flight/pending write is still waiting for response can be left without any ack/nack.
Towards internal b/329875851