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: Always set the retry attempt to 0 for now #1251

Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/table.ts
Expand Up @@ -776,11 +776,11 @@
} as google.bigtable.v2.IReadRowsRequest;

const retryOpts = {
currentRetryAttempt: numConsecutiveErrors,
currentRetryAttempt: 0, // was numConsecutiveErrors
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know why "numConsecutiveErrors" doesn't work here even though its value is 0 according to Line 730?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

numConsecutiveErrors works, but if it is greater than 0 then that will make the request take longer. Note that the number of consecutive errors is incremented at

numConsecutiveErrors++;
on each retry.

Copy link
Contributor

Choose a reason for hiding this comment

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

I found this

calculatedNextRetryDelay = config.initialRetryDelayMillis * Math.pow(config.retryDelayMultiplier, numConsecutiveErrors)

It implies that when it's executed for the first time (i.e. the original request has failure), numConsecutiveErrors should be 0 such that the retry delay is config.initialRetryDelayMillis

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Keep in mind that the change in the PR doesn't affect this code. This is a delay that happens in the veneer layer while the delay in retryRequest happens below the veneer layer.

// Handling retries in this client. Specify the retry options to
// make sure nothing is retried in retry-request.
noResponseRetries: 0,
shouldRetryFn: (_: any) => {

Check warning on line 783 in src/table.ts

View workflow job for this annotation

GitHub Actions / lint

'_' is defined but never used

Check warning on line 783 in src/table.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
return false;
},
};
Expand Down Expand Up @@ -939,7 +939,7 @@
userStream.emit('error', error);
}
})
.on('data', _ => {

Check warning on line 942 in src/table.ts

View workflow job for this annotation

GitHub Actions / lint

'_' is defined but never used
// Reset error count after a successful read so the backoff
// time won't keep increasing when as stream had multiple errors
numConsecutiveErrors = 0;
Expand Down Expand Up @@ -1562,7 +1562,7 @@
// Handling retries in this client. Specify the retry options to
// make sure nothing is retried in retry-request.
noResponseRetries: 0,
shouldRetryFn: (_: any) => {

Check warning on line 1565 in src/table.ts

View workflow job for this annotation

GitHub Actions / lint

'_' is defined but never used

Check warning on line 1565 in src/table.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
return false;
},
};
Expand Down