Skip to content

Commit 0206f3f

Browse files
committed
Rewrite of System.Transactions support
* We previously had quite a complicated setup with a PSPE/durable enlistment, implemented with AppDomains and remoting, but with actually implement any sort of recovery. Reimplemented using a volatile resource manager, vastly simplifying the code. * In the future we'll be implement distributed transaction recovery, at which point a PSPE/durable resource manager would be implemented. See npgsql#1378. * Considerably simplified the scenario where a connection is closed before its transaction completes. Before we put the connection in a "fake closed" mode, we now properly close the connection and return the connector to a special list on the pool. The list is checked when opening a new connection with the same transaction. Based on work and discussions with @omatrot, @amirtuval, @skikiker - thanks! Closes npgsql#122
1 parent 22f2f66 commit 0206f3f

15 files changed

Lines changed: 1746 additions & 1897 deletions

src/Npgsql/GeneratedAsync.cs

Lines changed: 954 additions & 952 deletions
Large diffs are not rendered by default.

src/Npgsql/Npgsql.csproj

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,9 @@
187187
<Compile Include="NpgsqlNotificationEventArgs.cs" />
188188
<Compile Include="NpgsqlParameter.cs" />
189189
<Compile Include="NpgsqlParameterCollection.cs" />
190-
<Compile Include="NpgsqlPromotableSinglePhaseNotification.cs" />
191-
<Compile Include="NpgsqlResourceManager.cs" />
190+
<Compile Include="VolatileResourceManager.cs" />
192191
<Compile Include="NpgsqlSchema.cs" />
193192
<Compile Include="NpgsqlTransaction.cs" />
194-
<Compile Include="NpgsqlTransactionCallbacks.cs" />
195193
<Compile Include="PGUtil.cs" />
196194
<Compile Include="SSPIHandler.cs" />
197195
<Compile Include="..\CommonAssemblyInfo.cs">
@@ -236,4 +234,4 @@
236234
<None Include="project.json" />
237235
</ItemGroup>
238236
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
239-
</Project>
237+
</Project>

src/Npgsql/NpgsqlCommand.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,17 +1179,7 @@ public override void Cancel()
11791179
return;
11801180
}
11811181

1182-
Log.Debug("Cancelling command", connector.Id);
1183-
try
1184-
{
1185-
connector.CancelRequest();
1186-
}
1187-
catch (Exception e)
1188-
{
1189-
var socketException = e.InnerException as SocketException;
1190-
if (socketException == null || socketException.SocketErrorCode != SocketError.ConnectionReset)
1191-
Log.Debug("Exception caught while attempting to cancel command", e, connector.Id);
1192-
}
1182+
connector.CancelRequest();
11931183
}
11941184

11951185
#endregion Cancel

0 commit comments

Comments
 (0)