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

Merged
merged 1 commit into from
Jan 10, 2025
Merged
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
32 changes: 26 additions & 6 deletions thorlcr/activities/loop/thloopslave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,20 +297,39 @@ 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....
if (!ret)
break;
if (loopCounter==1)
Copy link
Member

Choose a reason for hiding this comment

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

trivial: worth adding a comment to explain the reason, i.e. that on 1st iteration it reads the input, on subsequent iterations it is reading the output from previous iterations, and that this method is called by the async CNextRowFeeder theaad

{
// The disk reads occur in the first iteration only so track lookahead time
// in the first iteration only. In subsequent iterations, it is reading the
// output from previous iterations.
LookAheadTimer t(slaveTimerStats, timeActivities);
ret.setown(curInput->nextRow());
if (!ret)
{
ret.setown(curInput->nextRow()); // more cope with groups somehow....
if (!ret)
break;
}
}
else
{
ret.setown(curInput->nextRow());
if (!ret)
{
ret.setown(curInput->nextRow()); // more cope with groups somehow....
if (!ret)
break;
}
}
}

if (finishedLooping ||
Expand Down Expand Up @@ -439,6 +458,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