FCB_REPLICA_WRITE

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

(Back to main page…)

Description:

This wait type is when a thread is waiting for a synchronous write into a database snapshot by the buffer pool. This can occur in two ways:

  1. Just before the page in the snapshot source database is going to be changed for the first time after the snapshot was created (the ‘push’ case in the Books Online description below)
  2. When a page from the snapshot source database needs to be changed in the snapshot as part of running crash recovery into the snapshot when it is first created (the ‘pull’ case in the Books Online description below)

(Books Online description: “Occurs when the pushing or pulling of a page to a snapshot (or a temporary snapshot created by DBCC) sparse file is synchronized.”)

Questions/comments on this wait type? 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 wait_type value:

The map_key value in sys.dm_xe_map_values is 175 in 2008 and 2008 R2, and 179 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 wait type be a noticeable contention point.

However, I can imagine a case where there are many database snapshots for a single source database, and lots of updates happening, that would cause a lot of these waits to happen and slow down the updates on the source database, as a pre-change page image must be synchronously pushed to all existing and relevant snapshots before the page can be changed in the source database. In that case, the solution would be to not have so many database snapshots on such a volatile source database.

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

  1. Pushing a page into a snapshot (in this case, while inserting a record into an index page)
  2. Pulling a page into a snapshot (in this case, as part of running crash recovery during the creation phase of a snapshot, where the snapshot is the hidden snapshot created by DBCC CHECKDB)
  3. Pushing a page into a snapshot (in this case, while modifying bits in a differential bitmap during the initial checkpoint performed by a data backup)

And many other similar call stacks.

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

  1. SOS_Task::PostWait+9e
    EventInternal<SuspendQueueSLock>::Wait+1fb
    FCBReplicaSync::StartWrite+18f
    FCB::CopyPageToReplicas+212
    BUF::CopyOnWrite+60
    BPool::PrepareToDirty+180
    PageRef::InsertRows+24f
    IndexPageRef::Insert+502
    InsertRecordOnPage+61b
    IndexDataSetSession::InsertSmallRecord+10ca
    IndexDataSetSession::InsertRowInternal+2de1
    DatasetSession::InsertRow+163
    RowsetNewSS::InsertRow+26
    CValRowMult::SetDataX+357
    sqlTsEs.dll!CEsExec::GeneralEval+1a9
    CQScanUpdateNew::GetRow+43d
    CQueryScan::GetRow+81
    CXStmtQuery::ErsqExecuteQuery+36d
    CXStmtDML::XretDMLExecute+31c
    CXStmtDML::XretExecute+ad
    CMsqlExecContext::ExecuteStmts<1,1>+427
    CMsqlExecContext::FExecute+a43
  2. SOS_Task::PostWait+9e
    EventInternal<SuspendQueueSLock>::Wait+1fb
    FCBReplicaSync::StartWrite+18f
    FCB::PullPageToReplica+35
    FCB::CopyPageToReplicas+12c
    BUF::CopyOnWrite+60
    BPool::PrepareToDirty+180
    RecoveryMgr::RedoPageOperation+c44
    RecoveryMgr::RedoLogRecord+68b
    RecoveryMgr::RedoPass+7c6
    RecoveryMgr::PhysicalRedo+5ec
    RecoveryUnit::PhysicalRecovery+341
    StartupCoordinator::NotifyPhaseStart+3a
    DBTABLE::ReplicaCreateStartup+26d
    DBMgr::SyncAndLinkReplicaRecoveryPhase+787
    DBMgr::CreatePhasedTransientReplica+4e1
    DBMgr::CreateTransientReplica+116
    DBDDLAgent::CreateReplica+183
    UtilDbccCreateReplica+7a
    UtilDbccCheckDatabase+9a2
    DbccCheckDB+23f
    DbccCommand::Execute+153
  3. SOS_Task::PostWait+9e
    EventInternal<SuspendQueueSLock>::Wait+1fb
    FCBReplicaSync::StartWrite+18f
    FCB::CopyPageToReplicas+212
    BUF::CopyOnWrite+60
    BPool::PrepareToDirty+180
    PageRef::ModifyBitsNonTransactional+1c2
    PageRef::SetDiffMapChangeBit+1ba
    PageRef::FlushDeltaCountsNonTransactionally+f6
    BTreeRow::UpdateCountsNonTransactional+14a
    FlushHoBtsDeltaCounts+d9c
    PageAndRowCountFlush::FlushAllocInfoNonTransactionally+559
    VisibleHoBt::FlushDeltaCountsNonTransactionally+fc
    VisibleHoBt::FlushDeltaCountsForCheckpoint+ec
    HoBtFactory::FlushDeltaCounts+176
    CheckpointRU2+31a
    AsynchronousDiskAction::DoFlushCache+98
    AsynchronousDiskAction::ExecuteDeferredAction+246
    AsynchronousDiskPool::PerformActionsSerially+61
    AsynchronousDiskPool::WaitUntilDoneOrTimeout+71
    CheckpointDB2+2eb
    BackupDatabaseOperation::PerformDataCopySteps+c2