-
Notifications
You must be signed in to change notification settings - Fork 19
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
feat: enable write retry and nack pending writes on reconnect #443
feat: enable write retry and nack pending writes on reconnect #443
Conversation
…/nodejs-bigquery-storage into fix-ack-on-reconnect
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably too much logging, it will log one line per request. If it is debug logging then it is fine.
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.
those trace
calls are only on DEBUG mode.
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.
Is there a LOG mode? I think those reconnect errors need to be in LOG mode. Even for debug mode, per request logging might be too much, but I am less concerned.
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.
This might be a place that could benefit from the logger I'm working on elsewhere. (Probably said that already, but specifically here...)
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.
gonna be the first user of that new logger @feywind 🚀
const pw = this.getNextPendingWrite(); | ||
if (!pw) { | ||
this.trace('data arrived', response, this._pendingWrites.length); | ||
if (!this.hasPendingWrites()) { | ||
this.trace('data arrived with no pending write available', response); |
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.
Same here.
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.
Nothing super important, I think...
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be a place that could benefit from the logger I'm working on elsewhere. (Probably said that already, but specifically here...)
@@ -69,6 +74,10 @@ export class WriterClient { | |||
connectionList: [], | |||
}; | |||
this._open = false; | |||
this._retrySettings = { | |||
enableWriteRetries: false, | |||
maxRetryAttempts: 4, |
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.
Why these values? Can they be overridden?
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.
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
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.
answered some question and pushed updates to the PR cc @leahecole @feywind
@@ -69,6 +74,10 @@ export class WriterClient { | |||
connectionList: [], | |||
}; | |||
this._open = false; | |||
this._retrySettings = { | |||
enableWriteRetries: false, | |||
maxRetryAttempts: 4, |
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.
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