Improvement
In the current implementation of the SQL Server Virtual Backup Device Interface (VDI) protocol, the last message sent from SQL Server to the VDI client will be a VDC_Flush command. To prevent data loss, the VDI client must finish the backup before responding to the VDC_Flush command.
Starting with SQL Server 2008 and the introduction of FILESTREAM, the VDC_Flush command can be sent multiple times during a backup. This operation causes an issue that the VDI client has to finish the backup multiple times during the backup operation. This is not possible for some VDI clients. Additionally, if the VDI client responds to a VDC_Flush command without ensuring the backup is hardened when more data is coming after the VDC_Flush, SQL Server may truncate the transaction log. However, if the backup eventually fails on the VDI client, and the transaction log is also truncated, data loss might occur. This update adds a new VDI command VDC_Complete that indicates SQL Server has completed sending data to the VDI client. Therefore, the VDI client will be able to finish the backup before it sends response to SQL Server. This functionality allows the VDI client to fail the backup in case something goes wrong, and also prevents the transaction log being truncated by mistake. Note To support the new VDC_Complete command, this update also adds two new VDI features VDF_RequestComplete and VDF_CompleteEnabled.Update information
This improvement is included in the following cumulative updates for SQL Server:Cumulative Update 2 for SQL Server 2016 SP1 Cumulative update 4 for SQL Server 2016
Cumulative Update 5 for SQL Server 2012 Service Pack 3 (SP3) Cumulative update 3 for SQL Server 2014 SP2 Cumulative Update 10 for SQL Server 2014 SP1
About cumulative updates for SQL Server
Each new cumulative update for SQL Server contains all the hotfixes and all the security fixes that were included with the previous cumulative update. Check out the latest cumulative updates for SQL Server:
Latest cumulative update for SQL Server 2016
More Information
To use the new VDC_Complete command, the following implementations have to be applied to your VDI client:
-
Request the new VDI feature VDF_RequestComplete. If SQL Server supports the VDC_Complete command, it will return a not NULL response. Otherwise, it would return a NULL response for the requested feature. The code sample here shows how to request the feature:
m_pvdiComponents->m_pvdConfig->features = VDF_RequestComplete;
printf("Requested features to SQL Server: 0x{0:X}", m_pvdiComponents->m_pvdConfig->features); -
Determine whether the SQL Server supports the new VDC_Complete command by using the GetConfiguration function.
hr = m_pvdiComponents->m_pvdDeviceSet->GetConfiguration(timeout, m_pvdiComponents->m_pvdConfig);
if (!(m_pvdiComponents->m_pvdConfig->features & VDF_CompleteEnabled)) { printf("Server does not support VDC_Complete."); return VD_E_NOTSUPPORTED; } -
When you process the VDI messages that are fetched by the GetCommand function, add an additional case statement to process the VDC_Complete command.
case VDC_Complete:
// Close the media and ensure that book keeping is completed. backupMedia->Close(); completionCode = ERROR_SUCCESS; break;
Note The VDC_Complete message has to be incorporated into the backup application so that it can use the improvement.
References
Learn about the terminology that Microsoft uses to describe software updates.