Closed
Description
Discussion summary: Revert change in #774 and use Pipelining = false
for databases that don't support a single payload. This will reduce the round-trips from 2 to 1 when starting a transaction.
private async ValueTask<MySqlTransaction> **BeginTransactionAsync**(IsolationLevel isolationLevel, bool? isReadOnly, IOBehavior ioBehavior, CancellationToken cancellationToken)
{
using (var cmd = new MySqlCommand($"set session transaction isolation level {isolationLevelValue};", this) { NoActivity = true })
{
await cmd.ExecuteNonQueryAsync(ioBehavior, cancellationToken).ConfigureAwait(false);
var consistentSnapshotText = isolationLevel == IsolationLevel.Snapshot ? " with consistent snapshot" : "";
var readOnlyText = isReadOnly switch
{
true => " read only",
false => " read write",
null => "",
};
var separatorText = (consistentSnapshotText.Length == 0 || readOnlyText.Length == 0) ? "" : ",";
cmd.CommandText = $"start transaction{consistentSnapshotText}{separatorText}{readOnlyText};";
await cmd.ExecuteNonQueryAsync(ioBehavior, cancellationToken).ConfigureAwait(false);
}
var transaction = new MySqlTransaction(this, isolationLevel);
CurrentTransaction = transaction;
return transaction;
}
Can't the default level of the database be used?
This class seems to be one more database operation.