Transaction Isolation Level is ignored
Posted: Tue 19 Apr 2016 23:31
I've noticed that when using transactions with dotConnect, the isolation level on my TransactionScope is being ignored. I'm using Devart DotConnect MySQL version 8.4.616.0; here's some sample code:
When I run this function using dotConnect, I see this output:
When I run the same function using MySQL's Connector/Net, I see this output:
This is related to my other post on deadlocks; we're trying to control the isolation level of things that do not need strict concurrency, but it appears that dotConnect is ignoring us.
Any ideas?
Code: Select all
public static void PrintIsolationLevel(string connectionString)
{
using (var scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions{IsolationLevel = IsolationLevel.ReadUncommitted}))
using (var connection = new MySqlConnection(connectionString))
{
connection.Open();
using (var command = connection.CreateCommand())
{
command.CommandText = "SHOW VARIABLES LIKE 'tx_isolation';";
using (var reader = command.ExecuteReader())
{
while (reader.Read())
{
var level = reader.GetString(1);
Console.WriteLine("TransactionScope Isolation level {0}",Transaction.Current.IsolationLevel);
Console.WriteLine("Database isolation level {0}", level);
}
}
}
}
}
Code: Select all
TransactionScope Isolation level ReadUncommitted
Database isolation level REPEATABLE-READ
Code: Select all
TransactionScope Isolation level ReadUncommitted
Database isolation level READ-UNCOMMITTED
Any ideas?