@@ -73,6 +73,7 @@ class TFixture : public NUnitTest::TBaseFixture {
73
73
Runtime.SetLogPriority (NKikimrServices::FQ_ROW_DISPATCHER, NLog::PRI_TRACE);
74
74
NConfig::TRowDispatcherConfig config;
75
75
config.SetEnabled (true );
76
+ config.SetSendStatusPeriodSec (1 );
76
77
NConfig::TRowDispatcherCoordinatorConfig& coordinatorConfig = *config.MutableCoordinator ();
77
78
coordinatorConfig.SetCoordinationNodePath (" RowDispatcher" );
78
79
auto & database = *coordinatorConfig.MutableDatabase ();
@@ -156,9 +157,9 @@ class TFixture : public NUnitTest::TBaseFixture {
156
157
Runtime.Send (new IEventHandle (RowDispatcher, readActorId, event.release (), 0 , 1 ));
157
158
}
158
159
159
- void MockNoSession (TActorId readActorId) {
160
+ void MockNoSession (TActorId readActorId, ui64 generation ) {
160
161
auto event = std::make_unique<NFq::TEvRowDispatcher::TEvNoSession>();
161
- Runtime.Send (new IEventHandle (RowDispatcher, readActorId, event.release (), 0 , 1 ));
162
+ Runtime.Send (new IEventHandle (RowDispatcher, readActorId, event.release (), 0 , generation ));
162
163
}
163
164
164
165
void MockNewDataArrived (ui64 partitionId, TActorId topicSessionId, TActorId readActorId) {
@@ -181,10 +182,10 @@ class TFixture : public NUnitTest::TBaseFixture {
181
182
Runtime.Send (new IEventHandle (RowDispatcher, topicSessionId, event.release ()));
182
183
}
183
184
184
- void MockGetNextBatch (ui64 partitionId, TActorId readActorId, ui64 generation) {
185
+ void MockGetNextBatch (ui64 partitionId, TActorId readActorId, ui64 generation, ui64 seqNo = 2 ) {
185
186
auto event = std::make_unique<NFq::TEvRowDispatcher::TEvGetNextBatch>();
186
187
event->Record .SetPartitionId (partitionId);
187
- event->Record .MutableTransportMeta ()->SetSeqNo (2 );
188
+ event->Record .MutableTransportMeta ()->SetSeqNo (seqNo );
188
189
Runtime.Send (new IEventHandle (RowDispatcher, readActorId, event.release (), 0 , generation));
189
190
}
190
191
@@ -236,11 +237,11 @@ class TFixture : public NUnitTest::TBaseFixture {
236
237
return actorId;
237
238
}
238
239
239
- void ProcessData (NActors::TActorId readActorId, ui64 partId, NActors::TActorId topicSessionActorId, ui64 generation = 1 ) {
240
+ void ProcessData (NActors::TActorId readActorId, ui64 partId, NActors::TActorId topicSessionActorId, ui64 generation = 1 , ui64 seqNo = 1 ) {
240
241
MockNewDataArrived (partId, topicSessionActorId, readActorId);
241
242
ExpectNewDataArrived (readActorId, partId);
242
243
243
- MockGetNextBatch (partId, readActorId, generation);
244
+ MockGetNextBatch (partId, readActorId, generation, seqNo );
244
245
ExpectGetNextBatch (topicSessionActorId, partId);
245
246
246
247
MockMessageBatch (partId, topicSessionActorId, readActorId, generation);
@@ -440,13 +441,17 @@ Y_UNIT_TEST_SUITE(RowDispatcherTests) {
440
441
}
441
442
442
443
Y_UNIT_TEST_F (ProcessNoSession, TFixture) {
443
- MockAddSession (Source1, {PartitionId0}, ReadActorId3);
444
+ ui64 generation = 42 ;
445
+ MockAddSession (Source1, {PartitionId0}, ReadActorId3, generation);
444
446
auto topicSessionId = ExpectRegisterTopicSession ();
445
- ExpectStartSessionAck (ReadActorId3);
447
+ ExpectStartSessionAck (ReadActorId3, generation );
446
448
ExpectStartSession (topicSessionId);
447
- ProcessData (ReadActorId3, PartitionId0, topicSessionId);
449
+ ProcessData (ReadActorId3, PartitionId0, topicSessionId, generation, 2 );
450
+
451
+ MockNoSession (ReadActorId3, generation - 1 ); // Ignore NoSession with wrong generation.
452
+ ProcessData (ReadActorId3, PartitionId0, topicSessionId, generation, 3 );
448
453
449
- MockNoSession (ReadActorId3);
454
+ MockNoSession (ReadActorId3, generation );
450
455
ExpectStopSession (topicSessionId);
451
456
}
452
457
0 commit comments