Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YQ-3583 Improvements after load tests #9955

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions ydb/core/fq/libs/row_dispatcher/topic_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ struct TEvPrivate {

ui64 PrintStatePeriodSec = 60;
ui64 MaxBatchSizeBytes = 10000000;
ui64 MaxHandledEvents = 1000;

TVector<TString> GetVector(const google::protobuf::RepeatedPtrField<TString>& value) {
return {value.begin(), value.end()};
Expand Down Expand Up @@ -227,6 +228,7 @@ class TTopicSession : public TActorBootstrapped<TTopicSession> {
cFunc(NActors::TEvents::TEvPoisonPill::EventType, PassAway);
IgnoreFunc(NFq::TEvPrivate::TEvPqEventsReady);
IgnoreFunc(NFq::TEvPrivate::TEvCreateSession);
IgnoreFunc(NFq::TEvPrivate::TEvDataParsed);
IgnoreFunc(NFq::TEvPrivate::TEvDataAfterFilteration);
IgnoreFunc(NFq::TEvPrivate::TEvStatus);
IgnoreFunc(NFq::TEvPrivate::TEvDataFiltered);
Expand Down Expand Up @@ -442,7 +444,7 @@ void TTopicSession::Handle(TEvRowDispatcher::TEvGetNextBatch::TPtr& ev) {
}

void TTopicSession::HandleNewEvents() {
while (true) {
for (ui64 i = 0; i < MaxHandledEvents; ++i) {
if (!ReadSession) {
return;
}
Expand Down Expand Up @@ -475,7 +477,6 @@ void TTopicSession::TTopicEventProcessor::operator()(NYdb::NTopic::TReadSessionE
LOG_ROW_DISPATCHER_TRACE("Data received: " << message.DebugString(true));

TString item = message.GetData();
item.Detach();
Self.SendToParsing(message.GetOffset(), item);
Self.LastMessageOffset = message.GetOffset();
}
Expand Down Expand Up @@ -540,6 +541,10 @@ void TTopicSession::SendToParsing(ui64 offset, const TString& message) {
}
}

if (ClientsWithoutPredicate.size() == Clients.size()) {
return;
}

try {
Parser->Push(offset, message);
} catch (const std::exception& e) {
Expand Down
21 changes: 21 additions & 0 deletions ydb/core/fq/libs/row_dispatcher/ut/topic_session_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,27 @@ Y_UNIT_TEST_SUITE(TopicSessionTests) {
StopSession(ReadActorId2, source);
}

Y_UNIT_TEST_F(TwoSessionWithoutPredicate, TFixture) {
const TString topicName = "twowithoutpredicate";
PQCreateStream(topicName);
Init(topicName);
auto source1 = BuildSource(topicName, true);
auto source2 = BuildSource(topicName, true);
StartSession(ReadActorId1, source1);
StartSession(ReadActorId2, source2);

const std::vector<TString> data = { Json1 };
PQWrite(data, topicName);
ExpectNewDataArrived({ReadActorId1, ReadActorId2});
Runtime.Send(new IEventHandle(TopicSession, ReadActorId1, new TEvRowDispatcher::TEvGetNextBatch()));
Runtime.Send(new IEventHandle(TopicSession, ReadActorId2, new TEvRowDispatcher::TEvGetNextBatch()));
ExpectMessageBatch(ReadActorId1, { Json1 });
ExpectMessageBatch(ReadActorId2, { Json1 });

StopSession(ReadActorId1, source1);
StopSession(ReadActorId2, source2);
}

Y_UNIT_TEST_F(SessionWithPredicateAndSessionWithoutPredicate, TFixture) {
const TString topicName = "topic2";
PQCreateStream(topicName);
Expand Down
Loading