Now it seems that transaction is always committed after second query, even without calling .Commit() in TxControl.Tx(..) in second query.
Expected behavior:
I can do multiple (more than two) queries in one transaction using TxControl.
Steps to reproduce:
Add an intermediate query to this example. Like this:
var execResponse = await Client.SessionExec(async session =>
{
var query1 = "<some_query>";
// Execute first query (no transaction commit)
var response = await session.ExecuteDataQuery(
query: query1,
txControl: TxControl.BeginSerializableRW(),
parameters: new Dictionary<string, YdbValue>()
);
if (!response.Status.IsSuccess || response.Tx is null)
{
return response;
}
var query2 = "<some_query>";
// Execute second query (no transaction commit)
response = await session.ExecuteDataQuery(
query: query2,
TxControl.Tx(response.Tx),
parameters: new Dictionary<string, YdbValue>()
);
# here transaction is committed and response.Tx is null
if (!response.Status.IsSuccess || response.Tx is null)
{
return response;
}
var query3 = "<some_query>";
// Execute third query and commit transaction
response = await session.ExecuteDataQuery(
query: query3,
TxControl.Tx(response.Tx).Commit(),
parameters: new Dictionary<string, YdbValue>()
);
return response;
});
execResponse.Status.EnsureSuccess();
Remark: I use TableClient here. I tried to use QueryClient, but it doesn't work for me too. There was some error about endpoints (not related to this issue and transactions).
Bug Report
YDB dotnet SDK version: 0.2.0
Environment: Yandex Cloud Function, dotnet8
Current behavior:
Firstly, I faced the problem with logger. See https://github.com/ydb-platform/ydb-dotnet-sdk/blob/main/src/Ydb.Sdk/src/Services/Table/ExecuteDataQuery.cs#L68 and https://github.com/ydb-platform/ydb-dotnet-sdk/blob/main/src/Ydb.Sdk/src/Services/Table/Transaction.cs#L121.
logger.LogTrace($"Using tx #{_txNum}");
throwsArgumentNullException
. I fixed this and published new package, but it still doesn't work.Now it seems that transaction is always committed after second query, even without calling
.Commit()
inTxControl.Tx(..)
in second query.Expected behavior:
I can do multiple (more than two) queries in one transaction using
TxControl
.Steps to reproduce:
Add an intermediate query to this example. Like this:
Remark: I use
TableClient
here. I tried to useQueryClient
, but it doesn't work for me too. There was some error about endpoints (not related to this issue and transactions).