Skip to content

Commit c5e92e4

Browse files
authored
YQ-3844 Add internal states to log (#11479)
1 parent 21b6eea commit c5e92e4

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

ydb/core/fq/libs/row_dispatcher/row_dispatcher.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ class TRowDispatcher : public TActorBootstrapped<TRowDispatcher> {
171171
TActorId TopicSessionId;
172172
const TString QueryId;
173173
ConsumerCounters Counters;
174+
bool PendingGetNextBatch = false;
175+
bool PendingNewDataArrived = false;
174176
TopicSessionClientStatistic Stat;
175177
};
176178

@@ -395,7 +397,8 @@ TString TRowDispatcher::GetInternalState() {
395397
str << " " << consumer->QueryId << " " << readActorId << " unread rows "
396398
<< consumer->Stat.UnreadRows << " unread bytes " << consumer->Stat.UnreadBytes << " offset " << consumer->Stat.Offset
397399
<< " get " << consumer->Counters.GetNextBatch
398-
<< " arrived " << consumer->Counters.NewDataArrived << " batch " << consumer->Counters.MessageBatch << " ";
400+
<< " arr " << consumer->Counters.NewDataArrived << " btc " << consumer->Counters.MessageBatch
401+
<< " pend get " << consumer->PendingGetNextBatch << " pend new " << consumer->PendingNewDataArrived << " ";
399402
str << " retry queue: ";
400403
consumer->EventsQueue.PrintInternalState(str);
401404
}
@@ -486,6 +489,8 @@ void TRowDispatcher::Handle(NFq::TEvRowDispatcher::TEvGetNextBatch::TPtr& ev) {
486489
LOG_ROW_DISPATCHER_ERROR("TEvGetNextBatch: wrong seq num from " << ev->Sender.ToString() << ", seqNo " << seqNo << ", ignore message");
487490
return;
488491
}
492+
it->second->PendingNewDataArrived = false;
493+
it->second->PendingGetNextBatch = true;
489494
it->second->Counters.GetNextBatch++;
490495
Forward(ev, it->second->TopicSessionId);
491496
}
@@ -498,7 +503,6 @@ void TRowDispatcher::Handle(NActors::TEvents::TEvPing::TPtr& ev) {
498503
void TRowDispatcher::Handle(NFq::TEvRowDispatcher::TEvStopSession::TPtr& ev) {
499504
LOG_ROW_DISPATCHER_DEBUG("TEvStopSession, topicPath " << ev->Get()->Record.GetSource().GetTopicPath() <<
500505
" partitionId " << ev->Get()->Record.GetPartitionId());
501-
502506
ConsumerSessionKey key{ev->Sender, ev->Get()->Record.GetPartitionId()};
503507
auto it = Consumers.find(key);
504508
if (it == Consumers.end()) {
@@ -593,6 +597,7 @@ void TRowDispatcher::Handle(NFq::TEvRowDispatcher::TEvNewDataArrived::TPtr& ev)
593597
return;
594598
}
595599
LOG_ROW_DISPATCHER_TRACE("Forward TEvNewDataArrived to " << ev->Get()->ReadActorId);
600+
it->second->PendingNewDataArrived = true;
596601
it->second->Counters.NewDataArrived++;
597602
it->second->EventsQueue.Send(ev->Release().Release());
598603
}
@@ -607,6 +612,7 @@ void TRowDispatcher::Handle(NFq::TEvRowDispatcher::TEvMessageBatch::TPtr& ev) {
607612
}
608613
Metrics.RowsSent->Add(ev->Get()->Record.MessagesSize());
609614
LOG_ROW_DISPATCHER_TRACE("Forward TEvMessageBatch to " << ev->Get()->ReadActorId);
615+
it->second->PendingGetNextBatch = false;
610616
it->second->Counters.MessageBatch++;
611617
it->second->EventsQueue.Send(ev->Release().Release());
612618
}

ydb/library/yql/dq/actors/common/retry_queue.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ TDuration TRetryEventsQueue::TRetryState::RandomizeDelay(TDuration baseDelay) {
173173

174174
void TRetryEventsQueue::PrintInternalState(TStringStream& stream) const {
175175
stream << "id " << EventQueueId << ", NextSeqNo "
176-
<< NextSeqNo << ", MyConfSeqNo " << MyConfirmedSeqNo << ", SeqNos " << ReceivedEventsSeqNos.size() << ", events size " << Events.size() << "\n";
176+
<< NextSeqNo << ", MyConfSeqNo " << MyConfirmedSeqNo << ", SeqNos " << ReceivedEventsSeqNos.size() << ", events size " << Events.size() << ", connected " << Connected << "\n";
177177
}
178178

179179

ydb/library/yql/providers/pq/async_io/dq_pq_rd_read_actor.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ struct TEvPrivate {
104104

105105
class TDqPqRdReadActor : public NActors::TActor<TDqPqRdReadActor>, public NYql::NDq::NInternal::TDqPqReadActorBase {
106106

107-
const ui64 PrintStatePeriodSec = 60;
107+
const ui64 PrintStatePeriodSec = 300;
108108
const ui64 ProcessStatePeriodSec = 2;
109109

110110
using TDebugOffsets = TMaybe<std::pair<ui64, ui64>>;
@@ -699,10 +699,13 @@ void TDqPqRdReadActor::PrintInternalState() {
699699
TStringStream str;
700700
str << "State:\n";
701701
for (auto& [partitionId, sessionInfo] : Sessions) {
702-
str << " partId " << partitionId << " ";
702+
703+
str << " partId " << partitionId << " status " << static_cast<ui64>(sessionInfo.Status)
704+
<< " next offset " << sessionInfo.NextOffset << " is waiting " << sessionInfo.IsWaitingRowDispatcherResponse
705+
<< " has pending data " << sessionInfo.HasPendingData << " ";
703706
sessionInfo.EventsQueue.PrintInternalState(str);
704707
}
705-
SRC_LOG_D(str.Str());
708+
SRC_LOG_I(str.Str());
706709
}
707710

708711
void TDqPqRdReadActor::Handle(TEvPrivate::TEvProcessState::TPtr&) {

0 commit comments

Comments
 (0)