Skip to content

Commit d51052b

Browse files
Update CHANGELOG.md
1 parent 45731e6 commit d51052b

File tree

5 files changed

+479
-468
lines changed

5 files changed

+479
-468
lines changed

src/Ydb.Sdk/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
- Feat ADO.NET: Mark `YdbConnection.State` as `Broken` when the underlying session is broken, including background deactivation.
12
- Feat ADO.NET: Added YdbDataSource `ExecuteAsync` and `ExecuteInTransaction` convenience methods.
23
- **Breaking Change**: moved and renamed `Ydb.Sdk.Services.Query.TxMode` -> `Ydb.Sdk.Ado.TransactionMode`.
3-
- Feat ADO.NET: cache gRPC transport by `gRPCConnectionString` to reuse channels.
4+
- Feat ADO.NET: Cache gRPC transport by `gRPCConnectionString` to reuse channels.
45
- Fix bug wrap-around ADO.NET: Big parameterized Decimal — `((ulong)bits[1] << 32)` -> `((ulong)(uint)bits[1] << 32)`.
56
- Feat ADO.NET: Parameterized Decimal overflow check: `Precision` and `Scale`.
67
- Feat ADO.NET: Deleted support for `DateTimeOffset` was a mistake.

src/Ydb.Sdk/src/Ado/YdbConnection.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ public override async Task CloseAsync()
109109
return;
110110
case ConnectionState.Broken:
111111
ConnectionState = ConnectionState.Closed;
112+
_session.Close();
112113
return;
113114
default:
114115
try

src/Ydb.Sdk/src/IDriver.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,14 +210,14 @@ protected async ValueTask<CallOptions> GetCallOptions(GrpcRequestSettings settin
210210
}
211211

212212
public ILoggerFactory LoggerFactory { get; }
213-
public void RegisterOwner() => Interlocked.Increment(ref _ownerCount);
213+
public void RegisterOwner() => ++_ownerCount;
214214
public bool IsDisposed => Disposed == 1;
215215

216216
public void Dispose() => DisposeAsync().AsTask().GetAwaiter().GetResult();
217217

218218
public async ValueTask DisposeAsync()
219219
{
220-
if (Interlocked.Decrement(ref _ownerCount) <= 0 && Interlocked.CompareExchange(ref Disposed, 1, 0) == 0)
220+
if (--_ownerCount <= 0 && Interlocked.CompareExchange(ref Disposed, 1, 0) == 0)
221221
{
222222
await ChannelPool.DisposeAsync();
223223

src/Ydb.Sdk/test/Ydb.Sdk.Ado.Tests/PoolManagerTests.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
using System.Collections.Immutable;
22
using Xunit;
3+
using Xunit.Abstractions;
34

45
namespace Ydb.Sdk.Ado.Tests;
56

67
[Collection("PoolManagerTests")]
78
[CollectionDefinition("PoolManagerTests", DisableParallelization = true)]
89
public class PoolManagerTests
910
{
11+
private readonly ITestOutputHelper _testOutputHelper;
12+
13+
public PoolManagerTests(ITestOutputHelper testOutputHelper)
14+
{
15+
_testOutputHelper = testOutputHelper;
16+
}
17+
1018
[Theory]
1119
[InlineData(new[]
1220
{
@@ -55,16 +63,17 @@ public async Task PoolManager_CachingAndCleanup(string[] connectionStrings, int
5563
await ClearAllConnections(connections);
5664
}
5765

58-
private static async Task ClearAllConnections(IReadOnlyCollection<YdbConnection> connections)
66+
private async Task ClearAllConnections(IReadOnlyCollection<YdbConnection> connections)
5967
{
6068
foreach (var connection in connections)
6169
await connection.CloseAsync();
6270

6371
await YdbConnection.ClearAllPools();
6472
Assert.Empty(PoolManager.Pools);
6573

66-
foreach (var (_, driver) in PoolManager.Drivers)
74+
foreach (var (str, driver) in PoolManager.Drivers)
6775
{
76+
_testOutputHelper.WriteLine(str);
6877
Assert.True(driver.IsDisposed);
6978
}
7079
}

0 commit comments

Comments
 (0)