PREEMPTIVE_OS_CREATEDIRECTORY

(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 calling the Windows CreateDirectory function.

(Books Online description: N/A)

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:

2008

Removed in SQL Server version:

N/A

Extended Events wait_type value:

The map_key value in sys.dm_xe_map_values is 445 in 2008 and 2008 R2, 493 in 2012, and 509 in 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.

Note that when a thread calls out to Windows, the thread changes from non-preemptive (SQL Server controls the thread) to preemptive (Windows controls the thread) mode. The thread’s state will be listed as RUNNING, as SQL Server doesn’t know what Windows is doing with the thread.

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

  1. Creating the directory to hold the FILESTREAM log (in this case, as part of creating a database that has a FILESTREAM filegroup)
  2. Creating a per-rowset directory in the FILESTREAM data container (in this case, as part of creating a table that has a FILESTREAM column)
  3. Creating a per-column directory in a per-rowset directory in the FILESTREAM data container (in this case, as part of inserting a row that has FILESTREAM data)

And other similar call stacks.

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

  1. SOS_Task::PopWait+0xb1
    AutoSwitchPreemptive::~AutoSwitchPreemptive+0x95
    FsLogMgr::Init+0x22c
    STREAMFCB::DownLevelInit+0x58
    STREAMFCB::Startup+0x143
    StreamFileMgr::AddStreamFile+0x766
    AttachAllStreamFiles+0xf5
    CStmtCreateDB::CreateLocalDatabaseFragment+0x9dc
    DBDDLAgent::CreateDatabase+0xf7
    CStmtCreateDB::XretExecute+0xdc1
    CMsqlExecContext::ExecuteStmts<1,1>+0x427
    CMsqlExecContext::FExecute+0xa43
    CSQLSource::Execute+0x86c
    process_request+0xa57
    process_commands+0x4a3
    SOS_Task::Param::Execute+0x21e
    SOS_Scheduler::RunTask+0xab
  2. SOS_Task::PopWait+0xb1
    AutoSwitchPreemptive::~AutoSwitchPreemptive+0x95
    FsDoHandler::CreateDirectoryDownLevel+0x755
    FsDoHandler::CreateDirectoryW+0x33
    CFsRowset::AddColumn+0x82
    SECreateRowset+0xe7d
    DDLAgent::SECreateRowsets+0x11d7
    CIndexDDL::CreateRowsets+0xb26
    CIndexDDL::CreateEmptyHeap+0xff
    CTableCreate::CreateRelation+0xa16
    CTableCreate::LCreateImpl+0xef4
    CStmtCreateTable::XretCreateTableExecute+0x506
    CXStmtCreateTableDDL::XretExecute+0x3b
    CMsqlExecContext::ExecuteStmts<1,1>+0x427
    CMsqlExecContext::FExecute+0xa43
    CSQLSource::Execute+0x86c
    process_request+0xa57
    process_commands+0x4a3
    SOS_Task::Param::Execute+0x21e
    SOS_Scheduler::RunTask+0xab
  3. SOS_Task::PopWait+0xb1
    AutoSwitchPreemptive::~AutoSwitchPreemptive+0x95
    StreamFileMgr::CreateDirectoryW+0x154
    StreamFileMgr::CreateDataFile+0x9b
    StreamFileMgr::DoCreateStreamFile+0xe0
    AsynchronousDiskAction::ExecuteDeferredAction+0xbf
    AsynchronousDiskWorker::ThreadRoutine+0x15c
    SubprocEntrypoint+0xa7f
    SOS_Task::Param::Execute+0x21e
    SOS_Scheduler::RunTask+0xab