Processing.Tasks database retriers do not reopen connection if failover happens after transaction begins

The issue is applicable to solutions with Always On configured for Processing.Tasks database.

If manual failover (via SQL Management Studio) is performed during the time when a state information about the history rebuild process is being stored or retrieved, the state might not be put to or got from the database after the failover. In addition, the following exceptions may be thrown:

System.InvalidOperationException : This SqlTransaction has completed; it is no longer usable.
at System.Data.SqlClient.SqlTransaction.ZombieCheck()
at System.Data.SqlClient.SqlTransaction.Commit()
at Sitecore.Analytics.Aggregation.History.SqlRebuildProcessStateDataProvider.<SetFailureAsync>d__4.MoveNext()
...

The cause of the issue is the failover being initiated in the middle of a transaction. Retrying in the middle of a transaction is not supported.

Refer to the following article from Microsoft where this behavior is stated as expected and other error messages are described: Idle Connection Resiliency.The connection resiliency feature is supported on Microsoft Azure SQL Databases and SQL Server 2014 (and later versions).