diff options
author | azevaykin <azevaykin@yandex-team.com> | 2023-11-21 14:36:55 +0300 |
---|---|---|
committer | azevaykin <azevaykin@yandex-team.com> | 2023-11-21 16:48:20 +0300 |
commit | 6d0e745ae11d58cf99a1462b28ed72bf71ea8b1a (patch) | |
tree | 367871248e0221af6622603f0322054b0218b087 | |
parent | c7d380b33b6f21aab7360346bfd372419887fa0e (diff) | |
download | ydb-6d0e745ae11d58cf99a1462b28ed72bf71ea8b1a.tar.gz |
Move "result" to inner scope
-rw-r--r-- | ydb/core/tx/datashard/datashard__propose_tx_base.cpp | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/ydb/core/tx/datashard/datashard__propose_tx_base.cpp b/ydb/core/tx/datashard/datashard__propose_tx_base.cpp index 4d6388e714..03e9ee9a0d 100644 --- a/ydb/core/tx/datashard/datashard__propose_tx_base.cpp +++ b/ydb/core/tx/datashard/datashard__propose_tx_base.cpp @@ -39,7 +39,6 @@ bool TDataShard::TTxProposeTransactionBase::Execute(NTabletFlatExecutor::TTransa } try { - TOutputOpData::TResultPtr result = nullptr; // If tablet is in follower mode then we should sync scheme // before we build and check operation. if (Self->IsFollower()) { @@ -50,34 +49,23 @@ bool TDataShard::TTxProposeTransactionBase::Execute(NTabletFlatExecutor::TTransa return false; if (status != NKikimrTxDataShard::TError::OK) { + LOG_LOG_S_THROTTLE(Self->GetLogThrottler(TDataShard::ELogThrottlerType::TxProposeTransactionBase_Execute), ctx, NActors::NLog::PRI_ERROR, NKikimrServices::TX_DATASHARD, + "Errors while proposing transaction txid " << TxId << " at tablet " << Self->TabletID() << " status: " << status << " error: " << errMessage); + auto kind = static_cast<NKikimrTxDataShard::ETransactionKind>(Kind); - result.Reset(new TEvDataShard::TEvProposeTransactionResult(kind, Self->TabletID(), TxId, - NKikimrTxDataShard::TEvProposeTransactionResult::ERROR)); + auto result = MakeHolder<TEvDataShard::TEvProposeTransactionResult>(kind, Self->TabletID(), TxId, NKikimrTxDataShard::TEvProposeTransactionResult::ERROR); result->AddError(status, errMessage); - } - } - if (result) { - LOG_TRACE_S(ctx, NKikimrServices::TX_DATASHARD, - "Propose transaction complete txid " << TxId << " at tablet " - << Self->TabletID() << " status: " << result->GetStatus()); - TString errors = result->GetError(); - if (errors.Size()) { - LOG_LOG_S_THROTTLE(Self->GetLogThrottler(TDataShard::ELogThrottlerType::TxProposeTransactionBase_Execute), ctx, NActors::NLog::PRI_ERROR, NKikimrServices::TX_DATASHARD, - "Errors while proposing transaction txid " << TxId - << " at tablet " << Self->TabletID() << " status: " - << result->GetStatus() << " errors: " << errors); - } + TActorId target = Op ? Op->GetTarget() : Ev->Sender; + ui64 cookie = Op ? Op->GetCookie() : Ev->Cookie; - TActorId target = Op ? Op->GetTarget() : Ev->Sender; - ui64 cookie = Op ? Op->GetCookie() : Ev->Cookie; + if (ProposeTransactionSpan) { + ProposeTransactionSpan.EndOk(); + } + ctx.Send(target, result.Release(), 0, cookie); - if (ProposeTransactionSpan) { - ProposeTransactionSpan.EndOk(); + return true; } - ctx.Send(target, result.Release(), 0, cookie); - - return true; } if (Ev) { |