Determining Writer Status
A requester needs to have a well-defined understanding about the status of the writer that participates with it during shadow copy creation, and during backup and restore operations. To do so, it is recommended:
Requesters use IVssBackupComponents::GatherWriterStatus, IVssBackupComponents::GetWriterStatusCount, and IVssBackupComponents::GetWriterStatus.
As described in Overview of Processing a Backup Under VSS and Overview of Processing a Restore Under VSS, these methods are most useful when called in a well-defined backup or restore sequence. Typically, this means that the writers should be queried after a requester has completed one of its tasks and generated a VSS event.
When processing a backup, a requester should query a writer following the completion of the following methods. Requesters must call GatherWriterStatus after calling BackupComplete to cause the writer session to be set to a completed state.
Note
This is only necessary on Windows Server 2008 with Service Pack 2 (SP2) and earlier.
IVssBackupComponents::PrepareForBackup
During restore operations, a requester should query a writer after completion of these methods:
- Calls to IVssBackupComponents::GatherWriterStatus that are not part of a well-defined backup or restore sequence do not provide a reliable picture of writer status, because they might reflect conditions that do not indicate failure in the current operation, such as:
- A failure of a previous shadow copy creation
- An error in an early backup or restore operation
- An unresponsive writer currently processing an event
Therefore, developers should not rely on writer status returned by processes other than the requester or attempt to monitor the progress of one instance of the IVssBackupComponents interface with another (possibly in a separate thread).
Note that for backup operations, where it is necessary to examine writers' Writer Metadata Documents, there is no need for a requester call to IVssBackupComponents::GatherWriterStatus and IVssBackupComponents::GetWriterStatus following the generation and handling of the Identify event caused by IVssBackupComponents::GatherWriterMetdata.
IVssBackupComponents::GetWriterStatus reports only the status of those writers whose metadata was provided to VSS by writers' Identify event handlers, CVssWriter::OnIdentify (and returned to the requester by IVssBackupComponents::GetWriterMetadataCount and IVssBackupComponents::GetWriterMetadata).
If a writer's implementation of CVssWriter::OnIdentify fails, that writer's metadata will not be part of the list of Writer Metadata Documents provided to VSS, no status information will be available, and the call would be redundant.
For restore operations, where the requester does not need to examine Writer Metadata Documents of executing writers, calling IVssBackupComponents::GatherWriterStatus and IVssBackupComponents::GetWriterStatus may be a more efficient way to determine which writers are executing.