We have an AlwaysOn Availability Group, with 3 nodes, one database, running SQL Server 2012 SP1 on Windows Server 2012 R2. We have a client application written in C++, that uses SQL Native Client (ADO) to access the database. We have been testing our client app in various AlwaysOn failover scenarios. We have observed one odd scenario:
1. We create a table with over 2 million rows
2. Our client app issues a simple delete, to delete all rows in the table
3. After about 20 seconds, we perform a manual failover of the AlwaysOn availability group
4. The client application loses its database connection, as we expect. However, instead of getting the usual error about communication link failure, the client gets this error:
ADO
Error =
80004005
Source
= Microsoft SQL Server Native Client
11.0
Description
= Remote harden of transaction
'user_transaction'
(ID
0x00000000000605ee
0000
:038ca665)
started at May
23
2014
3
:06PM
in database
'ca2503'
at LSN (
39246
:
27976
:
17
)
failed.
SQLState
=
01000
NativeError
=
3303
I tried this same operation in SQL Server Management Studio, and I got the following messages:
Msg 0, Level 11, State 0, Line 0A severe error occurred on the current command. The results, if any, should be discarded.
Msg 0, Level 20, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.
I looked at the SQL Server error severity documentation, and it says that errors in the 20-24 range: "Indicate system problems and are fatal errors, which means that the Database Engine task that is executing a statement or batch is no longer running. The task records information about what occurred and then terminates. In most cases, the application connection to the instance of the Database Engine may also terminate. If this happens, depending on the problem, the application might not be able to reconnect."
Should the SQL Server Native Client report this "Remote harden of transaction failed" error to the client application, or should it translate this message into a known error code that indicates that the client lost its connection (such as "Communication link failure")? If the Native Client should return this "Remote harden" error, can we rely on Native Error = 3303 to know that we've lost our connection?
Thanks,
Heather