(Republishing, or using this info in a commercial product/website, is prohibited without permission. All other uses are permitted. If in doubt, please ask.)

BACKUP_OPERATION

(Back to main page…)

Description:

This latch class is when a thread is waiting for access to the data structure within a BackupOperation class, which manages a single backup. The data structure holds information about the backup media, the database being backed up, the backup options, timing and LSN information, and so on.

(Books Online description: “Used for internal data structure synchronization within a backup operation, such as database, log, or file backup.”)

Questions/comments on this latch class? Click here to send Paul an email, especially if you have any information to add to this topic.

Added in SQL Server version:

pre-2005/2005

Removed in SQL Server version:

N/A

Extended Events latch_class value:

Maps to the BACKUP_OPERATION_LOCK map_value in sys.dm_xe_map_values.

The map_key value in sys.dm_xe_map_values is 31 in 2008 and 2008 R2, and 26 in 2012 and 2014 RTM. After 2014 RTM, you must check the DMV to get the latest value as some map_key values have changed in later builds.

Other information:

I have not seen this latch be a noticeable contention point.

See the LATCH_EX wait type for more information about latches in general and how to troubleshoot them.

Known occurrences in SQL Server (list number matches call stack list):

  1. Write the information about the database to the backup
  2. Unknown, but from the call stack, possibly information about the backup file itself? (e.g. size?)
  3. Unknown, but from the call stack, possibly writing out the start of a set of DBLKs (part of the Microsoft Tape Format, which is how backups are stored)
  4. Unknown, but from the call stack, possibly writing out information about the media set that the backup is being written to
  5. Unknown, but from the call stack, possibly looking up how big this backup stream should be

Abbreviated call stacks (list number matches known occurrences list):

  1. XeSqlPkg::latch_suspend_end::Publish+138
    LatchBase::Suspend+16cb
    SQL_FILE_INFO::Write+1c2
    BackupMedium::WriteDescription+1a0
    BackupMedium::WriteLeadingMetadata+145
    BackupStream::ThreadMainRoutine+1da
    BackupThread::ThreadBase+51
    SubprocEntrypoint+a59
    SOS_Task::Param::Execute+21e
    SOS_Scheduler::RunTask+a8
  2. XeSqlPkg::latch_suspend_end::Publish+138
    LatchBase::Suspend+16cb
    SQL_FILE_INFO::Write+1c2
    BackupMedium::WriteDescription+130
    BackupMedium::WriteTrailingMetadata+138
    BackupStream::ThreadMainRoutine+1e7
    BackupThread::ThreadBase+51
    SubprocEntrypoint+a59
    SOS_Task::Param::Execute+21e
    SOS_Scheduler::RunTask+a8
  3. XeSqlPkg::latch_suspend_end::Publish+138
    LatchBase::Suspend+16cb
    BackupOperation::SetOperatorName+13f
    BackupMedium::WriteStartOfSet+145
    BackupStream::ThreadMainRoutine+1c4
    BackupThread::ThreadBase+51
    SubprocEntrypoint+a59
    SOS_Task::Param::Execute+21e
    SOS_Scheduler::RunTask+a8
  4. XeSqlPkg::latch_suspend_end::Publish+138
    LatchBase::Suspend+16cb
    BackupOperation::RecordCatalogMedia+145
    BackupMedium::WriteMbc+ff
    BackupStream::ThreadMainRoutine+228
    BackupThread::ThreadBase+51
    SubprocEntrypoint+a59
    SOS_Task::Param::Execute+21e
    SOS_Scheduler::RunTask+a8
  5. XeSqlPkg::latch_suspend_end::Publish+138
    LatchBase::Suspend+16cb
    BackupStreamSizer::GetAllocation+140
    BackupStream::DoFileBackup+152
    BackupStream::ThreadMainRoutine+123
    BackupThread::ThreadBase+51
    SubprocEntrypoint+a59
    SOS_Task::Param::Execute+21e
    SOS_Scheduler::RunTask+a8