Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

CVssWriter::OnPostSnapshot method

The OnPostSnapshot method is called by a writer following a PostSnapshot event.

OnPostSnapshot is a virtual method. It is implemented by the CVssWriter base class but can be overridden by derived classes.

Syntax


bool OnPostSnapshot(
  [in] IVssWriterComponents *pComponent
);

Parameters

pComponent [in]

A pointer to an IVssWriterComponents object passed in by VSS to provide the method with access to the writer's component information. The value of this parameter may be NULL if the requester does not support components (if CVssWriter::AreComponentsSelected returns false).

Return value

As implemented by the base class, OnPostSnapshot always returns true.

Any other implementation of this method must return true except in the case of a fatal error. If a fatal error occurs, the method must call the CVssWriter::SetWriterFailure method to provide a description of the failure before returning false. If a nonfatal error occurs, the method should still call SetWriterFailure but return true. If the error is caused by a transient problem, the method should specify VSS_E_WRITERERROR_RETRYABLE in the call to SetWriterFailure.

In all cases when a failure occurs, the method should write an event to the event log to report the exact reason for the failure.

Remarks

The default implementation of this method by the CVssWriter base class returns true without performing any other operation.

CVssWriter::OnPostSnapshot is typically used to process any final updates by the writer to the backup components metadata and clean up (such as removing temporary files).

If an incremental or differential backup is being performed, the writer may call IVssComponent::GetPreviousBackupStamp and IVssComponent::SetBackupStamp. For more information, see Writer Role in Backing Up Complex Stores. Another method that can be called at this time is IVssComponent::AddDifferencedFilesByLastModifyTime.

Most of the work needed to return the writer to normal operation (reversing the actions of CVssWriter::OnPrepareSnapshot and CVssWriter::OnFreeze) is typically performed in CVssWriter::OnThaw, not in OnPostSnapshot.

Writers should never throw an exception from this method or any other CVssWriter(Ex)::OnXxx callback method.

If the shadow copy has the VSS_VOLSNAP_ATTR_AUTORECOVER flag set in the context, the writer should perform any recovery required (for example, rolling back any incomplete transactions) so that the component will be usable on a read-only copy for data mining (without adding load to the live server) or restore purposes (for example, to restore selected items from a database).

To retrieve the volume name of the shadow copy of a volume, perform the following steps:

  1. Call the CVssWriter::GetCurrentVolumeCount method to query the number of volumes in the shadow copy set.
  2. Call the CVssWriter::GetCurrentVolumeArray method to enumerate the original names of the volumes in the shadow copy set.
  3. Call the CVssWriter::GetSnapshotDeviceName to retrieve the name of the shadow copy volume.

If this method calls the CVssWriterEx2::GetSessionId, CVssWriter::SetWriterFailure, or CVssWriterEx2::SetWriterFailureEx method, it must do so in the same thread that called this method. For more information, see Writer Event Handling.

Requirements

Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

VsWriter.h (include Vss.h or VsWriter.h)

Library

VssApi.lib

See also

CVssWriter
CVssWriter::GetSnapshotDeviceName
CVssWriter::OnPrepareBackup
CVssWriter::OnPreRestore
CvssWriter::OnThaw
CVssWriter::SetWriterFailure
IVssWriterComponents

 

 

Community Additions

ADD
Show:
© 2015 Microsoft