NServiceBus icon indicating copy to clipboard operation
NServiceBus copied to clipboard

Should transaction isolation level be an explicit choice?

Open ramonsmits opened this issue 3 years ago • 2 comments

At the moment the default transaction isolation level is implicitly set to Read Committed for Core. This is also documented: https://docs.particular.net/transports/transactions#controlling-transaction-scope-options-isolation-level

However, that conflicts with the default for TransactionScope which is Serializable. Customers running with defaults might thus assume Serializable.

Recently SQLP: Unexpected Serializable isolation level when using the outbox with UseTransactionScope while ReadCommitted is the default everywhere else was discovered. The cause was that during https://github.com/Particular/NServiceBus.Persistence.Sql/pull/586 likely this same assumption was made that the default would be Serializable.

Some options:

  1. Always make transaction isolation level an explicit choice
  2. Align the default transaction isolation level with .net defaults
  3. Have downstreams inherit the transaction isolation level that core has selected (default or explicit)

ramonsmits avatar Jun 01 '21 08:06 ramonsmits

In v8, the new seam leaves the decision about the default to the transport: https://docs.particular.net/transports/transactions?version=core_8

tmasternak avatar Jun 01 '21 10:06 tmasternak

@tmasternak I think you wanted to link to https://docs.particular.net/transports/transactions?version=core_8#controlling-transaction-scope-options ?

Then replace core with transport and the same problem remains.

ramonsmits avatar Jun 02 '21 15:06 ramonsmits