Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Common Log File System (CLFS) supports archiving for dedicated logs by maintaining an archive tail. When you call ClfsCreateLogFile to create a dedicated log, you can set the FILE_ATTRIBUTE_ARCHIVE flag of the fFlagsAndAttributes parameter to specify that CLFS should maintain an archive tail for the log. A log for which CLFS maintains an archive tail is called a non-ephemeral log.
Suppose you're performing transactions on a database and each transaction has several updates described by log records. After a particular transaction has committed and been written to stable storage, you might not need the log records that describe that transaction anymore. That is, the log records wouldn't be needed during restart recovery if there's a system failure. However, if the stable storage medium that holds the database fails and the database hasn't been recently archived on a different medium, the database updates could be lost.
The preceding paragraph describes archiving database records, but in other scenarios you might want to archive log records. In either case, archiving is the responsibility of the clients (your software). You can keep track of the archiving you've done by setting the log's archive tail. The archive tail is the log sequence number (LSN) of the oldest record for which archiving hasn't yet been completed.
A non-ephemeral log actually has two tails: one marked by the base LSN and one marked by the archive tail. You can position the two tails as you see fit by calling ClfsAdvanceLogBase (or ClfsWriteRestartArea), and ClfsSetArchiveTail. Typically the base LSN points to the oldest record that would still be needed for transaction rollback or restart recovery, and the archive tail points to the oldest record for which archiving hasn't been performed. The archive tail might be less than the base LSN or it might be greater than the base LSN.
The base LSN and the archive tail are important when you call ClfsReadNextLogRecord repeatedly to read a chain of records linked by previous LSNs, undo-next LSNs, or user LSNs. ClfsReadNextLogRecord doesn't read a record whose LSN is less than both the archive tail and the base LSN. It will, however, read a record whose LSN is between the archive tail and the base LSN. For more information about following record chains, see Reading Data Records from a CLFS Stream.