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-17564 Fix various threading issues with stats in ContextLogger #9942

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion roxie/ccd/ccd.hpp
Expand Up @@ -558,6 +558,7 @@ class ContextLogger : implements IRoxieContextLogger, public CInterface
{
protected:
mutable CriticalSection crit;
mutable CriticalSection statsCrit;
unsigned start;
unsigned ctxTraceLevel;
mutable CRuntimeStatisticCollection stats;
Expand Down Expand Up @@ -648,6 +649,7 @@ class ContextLogger : implements IRoxieContextLogger, public CInterface

StringBuffer &getStats(StringBuffer &s) const
{
CriticalBlock block(statsCrit);
return stats.toStr(s);
}

Expand All @@ -665,11 +667,12 @@ class ContextLogger : implements IRoxieContextLogger, public CInterface
{
if (aborted)
throw MakeStringException(ROXIE_ABORT_ERROR, "Roxie server requested abort for running activity");
stats.addStatistic(kind, value);
stats.addStatisticAtomic(kind, value);
}

virtual void mergeStats(const CRuntimeStatisticCollection &from) const
{
CriticalBlock block(statsCrit);
stats.merge(from);
}
virtual const CRuntimeStatisticCollection &queryStats() const
Expand Down