We sometimes get StorageException with the message 'Snapshot isolation transaction failed in database ... because the object accessed by the statement has been modified by a DDL statement'
If I'm correct this is exception comes from a particular type of deadlock that can happen if you use snapshot isolation and rebuild an index when the query is running.
Is it possible to get a more specific exception than Xtensive.Orm.StorageException in that case? An exception inheriting from ReprocessableException or a DeadlockException would be nice, so that it fits in our existing infrastructure for handling deadlocks.
Xtensive.Orm.StorageException occurred
Message=SQL error occured.
SQL error details 'Type: Unknown;'
Query ...
Original message 'Snapshot isolation transaction failed in database '...' because the object accessed by the statement has been modified by a DDL statement in another concurrent transaction since the start of this transaction. It is disallowed because the metadata is not versioned. A concurrent update to metadata can lead to inconsistency if mixed with snapshot isolation.'
Source=Xtensive.Orm
StackTrace:
at Xtensive.Storage.Providers.Sql.Driver.ExecuteReader(Session session, DbCommand command)
at Xtensive.Storage.Providers.Sql.Command.ExecuteReader()
at Xtensive.Storage.Providers.Sql.BatchingCommandProcessor.ExecuteBatch(Int32 numberOfTasks, QueryRequest lastRequest)
at Xtensive.Storage.Providers.Sql.BatchingCommandProcessor.ExecuteRequestsWithReader(QueryRequest request)
at Xtensive.Storage.Providers.Sql.SessionHandler.<Xtensive.Storage.Providers.Sql.IQueryExecutor.ExecuteTupleReader>d__a.MoveNext()
at Xtensive.Storage.Providers.Sql.SqlProvider.<OnEnumerate>d__0.MoveNext()
at Xtensive.Storage.Rse.Providers.ExecutableProvider.<GetEnumerator>d__0.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Xtensive.Storage.Rse.RecordSet.<GetGreedyEnumerator>d__0.MoveNext()
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at Xtensive.Core.EnumerableExtensions.<Batch>d__20`1.MoveNext()
at Xtensive.Core.EnumerableExtensions.<ApplyBeforeAndAfter>d__28`1.MoveNext()
at System.Linq.Enumerable.<SelectManyIterator>d__14`2.MoveNext()
at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
at lambda_method(Closure , Object[] , IEnumerable`1 , Session , Dictionary`2 , ParameterContext )
at Xtensive.Core.DelegateBindExtensions.<>c__DisplayClass1f`6.<Bind>b__1e(T2 arg2, T3 arg3, T4 arg4, T5 arg5)
at Xtensive.Orm.Linq.TranslatedQuery`1.Execute(Session session, ParameterContext parameterContext)
at Xtensive.Orm.Linq.QueryProvider.Execute[TResult](Expression expression)
at System.Linq.Queryable.Any[TSource](IQueryable`1 source)
...
InnerException: System.Data.SqlClient.SqlException
Message=Snapshot isolation transaction failed in database '...' because the object accessed by the statement has been modified by a DDL statement in another concurrent transaction since the start of this transaction. It is disallowed because the metadata is not versioned. A concurrent update to metadata can lead to inconsistency if mixed with snapshot isolation.
Source=.Net SqlClient Data Provider
ErrorCode=-2146232060
Class=16
LineNumber=5
Number=3961
Procedure=""
Server=localhost\SQLEXPRESS2008
State=1
StackTrace:
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.ExecuteReader()
at Xtensive.Storage.Providers.Sql.Driver.ExecuteReader(Session session, DbCommand command)
InnerException:
asked
May 16 '12 at 05:46
olorin
358●87●87●92
Hello olorin, probably this error code is not listed as known that is why generic exception is thrown. We'll investigate that.
Any news on this?