@@ -41,6 +41,7 @@ static constexpr ui32 CACHE_SIZE = 100_MB;
4141static constexpr ui32 MAX_BYTES = 25_MB;
4242static constexpr ui32 MAX_SOURCE_ID_LENGTH = 2048 ;
4343static constexpr ui32 MAX_HEARTBEAT_SIZE = 2_KB;
44+ static constexpr ui32 MAX_TXS = 1000 ;
4445
4546struct TChangeNotification {
4647 TChangeNotification (const TActorId& actor, const ui64 txId)
@@ -2953,8 +2954,10 @@ void TPersQueue::RestartPipe(ui64 tabletId, const TActorContext& ctx)
29532954 continue ;
29542955 }
29552956
2956- for (auto & message : tx->GetBindedMsgs (tabletId)) {
2957- PipeClientCache->Send (ctx, tabletId, message.Type , message.Data );
2957+ for (const auto & message : tx->GetBindedMsgs (tabletId)) {
2958+ auto event = std::make_unique<TEvTxProcessing::TEvReadSet>();
2959+ event->Record = message;
2960+ PipeClientCache->Send (ctx, tabletId, event.release ());
29582961 }
29592962 }
29602963}
@@ -3267,10 +3270,6 @@ void TPersQueue::HandleDataTransaction(TAutoPtr<TEvPersQueue::TEvProposeTransact
32673270 return ;
32683271 }
32693272
3270- //
3271- // TODO(abcdef): сохранить пока инициализируемся. TEvPersQueue::TEvHasDataInfo::TPtr как образец. не только конфиг. Inited==true
3272- //
3273-
32743273 if (txBody.OperationsSize () <= 0 ) {
32753274 PQ_LOG_D (" TxId " << event.GetTxId () << " empty list of operations" );
32763275 SendProposeTransactionAbort (ActorIdFromProto (event.GetSourceActor ()),
@@ -3339,7 +3338,6 @@ void TPersQueue::HandleDataTransaction(TAutoPtr<TEvPersQueue::TEvProposeTransact
33393338 return ;
33403339 }
33413340
3342-
33433341 if (txBody.GetImmediate ()) {
33443342 PQ_LOG_D (" immediate transaction" );
33453343 TPartitionId originalPartitionId (txBody.GetOperations (0 ).GetPartitionId ());
@@ -3353,6 +3351,15 @@ void TPersQueue::HandleDataTransaction(TAutoPtr<TEvPersQueue::TEvProposeTransact
33533351
33543352 ctx.Send (partition.Actor , ev.Release ());
33553353 } else {
3354+ if ((EvProposeTransactionQueue.size () + Txs.size ()) >= MAX_TXS) {
3355+ SendProposeTransactionOverloaded (ActorIdFromProto (event.GetSourceActor ()),
3356+ event.GetTxId (),
3357+ NKikimrPQ::TError::ERROR,
3358+ " too many transactions" ,
3359+ ctx);
3360+ return ;
3361+ }
3362+
33563363 PQ_LOG_D (" distributed transaction" );
33573364 EvProposeTransactionQueue.emplace_back (ev.Release ());
33583365
@@ -4128,7 +4135,7 @@ void TPersQueue::SendEvProposeTransactionResult(const TActorContext& ctx,
41284135
41294136void TPersQueue::SendToPipe (ui64 tabletId,
41304137 TDistributedTransaction& tx,
4131- std::unique_ptr<IEventBase > event,
4138+ std::unique_ptr<TEvTxProcessing::TEvReadSet > event,
41324139 const TActorContext& ctx)
41334140{
41344141 Y_ABORT_UNLESS (event);
@@ -4645,16 +4652,17 @@ bool TPersQueue::AllTransactionsHaveBeenProcessed() const
46454652 return EvProposeTransactionQueue.empty () && Txs.empty ();
46464653}
46474654
4648- void TPersQueue::SendProposeTransactionAbort (const TActorId& target,
4649- ui64 txId,
4650- NKikimrPQ::TError::EKind kind,
4651- const TString& reason,
4652- const TActorContext& ctx)
4655+ void TPersQueue::SendProposeTransactionResult (const TActorId& target,
4656+ ui64 txId,
4657+ NKikimrPQ::TEvProposeTransactionResult::EStatus status,
4658+ NKikimrPQ::TError::EKind kind,
4659+ const TString& reason,
4660+ const TActorContext& ctx)
46534661{
46544662 auto event = std::make_unique<TEvPersQueue::TEvProposeTransactionResult>();
46554663
46564664 event->Record .SetOrigin (TabletID ());
4657- event->Record .SetStatus (NKikimrPQ::TEvProposeTransactionResult::ABORTED );
4665+ event->Record .SetStatus (status );
46584666 event->Record .SetTxId (txId);
46594667
46604668 if (kind != NKikimrPQ::TError::OK) {
@@ -4670,6 +4678,34 @@ void TPersQueue::SendProposeTransactionAbort(const TActorId& target,
46704678 ctx.Send (target, std::move (event));
46714679}
46724680
4681+ void TPersQueue::SendProposeTransactionAbort (const TActorId& target,
4682+ ui64 txId,
4683+ NKikimrPQ::TError::EKind kind,
4684+ const TString& reason,
4685+ const TActorContext& ctx)
4686+ {
4687+ SendProposeTransactionResult (target,
4688+ txId,
4689+ NKikimrPQ::TEvProposeTransactionResult::ABORTED,
4690+ kind,
4691+ reason,
4692+ ctx);
4693+ }
4694+
4695+ void TPersQueue::SendProposeTransactionOverloaded (const TActorId& target,
4696+ ui64 txId,
4697+ NKikimrPQ::TError::EKind kind,
4698+ const TString& reason,
4699+ const TActorContext& ctx)
4700+ {
4701+ SendProposeTransactionResult (target,
4702+ txId,
4703+ NKikimrPQ::TEvProposeTransactionResult::OVERLOADED,
4704+ kind,
4705+ reason,
4706+ ctx);
4707+ }
4708+
46734709void TPersQueue::SendEvProposePartitionConfig (const TActorContext& ctx,
46744710 TDistributedTransaction& tx)
46754711{
0 commit comments