SPRNET-1444 - revert commits on this issue to return DefaultIsolationLevel for tx advice from Unspecified back to ReadCommitted

This commit is contained in:
Steve Bohlen
2015-03-21 14:52:05 -04:00
parent 1c562f8fe6
commit 829d04f786
12 changed files with 36 additions and 39 deletions

View File

@@ -1,14 +1,11 @@
Changes (1.3.2 to 2.0)
========================
1. Default transaction isolation level is now IsolationLevel.Unspecified instead of old IsolationLevel.ReadUncommitted
- You need to update your configuration to set the isolation level where old ReadUncommitted was expected, see Spring documentation's Transaction Management chapter
2. Protected fields were changed to private. Access is now allowed via public/protected property member.
1. Protected fields were changed to private. Access is now allowed via public/protected property member.
3. Most of members marked as Obsolete before 2.0 release were removed.
2. Most of members marked as Obsolete before 2.0 release were removed.
4. DbProvider automatically sets BindByName to true for Oracle's ODP.NET OracleCommand instances when created
3. DbProvider automatically sets BindByName to true for Oracle's ODP.NET OracleCommand instances when created
Changes (1.3.1 to 1.3.2)
========================

View File

@@ -1068,7 +1068,7 @@ mgr.DeleteTwoTestObjects("Jack", "Jill");
<entry>No</entry>
<entry>Unspecified</entry>
<entry>ReadCommitted</entry>
<entry>The transaction isolation level</entry>
</row>
@@ -1162,7 +1162,7 @@ mgr.DeleteTwoTestObjects("Jack", "Jill");
<listitem>
<para>The isolation level is
<literal>IsolationLevel.Unspecified</literal></para>
<literal>IsolationLevel.ReadCommitted</literal></para>
</listitem>
<listitem>

View File

@@ -68,7 +68,7 @@ namespace Spring.Transaction.Support
//TODO Refactoring to sync with Spring 2.0 for nt/enums for various default values.
private TransactionPropagation _transactionPropagation = TransactionPropagation.Required;
private IsolationLevel _transactionIsolationLevel = IsolationLevel.Unspecified;
private IsolationLevel _transactionIsolationLevel = IsolationLevel.ReadCommitted;
private int _timeout = DefaultTransactionDefinition.TIMEOUT_DEFAULT;
private bool _readOnly = false;
private string _name = null;

View File

@@ -169,7 +169,7 @@ namespace Spring.Messaging.Ems.Connections
protected override void DoBegin(object transaction, ITransactionDefinition definition)
{
//This is the default value defined in DefaultTransactionDefinition
if (definition.TransactionIsolationLevel != IsolationLevel.Unspecified)
if (definition.TransactionIsolationLevel != IsolationLevel.ReadCommitted)
{
throw new InvalidIsolationLevelException("EMS does not support an isoliation level concept");
}

View File

@@ -186,7 +186,7 @@ namespace Spring.Messaging.Nms.Connections
protected override void DoBegin(object transaction, ITransactionDefinition definition)
{
//This is the default value defined in DefaultTransactionDefinition
if (definition.TransactionIsolationLevel != IsolationLevel.Unspecified)
if (definition.TransactionIsolationLevel != IsolationLevel.ReadCommitted)
{
throw new InvalidIsolationLevelException("NMS does not support an isoliation level concept");
}

View File

@@ -45,7 +45,7 @@ namespace Spring.Data
public class AdoPlatformTransactionManagerTests
{
private MockRepository mocks;
private IsolationLevel _defaultIsolationLevel = IsolationLevel.Unspecified;
private const IsolationLevel DefaultIsolationLevel = IsolationLevel.ReadCommitted;
[SetUp]
public void Setup()
@@ -75,7 +75,7 @@ namespace Spring.Data
Expect.Call(dbProvider.CreateConnection()).Return(connection);
connection.Open();
LastCall.On(connection).Repeat.Once();
Expect.Call(connection.BeginTransaction(_defaultIsolationLevel)).Return(transaction);
Expect.Call(connection.BeginTransaction(DefaultIsolationLevel)).Return(transaction);
//standard tx timeout.
transaction.Commit();
LastCall.On(transaction).Repeat.Once();
@@ -116,7 +116,7 @@ namespace Spring.Data
Expect.Call(dbProvider.CreateConnection()).Return(connection);
connection.Open();
LastCall.On(connection).Repeat.Once();
Expect.Call(connection.BeginTransaction(_defaultIsolationLevel)).Return(transaction);
Expect.Call(connection.BeginTransaction(DefaultIsolationLevel)).Return(transaction);
//standard tx timeout.
transaction.Rollback();
LastCall.On(transaction).Repeat.Once();
@@ -166,7 +166,7 @@ namespace Spring.Data
Expect.Call(dbProvider.CreateConnection()).Return(connection);
connection.Open();
LastCall.On(connection).Repeat.Once();
Expect.Call(connection.BeginTransaction(_defaultIsolationLevel)).Return(transaction);
Expect.Call(connection.BeginTransaction(DefaultIsolationLevel)).Return(transaction);
//standard tx timeout.
transaction.Rollback();
LastCall.On(transaction).Repeat.Once();
@@ -238,7 +238,7 @@ namespace Spring.Data
Expect.Call(dbProvider.CreateConnection()).Return(connection).Repeat.Twice();
connection.Open();
LastCall.On(connection).Repeat.Twice();
Expect.Call(connection.BeginTransaction(_defaultIsolationLevel)).Return(transaction).Repeat.Twice();
Expect.Call(connection.BeginTransaction(DefaultIsolationLevel)).Return(transaction).Repeat.Twice();
//standard tx timeout.
transaction.Rollback();
LastCall.On(transaction).Repeat.Once();
@@ -280,7 +280,7 @@ namespace Spring.Data
Expect.Call(dbProvider.CreateConnection()).Return(connection);
connection.Open();
LastCall.On(connection).Repeat.Once();
Expect.Call(connection.BeginTransaction(_defaultIsolationLevel)).Return(transaction);
Expect.Call(connection.BeginTransaction(DefaultIsolationLevel)).Return(transaction);
transaction.Commit();
LastCall.On(transaction).Repeat.Once();
connection.Dispose();
@@ -292,7 +292,7 @@ namespace Spring.Data
Expect.Call(dbProvider2.CreateConnection()).Return(connection2);
connection2.Open();
LastCall.On(connection2).Repeat.Once();
Expect.Call(connection2.BeginTransaction(_defaultIsolationLevel)).Return(transaction2);
Expect.Call(connection2.BeginTransaction(DefaultIsolationLevel)).Return(transaction2);
transaction2.Rollback();
LastCall.On(transaction2).Repeat.Once();
connection2.Dispose();
@@ -335,7 +335,7 @@ namespace Spring.Data
Expect.Call(dbProvider.CreateConnection()).Return(connection);
connection.Open();
LastCall.On(connection).Repeat.Once();
Expect.Call(connection.BeginTransaction(_defaultIsolationLevel)).Return(transaction);
Expect.Call(connection.BeginTransaction(DefaultIsolationLevel)).Return(transaction);
transaction.Rollback();
LastCall.On(transaction).Repeat.Once();
connection.Dispose();
@@ -395,7 +395,7 @@ namespace Spring.Data
Expect.Call(dbProvider.CreateConnection()).Return(connection);
connection.Open();
LastCall.On(connection).Repeat.Once();
Expect.Call(connection.BeginTransaction(_defaultIsolationLevel)).Return(transaction);
Expect.Call(connection.BeginTransaction(DefaultIsolationLevel)).Return(transaction);
//standard tx timeout.
transaction.Commit();
LastCall.On(transaction).Repeat.Once();
@@ -431,7 +431,7 @@ namespace Spring.Data
Expect.Call(dbProvider.CreateConnection()).Return(connection);
connection.Open();
LastCall.On(connection).Repeat.Once();
Expect.Call(connection.BeginTransaction(_defaultIsolationLevel)).Return(transaction);
Expect.Call(connection.BeginTransaction(DefaultIsolationLevel)).Return(transaction);
//standard tx timeout.
transaction.Rollback();
LastCall.On(transaction).Repeat.Once();
@@ -482,7 +482,7 @@ namespace Spring.Data
Expect.Call(dbProvider.CreateConnection()).Return(connection2);
connection2.Open();
LastCall.On(connection2).Repeat.Once();
Expect.Call(connection2.BeginTransaction(_defaultIsolationLevel)).Return(transaction2);
Expect.Call(connection2.BeginTransaction(DefaultIsolationLevel)).Return(transaction2);
transaction2.Commit();
LastCall.On(transaction2).Repeat.Once();
connection2.Dispose();
@@ -573,7 +573,7 @@ namespace Spring.Data
connection.Open();
LastCall.On(connection).Repeat.Once();
Expect.Call(connection.BeginTransaction(_defaultIsolationLevel)).Return(transaction);
Expect.Call(connection.BeginTransaction(DefaultIsolationLevel)).Return(transaction);
Expect.Call(connection.CreateCommand()).Return(command);
command.CommandText = "some SQL statement";
LastCall.On(command).Repeat.Once();
@@ -674,7 +674,7 @@ namespace Spring.Data
Expect.Call(dbProvider.CreateConnection()).Return(connection);
connection.Open();
LastCall.On(connection).Repeat.Once();
Expect.Call(connection.BeginTransaction(_defaultIsolationLevel)).Return(transaction);
Expect.Call(connection.BeginTransaction(DefaultIsolationLevel)).Return(transaction);
//standard tx timeout.
transaction.Commit();
LastCall.On(transaction).Throw(new TestSqlException("Cannot commit", "314"));
@@ -717,7 +717,7 @@ namespace Spring.Data
Expect.Call(dbProvider.CreateConnection()).Return(connection);
connection.Open();
LastCall.On(connection).Repeat.Once();
Expect.Call(connection.BeginTransaction(_defaultIsolationLevel)).Return(transaction);
Expect.Call(connection.BeginTransaction(DefaultIsolationLevel)).Return(transaction);
transaction.Commit();
LastCall.On(transaction).Throw(new TestSqlException("Cannot commit", "314"));
@@ -763,7 +763,7 @@ namespace Spring.Data
Expect.Call(dbProvider.CreateConnection()).Return(connection);
connection.Open();
LastCall.On(connection).Repeat.Once();
Expect.Call(connection.BeginTransaction(_defaultIsolationLevel)).Return(transaction);
Expect.Call(connection.BeginTransaction(DefaultIsolationLevel)).Return(transaction);
//standard tx timeout.
transaction.Rollback();
LastCall.On(transaction).Throw(new TestSqlException("Cannot commit", "314"));
@@ -877,7 +877,7 @@ namespace Spring.Data
Expect.Call(dbProvider.CreateConnection()).Return(connection);
connection.Open();
LastCall.On(connection).Repeat.Once();
Expect.Call(connection.BeginTransaction(_defaultIsolationLevel)).Return(transaction);
Expect.Call(connection.BeginTransaction(DefaultIsolationLevel)).Return(transaction);
transaction.Rollback();
LastCall.On(transaction).Repeat.Once();
@@ -923,7 +923,7 @@ namespace Spring.Data
Expect.Call(dbProvider.CreateConnection()).Return(connection);
connection.Open();
LastCall.On(connection).Repeat.Once();
Expect.Call(connection.BeginTransaction(_defaultIsolationLevel)).Return(transaction);
Expect.Call(connection.BeginTransaction(DefaultIsolationLevel)).Return(transaction);
//standard tx timeout.
transaction.Commit();
LastCall.On(transaction).Repeat.Once();
@@ -971,7 +971,7 @@ namespace Spring.Data
Expect.Call(dbProvider.CreateConnection()).Return(connection);
connection.Open();
LastCall.On(connection).Repeat.Once();
Expect.Call(connection.BeginTransaction(_defaultIsolationLevel)).Return(transaction);
Expect.Call(connection.BeginTransaction(DefaultIsolationLevel)).Return(transaction);
transaction.Rollback();
LastCall.On(transaction).Repeat.Once();
connection.Dispose();

View File

@@ -159,7 +159,7 @@ namespace Spring.Data.Core
// inner tx
ConfigureServiceConfig(serviceConfig, false);
serviceConfig.TransactionOption = TransactionOption.RequiresNew;
serviceConfig.IsolationLevel = TransactionIsolationLevel.Any;
serviceConfig.IsolationLevel = TransactionIsolationLevel.ReadCommitted;
txAdapter.Enter(serviceConfig);
Expect.Call(txAdapter.IsInTransaction).Return(true);
txAdapter.SetAbort();
@@ -204,7 +204,7 @@ namespace Spring.Data.Core
if (standardIsolationAndProp)
{
serviceConfig.TransactionOption = TransactionOption.Required;
serviceConfig.IsolationLevel = TransactionIsolationLevel.Any;
serviceConfig.IsolationLevel = TransactionIsolationLevel.ReadCommitted;
}
return serviceConfig;

View File

@@ -57,7 +57,7 @@ namespace Spring.Data.Core
{
Expect.Call(txAdapter.IsExistingTransaction).Return(false);
TransactionOptions txOptions = new TransactionOptions();
txOptions.IsolationLevel = IsolationLevel.Unspecified;
txOptions.IsolationLevel = IsolationLevel.ReadCommitted;
txAdapter.CreateTransactionScope(TransactionScopeOption.Required, txOptions, EnterpriseServicesInteropOption.None);
Expect.Call(txAdapter.RollbackOnly).Return(false);
@@ -94,7 +94,7 @@ namespace Spring.Data.Core
{
Expect.Call(txAdapter.IsExistingTransaction).Return(false);
TransactionOptions txOptions = new TransactionOptions();
txOptions.IsolationLevel = IsolationLevel.Unspecified;
txOptions.IsolationLevel = IsolationLevel.ReadCommitted;
txAdapter.CreateTransactionScope(TransactionScopeOption.Required, txOptions, EnterpriseServicesInteropOption.None);
txAdapter.Dispose();
}
@@ -141,7 +141,7 @@ namespace Spring.Data.Core
{
Expect.Call(txAdapter.IsExistingTransaction).Return(false);
TransactionOptions txOptions = new TransactionOptions();
txOptions.IsolationLevel = IsolationLevel.Unspecified;
txOptions.IsolationLevel = IsolationLevel.ReadCommitted;
txAdapter.CreateTransactionScope(TransactionScopeOption.RequiresNew, txOptions, EnterpriseServicesInteropOption.None);
//inner tx actions

View File

@@ -18,7 +18,7 @@ namespace Spring.Transaction.Interceptor
public void ToStringTests()
{
DefaultTransactionAttribute dta = new DefaultTransactionAttribute();
Assert.AreEqual( "PROPAGATION_Required,ISOLATION_Unspecified,-System.Exception", dta.ToString());
Assert.AreEqual( "PROPAGATION_Required,ISOLATION_ReadCommitted,-System.Exception", dta.ToString());
}
}
}

View File

@@ -34,7 +34,7 @@ namespace Spring.Transaction.Interceptor
ITransactionAttribute ta = editor.Value;
Assert.IsTrue( ta != null );
Assert.IsTrue( ta.PropagationBehavior == TransactionPropagation.Required );
Assert.IsTrue( ta.TransactionIsolationLevel == IsolationLevel.Unspecified );
Assert.IsTrue( ta.TransactionIsolationLevel == IsolationLevel.ReadCommitted );
Assert.IsFalse( ta.ReadOnly );
}

View File

@@ -59,7 +59,7 @@ namespace Spring.Transaction.Interceptor
{
ITransactionAttribute ta = tas.ReturnTransactionAttribute( method, null );
Assert.IsTrue( ta != null );
Assert.IsTrue( ta.TransactionIsolationLevel == IsolationLevel.Unspecified );
Assert.IsTrue( ta.TransactionIsolationLevel == IsolationLevel.ReadCommitted );
Assert.IsTrue( ta.PropagationBehavior == transactionPropagation);
}
}

View File

@@ -20,7 +20,7 @@ namespace Spring.Transaction.Support
Assert.IsTrue( 1000 == def.TransactionTimeout );
Assert.IsTrue( false == def.ReadOnly );
def.ReadOnly = true;
Assert.IsTrue( true == def.ReadOnly );
Assert.IsTrue( def.ReadOnly );
}
[Test]
public void PropogationBehaviorDefault()
@@ -32,7 +32,7 @@ namespace Spring.Transaction.Support
public void IsolationLevelDefault()
{
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
Assert.IsTrue(def.TransactionIsolationLevel == IsolationLevel.Unspecified);
Assert.IsTrue(def.TransactionIsolationLevel == IsolationLevel.ReadCommitted);
}
[Test]
[ExpectedException(typeof(ArgumentException))]