@@ -284,7 +284,7 @@ class TDqPqRdReadActor : public NActors::TActor<TDqPqRdReadActor>, public NYql::
284
284
void TrySendGetNextBatch (SessionInfo& sessionInfo);
285
285
template <class TEventPtr >
286
286
bool CheckSession (SessionInfo& session, const TEventPtr& ev, ui64 partitionId);
287
- void SendStopSession (const NActors::TActorId& recipient, ui64 partitionId, ui64 cookie);
287
+ void SendNoSession (const NActors::TActorId& recipient, ui64 partitionId, ui64 cookie);
288
288
void NotifyCA ();
289
289
};
290
290
@@ -501,7 +501,7 @@ void TDqPqRdReadActor::Handle(NFq::TEvRowDispatcher::TEvStartSessionAck::TPtr& e
501
501
SRC_LOG_W (" Ignore TEvStartSessionAck from " << ev->Sender << " , seqNo " << meta.GetSeqNo ()
502
502
<< " , ConfirmedSeqNo " << meta.GetConfirmedSeqNo () << " , PartitionId " << partitionId << " , cookie " << ev->Cookie );
503
503
YQL_ENSURE (State != EState::STARTED);
504
- SendStopSession (ev->Sender , partitionId, ev->Cookie );
504
+ SendNoSession (ev->Sender , partitionId, ev->Cookie );
505
505
return ;
506
506
}
507
507
auto & sessionInfo = sessionIt->second ;
@@ -522,7 +522,7 @@ void TDqPqRdReadActor::Handle(NFq::TEvRowDispatcher::TEvSessionError::TPtr& ev)
522
522
SRC_LOG_W (" Ignore TEvSessionError from " << ev->Sender << " , seqNo " << meta.GetSeqNo ()
523
523
<< " , ConfirmedSeqNo " << meta.GetConfirmedSeqNo () << " , PartitionId " << partitionId << " , cookie " << ev->Cookie );
524
524
YQL_ENSURE (State != EState::STARTED);
525
- SendStopSession (ev->Sender , partitionId, ev->Cookie );
525
+ SendNoSession (ev->Sender , partitionId, ev->Cookie );
526
526
return ;
527
527
}
528
528
@@ -547,7 +547,7 @@ void TDqPqRdReadActor::Handle(NFq::TEvRowDispatcher::TEvStatistics::TPtr& ev) {
547
547
SRC_LOG_W (" Ignore TEvStatistics from " << ev->Sender << " , seqNo " << meta.GetSeqNo ()
548
548
<< " , ConfirmedSeqNo " << meta.GetConfirmedSeqNo () << " , PartitionId " << partitionId);
549
549
YQL_ENSURE (State != EState::STARTED);
550
- SendStopSession (ev->Sender , partitionId, ev->Cookie );
550
+ SendNoSession (ev->Sender , partitionId, ev->Cookie );
551
551
return ;
552
552
}
553
553
auto & sessionInfo = sessionIt->second ;
@@ -580,7 +580,7 @@ void TDqPqRdReadActor::Handle(NFq::TEvRowDispatcher::TEvNewDataArrived::TPtr& ev
580
580
SRC_LOG_W (" Ignore TEvNewDataArrived from " << ev->Sender << " , seqNo " << meta.GetSeqNo ()
581
581
<< " , ConfirmedSeqNo " << meta.GetConfirmedSeqNo () << " , PartitionId " << partitionId);
582
582
YQL_ENSURE (State != EState::STARTED);
583
- SendStopSession (ev->Sender , partitionId, ev->Cookie );
583
+ SendNoSession (ev->Sender , partitionId, ev->Cookie );
584
584
return ;
585
585
}
586
586
@@ -619,24 +619,25 @@ void TDqPqRdReadActor::Handle(const NYql::NDq::TEvRetryQueuePrivate::TEvEvHeartb
619
619
bool needSend = sessionInfo.EventsQueue .Heartbeat ();
620
620
if (needSend) {
621
621
SRC_LOG_T (" Send TEvEvHeartbeat" );
622
- sessionInfo. EventsQueue . Send (new NFq::TEvRowDispatcher::TEvHeartbeat (sessionInfo.PartitionId ), sessionInfo.Generation );
622
+ Send (sessionInfo. RowDispatcherActorId , new NFq::TEvRowDispatcher::TEvHeartbeat (sessionInfo.PartitionId ), sessionInfo.Generation );
623
623
}
624
624
}
625
625
626
626
void TDqPqRdReadActor::Handle (const NFq::TEvRowDispatcher::TEvHeartbeat::TPtr& ev) {
627
- SRC_LOG_T (" Received TEvHeartbeat from " << ev->Sender );
627
+ SRC_LOG_T (" Received TEvHeartbeat from " << ev->Sender << " , generation " << ev-> Cookie );
628
628
Counters.Heartbeat ++;
629
- const NYql::NDqProto::TMessageTransportMeta& meta = ev->Get ()->Record .GetTransportMeta ();
630
629
631
630
ui64 partitionId = ev->Get ()->Record .GetPartitionId ();
632
631
auto sessionIt = Sessions.find (partitionId);
633
632
if (sessionIt == Sessions.end ()) {
634
- SRC_LOG_W (" Ignore TEvHeartbeat from " << ev->Sender << " , seqNo " << meta.GetSeqNo ()
635
- << " , ConfirmedSeqNo " << meta.GetConfirmedSeqNo () << " , PartitionId " << partitionId << " , cookie " << ev->Cookie );
636
- SendStopSession (ev->Sender , partitionId, ev->Cookie );
633
+ SRC_LOG_W (" Ignore TEvHeartbeat from " << ev->Sender << " , PartitionId " << partitionId << " , generation " << ev->Cookie );
634
+ SendNoSession (ev->Sender , partitionId, ev->Cookie );
637
635
return ;
638
636
}
639
- CheckSession (sessionIt->second , ev, partitionId);
637
+
638
+ if (ev->Cookie != sessionIt->second .Generation ) {
639
+ SendNoSession (ev->Sender , partitionId, ev->Cookie );
640
+ }
640
641
}
641
642
642
643
void TDqPqRdReadActor::Handle (NFq::TEvRowDispatcher::TEvCoordinatorChanged::TPtr& ev) {
@@ -723,9 +724,12 @@ void TDqPqRdReadActor::HandleDisconnected(TEvInterconnect::TEvNodeDisconnected::
723
724
}
724
725
725
726
void TDqPqRdReadActor::Handle (NActors::TEvents::TEvUndelivered::TPtr& ev) {
726
- SRC_LOG_D (" TEvUndelivered, " << ev->Get ()->ToString () << " from " << ev->Sender .ToString ());
727
+ SRC_LOG_D (" TEvUndelivered, " << ev->Get ()->ToString () << " from " << ev->Sender .ToString () << " generation " << ev-> Cookie );
727
728
Counters.Undelivered ++;
728
729
for (auto & [partitionId, sessionInfo] : Sessions) {
730
+ if (ev->Cookie != sessionInfo.Generation ) {
731
+ continue ;
732
+ }
729
733
if (sessionInfo.EventsQueue .HandleUndelivered (ev) == NYql::NDq::TRetryEventsQueue::ESessionState::SessionClosed) {
730
734
ReInit (TStringBuilder () << " Session closed, partition id " << sessionInfo.PartitionId );
731
735
break ;
@@ -747,7 +751,7 @@ void TDqPqRdReadActor::Handle(NFq::TEvRowDispatcher::TEvMessageBatch::TPtr& ev)
747
751
SRC_LOG_W (" Ignore TEvMessageBatch from " << ev->Sender << " , seqNo " << meta.GetSeqNo ()
748
752
<< " , ConfirmedSeqNo " << meta.GetConfirmedSeqNo () << " , PartitionId " << partitionId << " , cookie " << ev->Cookie );
749
753
YQL_ENSURE (State != EState::STARTED);
750
- SendStopSession (ev->Sender , partitionId, ev->Cookie );
754
+ SendNoSession (ev->Sender , partitionId, ev->Cookie );
751
755
return ;
752
756
}
753
757
@@ -823,7 +827,7 @@ void TDqPqRdReadActor::PrintInternalState() {
823
827
824
828
TString TDqPqRdReadActor::GetInternalState () {
825
829
TStringStream str;
826
- str << " State: used buffer size " << ReadyBufferSizeBytes << " ready buffer event size " << ReadyBuffer.size () << " state " << static_cast <ui64>(State) << " InFlyAsyncInputData " << InFlyAsyncInputData << " \n " ;
830
+ str << LogPrefix << " State: used buffer size " << ReadyBufferSizeBytes << " ready buffer event size " << ReadyBuffer.size () << " state " << static_cast <ui64>(State) << " InFlyAsyncInputData " << InFlyAsyncInputData << " \n " ;
827
831
str << " Counters: GetAsyncInputData " << Counters.GetAsyncInputData << " CoordinatorChanged " << Counters.CoordinatorChanged << " CoordinatorResult " << Counters.CoordinatorResult
828
832
<< " MessageBatch " << Counters.MessageBatch << " StartSessionAck " << Counters.StartSessionAck << " NewDataArrived " << Counters.NewDataArrived
829
833
<< " SessionError " << Counters.SessionError << " Statistics " << Counters.Statistics << " NodeDisconnected " << Counters.NodeDisconnected
@@ -867,7 +871,7 @@ template <class TEventPtr>
867
871
bool TDqPqRdReadActor::CheckSession (SessionInfo& session, const TEventPtr& ev, ui64 partitionId) {
868
872
if (ev->Cookie != session.Generation ) {
869
873
SRC_LOG_W (" Wrong message generation (" << typeid (TEventPtr).name () << " ), sender " << ev->Sender << " cookie " << ev->Cookie << " , session generation " << session.Generation << " , send TEvStopSession" );
870
- SendStopSession (ev->Sender , partitionId, ev->Cookie );
874
+ SendNoSession (ev->Sender , partitionId, ev->Cookie );
871
875
return false ;
872
876
}
873
877
if (!session.EventsQueue .OnEventReceived (ev)) {
@@ -878,9 +882,9 @@ bool TDqPqRdReadActor::CheckSession(SessionInfo& session, const TEventPtr& ev, u
878
882
return true ;
879
883
}
880
884
881
- void TDqPqRdReadActor::SendStopSession (const NActors::TActorId& recipient, ui64 partitionId, ui64 cookie) {
882
- auto event = std::make_unique<NFq::TEvRowDispatcher::TEvStopSession >();
883
- *event->Record .MutableSource () = SourceParams;
885
+ void TDqPqRdReadActor::SendNoSession (const NActors::TActorId& recipient, ui64 partitionId, ui64 cookie) {
886
+ auto event = std::make_unique<NFq::TEvRowDispatcher::TEvNoSession >();
887
+ // *event->Record.MutableSource() = SourceParams;
884
888
event->Record .SetPartitionId (partitionId);
885
889
Send (recipient, event.release (), 0 , cookie);
886
890
}
0 commit comments