Skip to content

Commit

Permalink
Merge pull request #18389 from afishbeck/publisherWUStatus
Browse files Browse the repository at this point in the history
HPCC-31210 Fix publisher workunit task failure tracking gets out of sync

Reviewed-by: Jake Smith <jake.smith@lexisnexisrisk.com>
Reviewed-by: Gavin Halliday <ghalliday@hpccsystems.com>
Merged-by: Gavin Halliday <ghalliday@hpccsystems.com>
  • Loading branch information
ghalliday authored Mar 14, 2024
2 parents 7d889c3 + eae0c2f commit 57a10d9
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions dali/dfu/dfuwu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,14 @@ static StringBuffer &getSubTaskParentXPath(StringBuffer &wuRoot, const char *wui
return wuRoot.append('/').append(wuid);
}

static bool isSubTaskWuid(const char *subtaskWuid)
{
return (!isEmptyString(subtaskWuid) && 'P'==*subtaskWuid && strchr(subtaskWuid, 'T')!=nullptr);
}

static bool notePublisherSubTaskState(const char *subtaskWuid, DFUstate state)
{
if (!subtaskWuid || 'P'!=*subtaskWuid || !strchr(subtaskWuid, 'T'))
if (!isSubTaskWuid(subtaskWuid))
return false;
switch (state)
{
Expand Down Expand Up @@ -699,6 +704,7 @@ class CDFUprogress: public CLinkedDFUWUchild, implements IDFUprogress
queryRoot()->removeProp("@kbpersecave");
queryRoot()->removeProp("@kbpersec");
queryRoot()->removeProp("@slavesdone");
queryRoot()->removeProp("@noted");
parent->commit();
}
void setDone(const char * timeTaken, unsigned kbPerSec, bool set100pc)
Expand All @@ -718,6 +724,8 @@ class CDFUprogress: public CLinkedDFUWUchild, implements IDFUprogress
{
CriticalBlock block(parent->crit);
CDateTime dt;
bool noted = queryRoot()->getPropBool("@noted", false);
bool subtask = isSubTaskWuid(parent->queryId());
switch (state) {
case DFUstate_started:
dt.setNow();
Expand All @@ -737,13 +745,17 @@ class CDFUprogress: public CLinkedDFUWUchild, implements IDFUprogress
state = DFUstate_aborted;
dt.setNow();
setTimeStopped(dt);
if (subtask && !noted)
queryRoot()->setPropBool("@noted", true);
break;
}
StringBuffer s;
encodeDFUstate(state,s);
queryRoot()->setProp("@state",s.str());

parent->commit();
notePublisherSubTaskState(parent->queryId(), state);
if (subtask && !noted)
notePublisherSubTaskState(parent->queryId(), state);
}
void setTimeStarted(const CDateTime &val)
{
Expand Down

0 comments on commit 57a10d9

Please sign in to comment.