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

HPCC-32933 Fix execute timings for loop activity #19264

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
14 changes: 9 additions & 5 deletions thorlcr/activities/loop/thloopslave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,20 +297,23 @@ class CLoopSlaveActivity : public CLoopSlaveActivityBase
}
const void *getNextRow(bool stopping)
{
ActivityTimer t(slaveTimerStats, timeActivities);
if (!abortSoon && !eof)
{
unsigned emptyIterations = 0;
while (!abortSoon)
{
while (!abortSoon)
{
OwnedConstThorRow ret = (void *)curInput->nextRow();
if (!ret)
OwnedConstThorRow ret;
{
ret.setown(curInput->nextRow()); // more cope with groups somehow....
LookAheadTimer t(slaveTimerStats, timeActivities);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, I think it's a bit more nuanced than this.
curInput is only the inputStream initially.. it then changes, the 2nd iteration of the loop, is not processing the input, but the result of the previous iteration. As it stands if it's doing many iterations, it will count it all against look ahead time.
I think you need to set a flag and only do until curInput changes.

ret.setown(curInput->nextRow());
if (!ret)
break;
{
ret.setown(curInput->nextRow()); // more cope with groups somehow....
if (!ret)
break;
}
}

if (finishedLooping ||
Expand Down Expand Up @@ -439,6 +442,7 @@ class CLoopSlaveActivity : public CLoopSlaveActivityBase
}
CATCH_NEXTROW()
{
ActivityTimer t(slaveTimerStats, timeActivities);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this change looks correct in principle, but in practice, unless the lookahead time that is being performed by the feeder, the timing calculation may well be more inaccurate.

return nextRowFeeder->nextRow();
}
virtual void stop() override
Expand Down
Loading