Abnormal Termination

Microsoft SQL Server Virtual Backup

Microsoft SQL Server Virtual Backup Device Specification

Abnormal Termination

When a fatal error occurs, each side of the Virtual Device Interface is provided with a function to signal that abnormal termination should occur. The client function is IClientVirtualDeviceSet2::SignalAbort. The server function is IServerVirtualDeviceSet2::SignalAbort. When SQL Server uses SignalAbort to initiate termination, the BACKUP or RESTORE command completes with one or more messages explaining the reason for the abnormal termination. It is recommended that the client likewise log errors. When either the client or server invokes the SignalAbort interface, the virtual device set enters the Abort state. As a result, this document does not always specify what caused the SignalAbort invocation.

The use of SignalAbort is not always necessary as a means to terminate a BACKUP or RESTORE command. If the server receives an error code from IClientVirtualDevice::CompleteCommand or from an operation internal to the server, it will usually terminate the command by waiting for outstanding virtual device commands to complete, and then closing the virtual device(s).

When SignalAbort must be used, it performs a fail-fast protocol, effectively disconnecting the client and server. In-progress commands have aborted completion notifications sent to SQL Server and the client receives aborting error codes when attempting to get or complete commands.

Actions triggered by SignalAbort vary with the state of the virtual device. Actions and effects include:

  • Any in-progress functions terminate, returning with a VD_E_ABORT result. Examples include GetCommand and GetConfiguration.

  • No new SendCommands are accepted.

  • No new commands are delivered by GetCommand.

  • No new buffers are returned from GetBuffer.

  • Buffers already in the control of the client and server remain in their control until each invokes its VirtualDeviceSet::Close function.

  • Any outstanding commands are automatically completed with an ERROR_OPERATION_ABORTED completion code. The notification agent calls the callback functions as if the client had performed the completion.

  • Any command completions attempted by the client are ignored.

  • The server's completion agent returns from its ExecuteCompletionAgent call.

After SignalAbort has been used and after use of any resources is ended, the only requirement on the server and client is to invoke IServerVirtualDeviceSet2::Close and IClientVirtualDeviceSet2::Close. For example, if an I/O is being performed with a buffer when the aborting status is noticed, the I/O must be cancelled or completed before the Close interface is invoked.

IServerVirtualDeviceSet2::FreeBuffer and IServerVirtualDevice::CloseDevice do not need to be invoked after the virtual device set is in an Abort state. If they are invoked, the only action FreeBuffer or CloseDevice performs is to return VD_E_ABORT.

If either server or client exits without invoking the Close method, the WIN32® synchronization primitives will alert the interface. SignalAbort processing is internally triggered and VD_E_ABORT is returned by the interface.