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

[WIP] Fix busywait on adding to full async input buffer #14522

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,13 @@ class TDqAsyncComputeActor : public TDqComputeActorBase<TDqAsyncComputeActor, TC
}

void DoExecuteImpl() override {
PollAsyncInput();
bool isFull = false;
if (ProcessOutputsState.Inflight == 0 && ProcessOutputsState.HasDataToSend && !ProcessOutputsState.DataWasSent && ProcessOutputsState.LastRunStatus == ERunStatus::PendingOutput) {
// FIXME is this condition correct?
// we need to stop polling when output is full and all input buffers are full
isFull = true;
}
PollAsyncInput(!isFull);
if (ProcessSourcesState.Inflight == 0) {
auto req = GetCheckpointRequest();
CA_LOG_T("DoExecuteImpl: " << (bool) req);
Expand Down
10 changes: 7 additions & 3 deletions ydb/library/yql/dq/actors/compute/dq_compute_actor_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1441,7 +1441,7 @@ class TDqComputeActorBase : public NActors::TActorBootstrapped<TDerived>
}
}

void PollAsyncInput() {
void PollAsyncInput(bool continueExecuteOnFull = true) {
if (!Running) {
CA_LOG_T("Skip polling inputs and sources because not running");
return;
Expand All @@ -1450,7 +1450,9 @@ class TDqComputeActorBase : public NActors::TActorBootstrapped<TDerived>
CA_LOG_T("Poll inputs");
for (auto& [inputIndex, transform] : InputTransformsMap) {
if (auto resume = transform.PollAsyncInput(MetricsReporter, WatermarksTracker, RuntimeSettings.AsyncInputPushLimit)) {
ContinueExecute(*resume);
if (*resume != EResumeSource::CAPollAsyncNoSpace || continueExecuteOnFull) {
ContinueExecute(*resume);
}
}
}

Expand All @@ -1463,7 +1465,9 @@ class TDqComputeActorBase : public NActors::TActorBootstrapped<TDerived>
CA_LOG_T("Poll sources");
for (auto& [inputIndex, source] : SourcesMap) {
if (auto resume = source.PollAsyncInput(MetricsReporter, WatermarksTracker, RuntimeSettings.AsyncInputPushLimit)) {
ContinueExecute(*resume);
if (*resume != EResumeSource::CAPollAsyncNoSpace || continueExecuteOnFull) {
ContinueExecute(*resume);
}
}
}
}
Expand Down
Loading