Repository navigation
Fix #182 configurable transient errors - #335
Usein Mambediiev (usemam) wants to merge 3 commits into
Conversation
| try | ||
| { | ||
| await SqlUtils.ExecuteNonQueryAsync(command, this.traceHelper, instance.InstanceId); | ||
| await SqlUtils.ExecuteNonQueryAsync(command, this.traceHelper, this.settings.TransientErrorNumbers, instance.InstanceId); |
There was a problem hiding this comment.
This still won't retry the error reported in #182: GetAndOpenConnectionAsync() calls OpenAsync() before this helper is reached, so a login/network failure such as 47073 escapes before the configured number is classified. Could the retry cover connection opening as well as command execution?
| LogHelper traceHelper, | ||
| IReadOnlyCollection<int>? transientErrorNumbers, | ||
| string? instanceId, | ||
| int maxRetries = 5) |
There was a problem hiding this comment.
The existing five retries back off for only about 10 seconds total (plus jitter), while the outage described in #182 lasts 3–5 minutes. With this fixed retry window, configuring 47073 still leaves most of that outage uncovered. Could the retry duration/policy accommodate that scenario, or should the setting also expose a configurable retry window?
| } | ||
|
|
||
| // User-configured error numbers that should also be treated as transient | ||
| if (additionalTransientErrorNumbers != null && additionalTransientErrorNumbers.Contains(error.Number)) |
There was a problem hiding this comment.
This lets users opt into retrying SQL error -2, but the built-in exclusion above is deliberate because a command may have completed on the server before the client timed out. Retrying can repeat a non-idempotent operation. Could the setting's documentation call out this risk so users don't treat every added number as safe to retry?
Fixes #182
Summary
Adds a
transientErrorNumberssetting that lists extra SQL error numbers to retry as transient, on top of the built-in list. This helps with errors that only happen transiently in a particular environment.Changes
SqlOrchestrationServiceSettings.TransientErrorNumbers(IReadOnlyCollection<int>?, defaultnull).SqlUtils.IsTransientchecks the configured numbers after the built-in list. Matching errors are retried with the existing policy.transientErrorNumbersis read from host.json viaSqlDurabilityOptions.docs/quickstart.mddescribes the new setting and lists the built-in transient error numbers.