Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
- Supported in ADO.NET GetSchema(Async). CollectionNames:
* Tables
* TablesWithCollections
* DataSourceInformation
* MetaDataCollections
* Restrictions
- Rename field _onStatus -> _onNotSuccessStatus in YdbDataReader
- If session is not active, do not invoke DeleteNotActiveSession(session)
- AttachStream: connect stream using NodeId
- PoolManager: change pool properties on field
- Delete *Settings.DefaultInstance because it's a singleton object that's changed by tasks when NodeId is set
- DbConnection.Session.OnStatus(status) in YdbTransaction

## v0.9.4
- Do not pessimize the node on Grpc.Core.StatusCode.Cancelled and Grpc.Core.StatusCode.DeadlineExceeded.
- Dispose of WriterSession using dispose CancellationToken.
Expand Down
3 changes: 1 addition & 2 deletions src/Ydb.Sdk/src/Ado/PoolManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ namespace Ydb.Sdk.Ado;
internal static class PoolManager
{
private static readonly SemaphoreSlim SemaphoreSlim = new(1); // async mutex

private static ConcurrentDictionary<string, SessionPool> Pools { get; } = new();
private static readonly ConcurrentDictionary<string, SessionPool> Pools = new();

internal static async Task<Session> GetSession(YdbConnectionStringBuilder connectionString)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Ydb.Sdk/src/Ado/YdbCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ protected override async Task<DbDataReader> ExecuteDbDataReaderAsync(CommandBeha

var execSettings = CommandTimeout > 0
? new ExecuteQuerySettings { TransportTimeout = TimeSpan.FromSeconds(CommandTimeout) }
: ExecuteQuerySettings.DefaultInstance;
: new ExecuteQuerySettings();

var ydbDataReader = await YdbDataReader.CreateYdbDataReader(YdbConnection.Session.ExecuteQuery(
preparedSql.ToString(), ydbParameters, execSettings, Transaction?.TransactionControl),
Expand Down
33 changes: 33 additions & 0 deletions src/Ydb.Sdk/src/Ado/YdbConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,39 @@ protected override YdbCommand CreateDbCommand()
return CreateDbCommand();
}

public override DataTable GetSchema()
{
return GetSchemaAsync().GetAwaiter().GetResult();
}

public override DataTable GetSchema(string collectionName)
{
return GetSchemaAsync(collectionName).GetAwaiter().GetResult();
}

public override DataTable GetSchema(string collectionName, string?[] restrictionValues)
{
return GetSchemaAsync(collectionName, restrictionValues).GetAwaiter().GetResult();
}

public override Task<DataTable> GetSchemaAsync(CancellationToken cancellationToken = default)
{
return GetSchemaAsync("MetaDataCollections", cancellationToken);
}

public override Task<DataTable> GetSchemaAsync(string collectionName, CancellationToken cancellationToken = default)
{
return GetSchemaAsync(collectionName, new string[4], cancellationToken);
}

public override Task<DataTable> GetSchemaAsync(
string collectionName,
string?[] restrictionValues,
CancellationToken cancellationToken = default)
{
return YdbSchema.GetSchemaAsync(this, collectionName, restrictionValues, cancellationToken);
}

internal void EnsureConnectionOpen()
{
if (ConnectionState == ConnectionState.Closed)
Expand Down
10 changes: 5 additions & 5 deletions src/Ydb.Sdk/src/Ado/YdbDataReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public sealed class YdbDataReader : DbDataReader, IAsyncEnumerable<YdbDataRecord
private readonly IAsyncEnumerator<ExecuteQueryResponsePart> _stream;
private readonly YdbTransaction? _ydbTransaction;
private readonly RepeatedField<IssueMessage> _issueMessagesInStream = new();
private readonly Action<Status> _onStatus;
private readonly Action<Status> _onNotSuccessStatus;

private int _currentRowIndex = -1;
private long _resultSetIndex = -1;
Expand Down Expand Up @@ -51,11 +51,11 @@ private interface IMetadata

private YdbDataReader(
IAsyncEnumerator<ExecuteQueryResponsePart> resultSetStream,
Action<Status> onStatus,
Action<Status> onNotSuccessStatus,
YdbTransaction? ydbTransaction)
{
_stream = resultSetStream;
_onStatus = onStatus;
_onNotSuccessStatus = onNotSuccessStatus;
_ydbTransaction = ydbTransaction;
}

Expand Down Expand Up @@ -489,7 +489,7 @@ private async Task<State> NextExecPart()

var status = Status.FromProto(part.Status, _issueMessagesInStream);

_onStatus(status);
_onNotSuccessStatus(status);

throw new YdbException(status);
}
Expand All @@ -515,7 +515,7 @@ private async Task<State> NextExecPart()
{
OnFailReadStream();

_onStatus(e.Status);
_onNotSuccessStatus(e.Status);

throw new YdbException(e.Status);
}
Expand Down
Loading
Loading