diff options
author | azevaykin <azevaykin@yandex-team.com> | 2023-11-13 09:07:12 +0300 |
---|---|---|
committer | azevaykin <azevaykin@yandex-team.com> | 2023-11-13 09:29:55 +0300 |
commit | b7579a2e21c2048763703213e852f6b76ad31cfa (patch) | |
tree | 05a07c32bf1ffdaface724b826acb84428eaefce | |
parent | b1b81528aa11a2fe5b9dd9bddcece4320818ca34 (diff) | |
download | ydb-b7579a2e21c2048763703213e852f6b76ad31cfa.tar.gz |
TEvProposeTransaction.Source is deprecated
-rw-r--r-- | ydb/core/protos/tx_datashard.proto | 2 | ||||
-rw-r--r-- | ydb/core/tx/datashard/datashard.cpp | 15 | ||||
-rw-r--r-- | ydb/core/tx/datashard/datashard.h | 6 | ||||
-rw-r--r-- | ydb/core/tx/datashard/datashard__propose_tx_base.cpp | 4 | ||||
-rw-r--r-- | ydb/core/tx/datashard/datashard_impl.h | 2 | ||||
-rw-r--r-- | ydb/core/tx/datashard/datashard_pipeline.cpp | 2 | ||||
-rw-r--r-- | ydb/core/tx/datashard/datashard_ut_kqp_errors.cpp | 2 | ||||
-rw-r--r-- | ydb/core/tx/datashard/datashard_ut_minstep.cpp | 1 | ||||
-rw-r--r-- | ydb/core/tx/datashard/datashard_ut_order.cpp | 2 |
9 files changed, 16 insertions, 20 deletions
diff --git a/ydb/core/protos/tx_datashard.proto b/ydb/core/protos/tx_datashard.proto index 7299a6465f..b672c1086e 100644 --- a/ydb/core/protos/tx_datashard.proto +++ b/ydb/core/protos/tx_datashard.proto @@ -554,7 +554,7 @@ message TMvccSnapshot { message TEvProposeTransaction { optional ETransactionKind TxKind = 1; - optional NActorsProto.TActorId Source = 2; + optional NActorsProto.TActorId SourceDeprecated = 2 [deprecated = true]; // for compatibility with old tx engine optional bytes TxBody = 3; optional uint64 TxId = 4; optional uint32 ExecLevel = 5; diff --git a/ydb/core/tx/datashard/datashard.cpp b/ydb/core/tx/datashard/datashard.cpp index 4a30d4c705..eb7e00d2cf 100644 --- a/ydb/core/tx/datashard/datashard.cpp +++ b/ydb/core/tx/datashard/datashard.cpp @@ -2590,8 +2590,9 @@ bool TDataShard::CheckDataTxReject(const TString& opDescr, return reject; } -bool TDataShard::CheckDataTxRejectAndReply(TEvDataShard::TEvProposeTransaction* msg, const TActorContext& ctx) +bool TDataShard::CheckDataTxRejectAndReply(const TEvDataShard::TEvProposeTransaction::TPtr& ev, const TActorContext& ctx) { + auto* msg = ev->Get(); switch (msg->GetTxKind()) { case NKikimrTxDataShard::TX_KIND_DATA: case NKikimrTxDataShard::TX_KIND_SCAN: @@ -2621,7 +2622,7 @@ bool TDataShard::CheckDataTxRejectAndReply(TEvDataShard::TEvProposeTransaction* result->AddError(NKikimrTxDataShard::TError::WRONG_SHARD_STATE, rejectDescription); LOG_NOTICE_S(ctx, NKikimrServices::TX_DATASHARD, rejectDescription); - ctx.Send(msg->GetSource(), result.Release()); + ctx.Send(ev->Sender, result.Release()); IncCounter(COUNTER_PREPARE_OVERLOADED); IncCounter(COUNTER_PREPARE_COMPLETE); return true; @@ -2671,7 +2672,7 @@ void TDataShard::Handle(TEvDataShard::TEvProposeTransaction::TPtr &ev, const TAc IncCounter(COUNTER_PREPARE_REQUEST); - if (CheckDataTxRejectAndReply(ev->Get(), ctx)) { + if (CheckDataTxRejectAndReply(ev, ctx)) { return; } @@ -2696,7 +2697,7 @@ void TDataShard::Handle(TEvDataShard::TEvProposeTransaction::TPtr &ev, const TAc ev->Get()->GetTxId(), NKikimrTxDataShard::TEvProposeTransactionResult::ERROR)); result->AddError(NKikimrTxDataShard::TError::BAD_TX_KIND, "Unknown kind of transaction"); - ctx.Send(ev->Get()->GetSource(), result.Release()); + ctx.Send(ev->Sender, result.Release()); IncCounter(COUNTER_PREPARE_ERROR); IncCounter(COUNTER_PREPARE_COMPLETE); @@ -2732,7 +2733,7 @@ void TDataShard::HandleAsFollower(TEvDataShard::TEvProposeTransaction::TPtr &ev, THolder<TEvDataShard::TEvProposeTransactionResult> result = THolder(new TEvDataShard::TEvProposeTransactionResult(ev->Get()->GetTxKind(), TabletID(), ev->Get()->GetTxId(), NKikimrTxDataShard::TEvProposeTransactionResult::OVERLOADED)); - ctx.Send(ev->Get()->GetSource(), result.Release()); + ctx.Send(ev->Sender, result.Release()); IncCounter(COUNTER_PREPARE_OVERLOADED); IncCounter(COUNTER_PREPARE_COMPLETE); return; @@ -2749,7 +2750,7 @@ void TDataShard::HandleAsFollower(TEvDataShard::TEvProposeTransaction::TPtr &ev, ev->Get()->GetTxId(), NKikimrTxDataShard::TEvProposeTransactionResult::ERROR)); result->AddError(NKikimrTxDataShard::TError::BAD_TX_KIND, "Unsupported transaction kind"); - ctx.Send(ev->Get()->GetSource(), result.Release()); + ctx.Send(ev->Sender, result.Release()); IncCounter(COUNTER_PREPARE_ERROR); IncCounter(COUNTER_PREPARE_COMPLETE); } @@ -2849,7 +2850,7 @@ void TDataShard::Handle(TEvPrivate::TEvDelayedProposeTransaction::TPtr &ev, cons return; } - TActorId target = item.Event->Get()->GetSource(); + TActorId target = item.Event->Sender; ui64 cookie = item.Event->Cookie; auto kind = item.Event->Get()->GetTxKind(); auto txId = item.Event->Get()->GetTxId(); diff --git a/ydb/core/tx/datashard/datashard.h b/ydb/core/tx/datashard/datashard.h index 540e6ec211..0f2884dfdf 100644 --- a/ydb/core/tx/datashard/datashard.h +++ b/ydb/core/tx/datashard/datashard.h @@ -437,7 +437,7 @@ struct TEvDataShard { const TStringBuf& txBody, ui32 flags = NDataShard::TTxFlags::Default) { Record.SetTxKind(txKind); - ActorIdToProto(source, Record.MutableSource()); + ActorIdToProto(source, Record.MutableSourceDeprecated()); Record.SetTxId(txId); Record.SetExecLevel(0); Record.SetTxBody(txBody.data(), txBody.size()); @@ -481,10 +481,6 @@ struct TEvDataShard { return Record.GetTxKind(); } - TActorId GetSource() const { - return ActorIdFromProto(Record.GetSource()); - } - ui64 GetTxId() const { return Record.GetTxId(); } diff --git a/ydb/core/tx/datashard/datashard__propose_tx_base.cpp b/ydb/core/tx/datashard/datashard__propose_tx_base.cpp index 7fa10a45b4..4d6388e714 100644 --- a/ydb/core/tx/datashard/datashard__propose_tx_base.cpp +++ b/ydb/core/tx/datashard/datashard__propose_tx_base.cpp @@ -69,7 +69,7 @@ bool TDataShard::TTxProposeTransactionBase::Execute(NTabletFlatExecutor::TTransa << result->GetStatus() << " errors: " << errors); } - TActorId target = Op ? Op->GetTarget() : Ev->Get()->GetSource(); + TActorId target = Op ? Op->GetTarget() : Ev->Sender; ui64 cookie = Op ? Op->GetCookie() : Ev->Cookie; if (ProposeTransactionSpan) { @@ -83,7 +83,7 @@ bool TDataShard::TTxProposeTransactionBase::Execute(NTabletFlatExecutor::TTransa if (Ev) { Y_ABORT_UNLESS(!Op); - if (Self->CheckDataTxRejectAndReply(Ev->Get(), ctx)) { + if (Self->CheckDataTxRejectAndReply(Ev, ctx)) { Ev = nullptr; return true; } diff --git a/ydb/core/tx/datashard/datashard_impl.h b/ydb/core/tx/datashard/datashard_impl.h index 4d71b315e9..a1eb936183 100644 --- a/ydb/core/tx/datashard/datashard_impl.h +++ b/ydb/core/tx/datashard/datashard_impl.h @@ -1546,7 +1546,7 @@ public: NKikimrTxDataShard::TEvProposeTransactionResult::EStatus& rejectStatus, ERejectReasons& rejectReasons, TString& rejectDescription); - bool CheckDataTxRejectAndReply(TEvDataShard::TEvProposeTransaction* msg, const TActorContext& ctx); + bool CheckDataTxRejectAndReply(const TEvDataShard::TEvProposeTransaction::TPtr& ev, const TActorContext& ctx); TSysLocks& SysLocksTable() { return SysLocks; } diff --git a/ydb/core/tx/datashard/datashard_pipeline.cpp b/ydb/core/tx/datashard/datashard_pipeline.cpp index af9cc47180..f4f52a4f02 100644 --- a/ydb/core/tx/datashard/datashard_pipeline.cpp +++ b/ydb/core/tx/datashard/datashard_pipeline.cpp @@ -1318,7 +1318,7 @@ TOperation::TPtr TPipeline::BuildOperation(TEvDataShard::TEvProposeTransaction:: info.SetMvccSnapshot(TRowVersion(rec.GetMvccSnapshot().GetStep(), rec.GetMvccSnapshot().GetTxId())); } TActiveTransaction::TPtr tx = MakeIntrusive<TActiveTransaction>(info); - tx->SetTarget(ev->Get()->GetSource()); + tx->SetTarget(ev->Sender); tx->SetTxBody(rec.GetTxBody()); tx->SetCookie(ev->Cookie); tx->Orbit = std::move(ev->Get()->Orbit); diff --git a/ydb/core/tx/datashard/datashard_ut_kqp_errors.cpp b/ydb/core/tx/datashard/datashard_ut_kqp_errors.cpp index ac86ad7a26..cb13af2aac 100644 --- a/ydb/core/tx/datashard/datashard_ut_kqp_errors.cpp +++ b/ydb/core/tx/datashard/datashard_ut_kqp_errors.cpp @@ -270,7 +270,7 @@ void TestProposeResultLost(TTestActorRuntime& runtime, TActorId client, const TS if (ev->GetTypeRewrite() == TEvPipeCache::TEvForward::EventType) { auto* fe = ev.Get()->Get<TEvPipeCache::TEvForward>(); if (fe->Ev->Type() == TEvDataShard::TEvProposeTransaction::EventType) { - executer = ((TEvDataShard::TEvProposeTransaction*) fe->Ev.Get())->GetSource(); + executer = ev->Sender; // Cerr << "-- executer: " << executer << Endl; return TTestActorRuntime::EEventAction::PROCESS; } diff --git a/ydb/core/tx/datashard/datashard_ut_minstep.cpp b/ydb/core/tx/datashard/datashard_ut_minstep.cpp index 470fa88980..c97617bb4e 100644 --- a/ydb/core/tx/datashard/datashard_ut_minstep.cpp +++ b/ydb/core/tx/datashard/datashard_ut_minstep.cpp @@ -365,7 +365,6 @@ Y_UNIT_TEST_SUITE(TDataShardMinStepTest) { { auto event = new TEvDataShard::TEvProposeTransaction; event->Record = proposeRecord; - ActorIdToProto(sender, event->Record.MutableSource()); runtime.Send(new IEventHandle(shardActorId, sender, event), 0, true); } diff --git a/ydb/core/tx/datashard/datashard_ut_order.cpp b/ydb/core/tx/datashard/datashard_ut_order.cpp index bc6bc8db49..a2e73d7480 100644 --- a/ydb/core/tx/datashard/datashard_ut_order.cpp +++ b/ydb/core/tx/datashard/datashard_ut_order.cpp @@ -2607,7 +2607,7 @@ Y_UNIT_TEST(TestPlannedCancelSplit) { if (event && event->GetRecipientRewrite() == actors[1]) { Cerr << "---- found propose for table-2 ----" << Endl; const auto* msg = event->Get<TEvDataShard::TEvProposeTransaction>(); - TActorId target = msg->GetSource(); + TActorId target = event->Sender; auto* result = new TEvDataShard::TEvProposeTransactionResult( msg->GetTxKind(), tablets[1], |