Skip to content

Commit

Permalink
Merge pull request hpcc-systems#18175 from shamser/issue30148
Browse files Browse the repository at this point in the history
HPCC-31048 Fix the scope for SSTdfuworkunit

Reviewed-by: Gavin Halliday <[email protected]>
Merged-by: Gavin Halliday <[email protected]>
  • Loading branch information
ghalliday authored Jan 4, 2024
2 parents defaafd + f641f89 commit b868b59
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
3 changes: 2 additions & 1 deletion plugins/fileservices/fileservices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,8 @@ static void blockUntilComplete(const char * label, IClientFileSpray &server, ICo
if (wu.get()) { // if updatable (e.g. not hthor with no agent context)
aborting = wu->aborting();
StringBuffer wuScope, ElapsedLabel, RemainingLabel;
wuScope.appendf("%s-%s", label, dfuwu.getID());
StringBuffer labelbuf(label);
wuScope.appendf("dfu:%s:%s", labelbuf.toLowerCase().str(), dfuwu.getID());
ElapsedLabel.append(wuScope).append(" (Elapsed) ");
RemainingLabel.append(wuScope).append(" (Remaining) ");
//MORE: I think this are intended to replace the timing information, but will currently combine
Expand Down
1 change: 1 addition & 0 deletions system/jlib/jstatcodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#define ChildGraphScopePrefix "c"
#define FileScopePrefix "p"
#define ChannelScopePrefix "x"
#define DFUWorkunitScopePrefix "D"

#define MATCHES_CONST_PREFIX(search, prefix) (strncmp(search, prefix, strlen(prefix)) == 0)

Expand Down
21 changes: 20 additions & 1 deletion system/jlib/jstats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1429,6 +1429,8 @@ StringBuffer & StatsScopeId::getScopeText(StringBuffer & out) const
return out.append(FileScopePrefix).append(name);
case SSTchannel:
return out.append(ChannelScopePrefix).append(id);
case SSTdfuworkunit:
return out.append(DFUWorkunitScopePrefix).append(name);
case SSTunknown:
return out.append(name);
case SSTglobal:
Expand All @@ -1447,6 +1449,7 @@ unsigned StatsScopeId::getHash() const
{
case SSTfunction:
case SSTunknown:
case SSTdfuworkunit:
return hashcz((const byte *)name.get(), (unsigned)scopeType);
default:
return hashc((const byte *)&id, sizeof(id), (unsigned)scopeType);
Expand Down Expand Up @@ -1496,6 +1499,7 @@ void StatsScopeId::describe(StringBuffer & description) const
break;
case SSTfile:
case SSTfunction:
case SSTdfuworkunit:
description.append(' ').append(name);
break;
default:
Expand Down Expand Up @@ -1544,6 +1548,7 @@ void StatsScopeId::deserialize(MemoryBuffer & in, unsigned version)
break;
case SSTfile:
case SSTfunction:
case SSTdfuworkunit:
in.read(name);
break;
default:
Expand Down Expand Up @@ -1571,6 +1576,7 @@ void StatsScopeId::serialize(MemoryBuffer & out) const
break;
case SSTfile:
case SSTfunction:
case SSTdfuworkunit:
out.append(name);
break;
default:
Expand Down Expand Up @@ -1675,6 +1681,15 @@ bool StatsScopeId::setScopeText(const char * text, const char * * _next)
return true;
}
break;
case DFUWorkunitScopePrefix[0]:
if (MATCHES_CONST_PREFIX(text, DFUWorkunitScopePrefix))
{
setDfuWorkunitId(text+ strlen(DFUWorkunitScopePrefix));
if (_next)
*_next = text + strlen(text);
return true;
}
break;
case '\0':
setId(SSTglobal, 0);
return true;
Expand Down Expand Up @@ -1740,7 +1755,11 @@ void StatsScopeId::setChildGraphId(unsigned _id)
{
setId(SSTchildgraph, _id);
}

void StatsScopeId::setDfuWorkunitId(const char * _name)
{
scopeType = SSTdfuworkunit;
name.set(_name);
}
//--------------------------------------------------------------------------------------------------------------------

enum
Expand Down
2 changes: 1 addition & 1 deletion system/jlib/jstats.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class jlib_decl StatsScopeId
void setSubgraphId(unsigned _id);
void setWorkflowId(unsigned _id);
void setChildGraphId(unsigned _id);

void setDfuWorkunitId(const char * _name);
int compare(const StatsScopeId & other) const;

bool operator == (const StatsScopeId & other) const { return matches(other); }
Expand Down

0 comments on commit b868b59

Please sign in to comment.