Skip to content

Commit 8b20c56

Browse files
feat: fix bug on commit with RPC fail, no set failed flag for rollback invocation.
1 parent c357731 commit 8b20c56

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

src/Ydb.Sdk/src/Ado/YdbTransaction.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,15 @@ private async Task FinishTransaction(Func<string, Task<Status>> finishMethod)
9696

9797
if (status.IsNotSuccess)
9898
{
99+
Failed = true;
100+
99101
throw new YdbException(status);
100102
}
101103
}
102104
catch (Driver.TransportException e)
103105
{
106+
Failed = true;
107+
104108
throw new YdbException(e.Status);
105109
}
106110
}

src/Ydb.Sdk/src/Services/Query/SessionPool.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ protected override async Task<Session> CreateSession()
9494
{
9595
session.IsActive = false;
9696

97-
Logger.LogTrace("Attached stream is closed");
97+
Logger.LogTrace("Session[{SessionId}]: Attached stream is closed", session.SessionId);
9898
}
9999
});
100100

src/Ydb.Sdk/tests/Ado/YdbExceptionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public async Task IsTransient_WhenAborted_ReturnTrueAndMakeEmptyRollback()
5959
Assert.Equal("This YdbTransaction has completed; it is no longer usable",
6060
Assert.Throws<InvalidOperationException>(() => ydbCommand.Transaction.Commit()).Message);
6161

62-
await ydbCommand.Transaction!.RollbackAsync();
62+
await ydbCommand.Transaction.RollbackAsync();
6363
Assert.Equal("This YdbTransaction has completed; it is no longer usable",
6464
Assert.Throws<InvalidOperationException>(() => ydbCommand.Transaction!.Commit()).Message);
6565
Assert.Equal("This YdbTransaction has completed; it is no longer usable",

0 commit comments

Comments
 (0)