I'm having problems with SQL Server 2012 filetable.
Filetable defines an check constraint on a path_locator
field with definition as: /*ParentsAreDirectories*/ (filetable_parents_are_directories((1381579960),CONVERT([varbinary](892),[path_locator],0),[is_directory])=(1))
. It seems that this check constraint calls some stored procedure or function, definition of which I was unable to found.
Then, sometimes I'm getting a deadlock on simultaneous INSERT
query into filetable. I think, that deadlock is happens because check constraints of both transactions installs an S
lock to filetable and then both transactions tries to install 'X' lock to insert a new row.
Basically my question is: In which order SQL Server installs locks caused by check constraints: before main query locks, or after?
And additional question - how to force installation of X
lock in my scenario with filetable from very begin of transaction, if my interpretation of deadlock cause is correct?
UPD: deadlock report: https://gist.github.com/Snork2/9a4788dad1bc62736ae8