U4-9516 - Feature Request - Better cloud support for transient network error detection strategy selection

Created by Grant Hughes 10 Feb 2017, 22:10:04 Updated by Sebastiaan Janssen 04 Sep 2017, 09:33:03

Tags: PR Community Contrib

Subtask of: U4-9609

Right now there are 2 strategies in Umbraco for detecting transient network errors in SQL connections to help determine if the SQL should be retried: NetworkConnectivityErrorDetectionStrategy and SqlAzureTransientErrorDetectionStrategy. This works fine for traditional server setups and Azure based ones, but lacks flexibility to better support other cloud platforms. It would be useful to be able to more easily select to use the SqlAzureTransientErrorDetectionStrategy when using a non-Azure cloud platform to take advantage of all the extra scenarios that it handles over the default strategy.

The flexibility issue lies in the simplistic checks currently used to determine which strategy to apply. Here is a snippet from RetryPolicyFactory.cs:

public static RetryPolicy GetDefaultSqlConnectionRetryPolicyByConnectionString(string connectionString)
{
	//Is this really the best way to determine if the database is an Azure database?
	return connectionString.Contains("database.windows.net")
			   ? GetDefaultSqlAzureConnectionRetryPolicy()
			   : GetDefaultSqlConnectionRetryPolicy();
}

Other cloud platforms are unlikely to contain "database.windows.net" in their connection string, so you end up being forced into the default strategy. It would be useful to have the ability to select the Azure strategy when using a different cloud platform in order to reduce the amount of errors in an application that could have been resolved on their own with better transient detection and retrying the corresponding SQL.

I will post a pull request soon for this where I propose a new Umbraco setting to allow a developer to specifically select the particularly retry policy they would like their application to use.

Comments

Grant Hughes 10 Feb 2017, 22:21:13

Here is my pull request: https://github.com/umbraco/Umbraco-CMS/pull/1751


Priority: Normal

Type: Feature (request)

State: Open

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions:

Due in version:

Sprint:

Story Points: 1

Cycle: 4