summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrobot-piglet <[email protected]>2024-06-19 00:00:55 +0300
committerrobot-piglet <[email protected]>2024-06-19 00:08:46 +0300
commit78c2ba1e357d7771ebdd4833170f395d9388a6df (patch)
treef6a9135b1d1c71804eae56b633d7c5336a5cd5ca
parent3feae57cff571fa304e22c45521f5a89ae28f498 (diff)
Intermediate changes
-rw-r--r--yt/yt/client/driver/transaction_commands.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/yt/yt/client/driver/transaction_commands.cpp b/yt/yt/client/driver/transaction_commands.cpp
index 0d9621de780..6c47b4f1f6f 100644
--- a/yt/yt/client/driver/transaction_commands.cpp
+++ b/yt/yt/client/driver/transaction_commands.cpp
@@ -17,6 +17,7 @@ using namespace NTransactionClient;
using namespace NCypressClient;
using namespace NObjectClient;
using namespace NConcurrency;
+using namespace NYson;
////////////////////////////////////////////////////////////////////////////////
@@ -173,10 +174,26 @@ void TPingTransactionCommand::DoExecute(ICommandContextPtr context)
void TCommitTransactionCommand::DoExecute(ICommandContextPtr context)
{
auto transaction = AttachTransaction(context, true);
- WaitFor(transaction->Commit(Options))
- .ThrowOnError();
+ auto transactionCommitResult = WaitFor(transaction->Commit(Options))
+ .ValueOrThrow();
- ProduceEmptyOutput(context);
+ if (context->GetConfig()->ApiVersion == ApiVersion3 || !context->GetConfig()->EnableInternalCommands) {
+ ProduceEmptyOutput(context);
+ } else {
+ ProduceOutput(
+ context,
+ [&] (IYsonConsumer* consumer) {
+ BuildYsonFluently(consumer)
+ .BeginMap()
+ .Item("primary_commit_timestamp").Value(transactionCommitResult.PrimaryCommitTimestamp)
+ .Item("commit_timestamps").DoMapFor(
+ transactionCommitResult.CommitTimestamps.Timestamps,
+ [&](auto fluent, const auto& pair) {
+ fluent.Item(ToString(pair.first)).Value(pair.second);
+ })
+ .EndMap();
+ });
+ }
}
////////////////////////////////////////////////////////////////////////////////