GeezerVison is showing github.com — SQL Server Isolation Levels
SQL Server Isolation Levels
Fabian Schmied edited this page
Feb 18, 2022
·
4 revisions
Be sure to run NEventStore's MsSqlDialect queries in READ COMMITTED isolation level (which is NEventStore's default).
- With
SERIALIZABLE (possible, e.g., by enabling the EnlistInAmbientTransactions option and either creating serializable TransactionScopes, or not creating any TransactionScopes at all, see also https://github.com/NEventStore/NEventStore/issues/414), the chance of deadlocks under high load is highly increased.
- With
READ COMMITTED SNAPSHOT (this is a database option that NEventStore does not set by default), the GetFrom API and the CommitPollingClient are broken because these APIs rely on blocking behavior while a Commit operation is active. Since READ COMMITTED SNAPSHOT disables the blocking behavior, commits can be skipped when using those APIs. See https://github.com/NEventStore/NEventStore.Persistence.SQL/issues/31 .
- Due to the previous issue, you need to derive from
MsSqlDialect and add WITH (READCOMMITTEDLOCK) table hints if you want to use Azure SQL (because that database always uses the READ COMMITTED SNAPSHOT option).