Skip to content

Commit

Permalink
HPCC-29817 Make IContextLogger pure virtual base class & rename assoc…
Browse files Browse the repository at this point in the history
…iated derived classes

Signed-off-by: Shamser Ahmed <[email protected]>
  • Loading branch information
shamser committed Aug 14, 2023
1 parent 8ba615c commit a72b6ae
Show file tree
Hide file tree
Showing 25 changed files with 180 additions and 159 deletions.
2 changes: 1 addition & 1 deletion common/thorhelper/roxiehelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2821,7 +2821,7 @@ StringBuffer & expandLogicalFilename(StringBuffer & logicalName, const char * fn

//----------------------------------------------------------------------------------

void IRoxieContextLogger::CTXLOGae(IException *E, const char *file, unsigned line, const char *prefix, const char *format, ...) const
void CBaseRoxieContextLogger::CTXLOGae(IException *E, const char *file, unsigned line, const char *prefix, const char *format, ...) const
{
va_list args;
va_start(args, format);
Expand Down
4 changes: 2 additions & 2 deletions common/thorhelper/roxiehelper.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ enum TracingCategory
};

class LogItem;
interface IRoxieContextLogger : extends IContextLogger
interface CBaseRoxieContextLogger : extends CDefaultContextLogger
{
IRoxieContextLogger(IPropertyTree *cfg) : IContextLogger(cfg) {}
CBaseRoxieContextLogger(IPropertyTree *cfg) : CDefaultContextLogger(cfg) {}
// Override base interface with versions that add prefix
// We could consider moving some or all of these down into IContextLogger
virtual void CTXLOGva(const LogMsgCategory & cat, const LogMsgJobInfo & job, LogMsgCode code, const char *format, va_list args) const override __attribute__((format(printf,5,0)))
Expand Down
4 changes: 2 additions & 2 deletions roxie/ccd/ccd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ extern void putStatsValue(StringBuffer &reply, const char *statName, const char

extern const StatisticsMapping accumulatedStatistics;

class ContextLogger : implements IRoxieContextLogger, public CInterface
class ContextLogger : implements CBaseRoxieContextLogger
{
protected:
mutable CriticalSection crit;
Expand All @@ -591,7 +591,7 @@ class ContextLogger : implements IRoxieContextLogger, public CInterface
public:
IMPLEMENT_IINTERFACE;

ContextLogger() : IRoxieContextLogger(topology), stats(accumulatedStatistics, true)
ContextLogger() : CBaseRoxieContextLogger(topology), stats(accumulatedStatistics, true)
{
ctxTraceLevel = traceLevel;
intercept = false;
Expand Down
2 changes: 1 addition & 1 deletion roxie/ccd/ccdactivities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ class CAgentActivityFactory : public CActivityFactory, implements IAgentActivity
{
return queryFactory.createAgentContext(logctx, packet, childQueries.length()!=0);
}
virtual void getXrefInfo(IPropertyTree &reply, const IRoxieContextLogger &logctx) const
virtual void getXrefInfo(IPropertyTree &reply, const CBaseRoxieContextLogger &logctx) const
{
if (datafile)
addXrefFileInfo(reply, datafile);
Expand Down
2 changes: 1 addition & 1 deletion roxie/ccd/ccdactivities.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ interface IActivityFactory : extends IInterface
virtual ThorActivityKind getKind() const = 0;
virtual void getActivityMetrics(StringBuffer &reply) const = 0;
virtual void gatherStats(IStatisticGatherer &builder, int channel, bool reset) const = 0;
virtual void getXrefInfo(IPropertyTree &reply, const IRoxieContextLogger &logctx) const = 0;
virtual void getXrefInfo(IPropertyTree &reply, const CBaseRoxieContextLogger &logctx) const = 0;
virtual void mergeStats(const CRuntimeStatisticCollection &from) const = 0;
};

Expand Down
34 changes: 17 additions & 17 deletions roxie/ccd/ccdcontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ class CAgentDebugContext : public CBaseDebugContext
unsigned channel;
int debugSequence;
CriticalSection crit;
const IRoxieContextLogger &logctx; // hides base class definition with more derived class pointer
const CBaseRoxieContextLogger &logctx; // hides base class definition with more derived class pointer

public:
CAgentDebugContext(IRoxieAgentContext *_ctx, const IRoxieContextLogger &_logctx, RoxiePacketHeader &_header)
CAgentDebugContext(IRoxieAgentContext *_ctx, const CBaseRoxieContextLogger &_logctx, RoxiePacketHeader &_header)
: CBaseDebugContext(_logctx), header(_header), logctx(_logctx)
{
channel = header.channel;
Expand Down Expand Up @@ -202,7 +202,7 @@ class CAgentDebugContext : public CBaseDebugContext
class CRoxieWorkflowMachine : public WorkflowMachine
{
public:
CRoxieWorkflowMachine(IPropertyTree *_workflowInfo, IConstWorkUnit *_wu, bool _doOnce, bool _parallelWorkflow, unsigned _numWorkflowThreads, const IRoxieContextLogger &_logctx)
CRoxieWorkflowMachine(IPropertyTree *_workflowInfo, IConstWorkUnit *_wu, bool _doOnce, bool _parallelWorkflow, unsigned _numWorkflowThreads, const CBaseRoxieContextLogger &_logctx)
: WorkflowMachine(_logctx)
{
workunit = _wu;
Expand Down Expand Up @@ -800,7 +800,7 @@ class CRoxieWorkflowMachine : public WorkflowMachine
unsigned numWorkflowThreads;
};

CRoxieWorkflowMachine *createRoxieWorkflowMachine(IPropertyTree *_workflowInfo, IConstWorkUnit *_wu, bool _doOnce, bool _parallelWorkflow, unsigned _numWorkflowThreads, const IRoxieContextLogger &_logctx)
CRoxieWorkflowMachine *createRoxieWorkflowMachine(IPropertyTree *_workflowInfo, IConstWorkUnit *_wu, bool _doOnce, bool _parallelWorkflow, unsigned _numWorkflowThreads, const CBaseRoxieContextLogger &_logctx)
{
return new CRoxieWorkflowMachine(_workflowInfo, _wu, _doOnce, _parallelWorkflow, _numWorkflowThreads, _logctx);
}
Expand Down Expand Up @@ -948,7 +948,7 @@ class WorkUnitRowReaderBase : implements IWorkUnitRowReader, public CInterface
class RawDataReader : public WorkUnitRowReaderBase
{
protected:
const IRoxieContextLogger &logctx;
const CBaseRoxieContextLogger &logctx;
byte *bufferBase;
MemoryBuffer blockBuffer;
Owned<ISerialStream> bufferStream;
Expand All @@ -972,7 +972,7 @@ class RawDataReader : public WorkUnitRowReaderBase
}

public:
RawDataReader(ICodeContext *codeContext, IEngineRowAllocator *_rowAllocator, bool _isGrouped, const IRoxieContextLogger &_logctx)
RawDataReader(ICodeContext *codeContext, IEngineRowAllocator *_rowAllocator, bool _isGrouped, const CBaseRoxieContextLogger &_logctx)
: WorkUnitRowReaderBase(_rowAllocator, _isGrouped), logctx(_logctx)
{
eof = false;
Expand Down Expand Up @@ -1019,7 +1019,7 @@ class InlineRawDataReader : public RawDataReader
{
Linked<IPropertyTree> xml;
public:
InlineRawDataReader(ICodeContext *codeContext, IEngineRowAllocator *_rowAllocator, bool _isGrouped, const IRoxieContextLogger &_logctx, IPropertyTree *_xml)
InlineRawDataReader(ICodeContext *codeContext, IEngineRowAllocator *_rowAllocator, bool _isGrouped, const CBaseRoxieContextLogger &_logctx, IPropertyTree *_xml)
: RawDataReader(codeContext, _rowAllocator, _isGrouped, _logctx), xml(_xml)
{
}
Expand Down Expand Up @@ -1050,7 +1050,7 @@ class StreamedRawDataReader : public RawDataReader
StringAttr id;
offset_t offset;
public:
StreamedRawDataReader(ICodeContext *codeContext, IEngineRowAllocator *_rowAllocator, bool _isGrouped, const IRoxieContextLogger &_logctx, SafeSocket &_client, const char *_id)
StreamedRawDataReader(ICodeContext *codeContext, IEngineRowAllocator *_rowAllocator, bool _isGrouped, const CBaseRoxieContextLogger &_logctx, SafeSocket &_client, const char *_id)
: RawDataReader(codeContext, _rowAllocator, _isGrouped, _logctx), client(_client), id(_id)
{
offset = 0;
Expand Down Expand Up @@ -1120,7 +1120,7 @@ class WuResultDataReader : public RawDataReader
Owned<IConstWUResult> result;
IXmlToRowTransformer *rowTransformer;
public:
WuResultDataReader(ICodeContext *codeContext, IEngineRowAllocator *_rowAllocator, bool _isGrouped, const IRoxieContextLogger &_logctx, IConstWUResult *_result, IXmlToRowTransformer *_rowTransformer)
WuResultDataReader(ICodeContext *codeContext, IEngineRowAllocator *_rowAllocator, bool _isGrouped, const CBaseRoxieContextLogger &_logctx, IConstWUResult *_result, IXmlToRowTransformer *_rowTransformer)
: RawDataReader(codeContext, _rowAllocator, _isGrouped, _logctx), result(_result), rowTransformer(_rowTransformer)
{
}
Expand Down Expand Up @@ -1179,7 +1179,7 @@ class InlineXmlDataReader : public WorkUnitRowReaderBase
//---------------------------------------------------------------------------------------

static const StatisticsMapping graphStatistics({});
class CRoxieContextBase : implements IRoxieAgentContext, implements ICodeContext, implements roxiemem::ITimeLimiter, implements IRowAllocatorMetaActIdCacheCallback, public CInterface
class CRoxieContextBase : implements IRoxieAgentContext, implements ICodeContext, implements roxiemem::ITimeLimiter, implements IRowAllocatorMetaActIdCacheCallback
{
protected:
Owned<IWUGraphStats> graphStats; // This needs to be destroyed very late (particularly, after the childgraphs)
Expand All @@ -1205,7 +1205,7 @@ class CRoxieContextBase : implements IRoxieAgentContext, implements ICodeContext
Owned<IDistributedFileTransaction> superfileTransaction;
IArrayOf<IQueryFactory> loadedLibraries;

const IRoxieContextLogger &logctx;
const CBaseRoxieContextLogger &logctx;


protected:
Expand Down Expand Up @@ -1264,7 +1264,7 @@ class CRoxieContextBase : implements IRoxieAgentContext, implements ICodeContext

public:
IMPLEMENT_IINTERFACE;
CRoxieContextBase(const IQueryFactory *_factory, const IRoxieContextLogger &_logctx)
CRoxieContextBase(const IQueryFactory *_factory, const CBaseRoxieContextLogger &_logctx)
: IRoxieAgentContext(topology), factory(_factory), options(factory->queryOptions()), logctx(_logctx), globalStats(graphStatistics)
{
startTime = lastWuAbortCheck = msTick();
Expand Down Expand Up @@ -1388,11 +1388,11 @@ class CRoxieContextBase : implements IRoxieAgentContext, implements ICodeContext
}
virtual void setGlobalId(const char *id, SocketEndpoint &ep, unsigned pid) override
{
const_cast<IRoxieContextLogger&>(logctx).setGlobalId(id, ep, pid);
const_cast<CBaseRoxieContextLogger&>(logctx).setGlobalId(id, ep, pid);
}
virtual void setCallerId(const char *id) override
{
const_cast<IRoxieContextLogger&>(logctx).setCallerId(id);
const_cast<CBaseRoxieContextLogger&>(logctx).setCallerId(id);
}
virtual const char *queryGlobalId() const override
{
Expand All @@ -1408,7 +1408,7 @@ class CRoxieContextBase : implements IRoxieAgentContext, implements ICodeContext
}
virtual void setHttpIdHeaderNames(const char *global, const char *caller) override
{
const_cast<IRoxieContextLogger&>(logctx).setHttpIdHeaderNames(global, caller);
const_cast<CBaseRoxieContextLogger&>(logctx).setHttpIdHeaderNames(global, caller);
}
virtual const char *queryGlobalIdHttpHeaderName() const override
{
Expand Down Expand Up @@ -2703,7 +2703,7 @@ class CRoxieServerContext : public CRoxieContextBase, implements IRoxieServerCon
public:
IMPLEMENT_IINTERFACE;

CRoxieServerContext(const IQueryFactory *_factory, const IRoxieContextLogger &_logctx)
CRoxieServerContext(const IQueryFactory *_factory, const CBaseRoxieContextLogger &_logctx)
: CRoxieContextBase(_factory, _logctx), serverQueryFactory(_factory), results(NULL)
{
init();
Expand Down Expand Up @@ -4044,7 +4044,7 @@ IRoxieServerContext *createRoxieServerContext(IPropertyTree *context, IHpccProto
return new CSoapRoxieServerContext(context, protocol, factory, flags, _logctx, readFlags, querySetName);
}

IRoxieServerContext *createOnceServerContext(const IQueryFactory *factory, const IRoxieContextLogger &_logctx)
IRoxieServerContext *createOnceServerContext(const IQueryFactory *factory, const CBaseRoxieContextLogger &_logctx)
{
return new CRoxieServerContext(factory, _logctx);
}
Expand Down
8 changes: 4 additions & 4 deletions roxie/ccd/ccdcontext.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ interface IWorkUnitRowReader : public IInterface

interface IRoxieServerContext;

interface IRoxieAgentContext : extends IRoxieContextLogger
interface IRoxieAgentContext : extends CBaseRoxieContextLogger
{
IRoxieAgentContext(IPropertyTree *cfg) : IRoxieContextLogger(cfg) {}
IRoxieAgentContext(IPropertyTree *cfg) : CBaseRoxieContextLogger(cfg) {}
virtual ICodeContext *queryCodeContext() = 0;
virtual void checkAbort() = 0;
virtual void notifyAbort(IException *E) = 0;
Expand Down Expand Up @@ -117,8 +117,8 @@ class CRoxieWorkflowMachine;
extern IDeserializedResultStore *createDeserializedResultStore();
extern IRoxieAgentContext *createAgentContext(const IQueryFactory *factory, const AgentContextLogger &logctx, IRoxieQueryPacket *packet, bool hasRemoteChildren);
extern IRoxieServerContext *createRoxieServerContext(IPropertyTree *context, IHpccProtocolResponse *protocol, const IQueryFactory *factory, unsigned flags, const ContextLogger &logctx, PTreeReaderOptions xmlReadFlags, const char *querySetName);
extern IRoxieServerContext *createOnceServerContext(const IQueryFactory *factory, const IRoxieContextLogger &_logctx);
extern IRoxieServerContext *createOnceServerContext(const IQueryFactory *factory, const CBaseRoxieContextLogger &_logctx);
extern IRoxieServerContext *createWorkUnitServerContext(IConstWorkUnit *wu, const IQueryFactory *factory, const ContextLogger &logctx);
extern CRoxieWorkflowMachine *createRoxieWorkflowMachine(IPropertyTree *_workflowInfo, IConstWorkUnit *wu, bool doOnce, bool _parallelWorkflow, unsigned _numWorkflowThreads, const IRoxieContextLogger &_logctx);
extern CRoxieWorkflowMachine *createRoxieWorkflowMachine(IPropertyTree *_workflowInfo, IConstWorkUnit *wu, bool doOnce, bool _parallelWorkflow, unsigned _numWorkflowThreads, const CBaseRoxieContextLogger &_logctx);

#endif
2 changes: 1 addition & 1 deletion roxie/ccd/ccddebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,7 @@ class DebugRequestGetResetGlobalCounts : public DebugRequestBase
}
};

extern void doDebugRequest(IRoxieQueryPacket *packet, const IRoxieContextLogger &logctx)
extern void doDebugRequest(IRoxieQueryPacket *packet, const CBaseRoxieContextLogger &logctx)
{
RoxiePacketHeader newHeader(packet->queryHeader(), ROXIE_DEBUGREQUEST, 0); // subchannel not relevant
Owned<IMessagePacker> output = ROQ->createOutputStream(newHeader, true, logctx);
Expand Down
4 changes: 2 additions & 2 deletions roxie/ccd/ccddebug.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
#include <jlib.hpp>

interface IRoxieQueryPacket;
interface IRoxieContextLogger;
interface CBaseRoxieContextLogger;
interface IProbeManager;
interface IDebuggableContext;

extern void doDebugRequest(IRoxieQueryPacket *packet, const IRoxieContextLogger &logctx);
extern void doDebugRequest(IRoxieQueryPacket *packet, const CBaseRoxieContextLogger &logctx);
extern IProbeManager *createDebugManager(IDebuggableContext *debugContext, const char *graphName);

#endif
4 changes: 2 additions & 2 deletions roxie/ccd/ccdfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3355,7 +3355,7 @@ class CAgentDynamicFile : public CResolvedFile
ServerIdentifier serverId;

public:
CAgentDynamicFile(const IRoxieContextLogger &logctx, const char *_lfn, RoxiePacketHeader *header, bool _isOpt, bool _isLocal)
CAgentDynamicFile(const CBaseRoxieContextLogger &logctx, const char *_lfn, RoxiePacketHeader *header, bool _isOpt, bool _isLocal)
: CResolvedFile(_lfn, NULL, NULL, ROXIE_FILE, NULL, true, false, AccessMode::readRandom, false), isOpt(_isOpt), isLocal(_isLocal), channel(header->channel), serverId(header->serverId)
{
// call back to the server to get the info
Expand Down Expand Up @@ -3490,7 +3490,7 @@ class CAgentDynamicFileCache : implements IAgentDynamicFileCache, public CInterf
IMPLEMENT_IINTERFACE;
CAgentDynamicFileCache(unsigned _limit) : tableSize(_limit) {}

virtual IResolvedFile *lookupDynamicFile(const IRoxieContextLogger &logctx, const char *lfn, CDateTime &cacheDate, unsigned checksum, RoxiePacketHeader *header, bool isOpt, bool isLocal) override
virtual IResolvedFile *lookupDynamicFile(const CBaseRoxieContextLogger &logctx, const char *lfn, CDateTime &cacheDate, unsigned checksum, RoxiePacketHeader *header, bool isOpt, bool isLocal) override
{
if (doTrace(traceRoxieFiles))
{
Expand Down
4 changes: 2 additions & 2 deletions roxie/ccd/ccdkey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ class InMemoryIndexManager : implements IInMemoryIndexManager, public CInterface
}

virtual IDirectReader *selectKey(MemoryBuffer &sig, ScoredRowFilter &postFilters, const ITranslatorSet *translators) const override;
virtual IDirectReader *selectKey(ScoredRowFilter &filter, const ITranslatorSet *translators, IRoxieContextLogger &logctx) const override;
virtual IDirectReader *selectKey(ScoredRowFilter &filter, const ITranslatorSet *translators, CBaseRoxieContextLogger &logctx) const override;

InMemoryIndex &findIndex(const char *indexSig) const
{
Expand Down Expand Up @@ -1253,7 +1253,7 @@ IDirectReader *InMemoryIndexManager::selectKey(MemoryBuffer &serializedInfo, Sco
return new InMemoryIndexCursor(this, &thisIndex, baseMap, postFilters, recInfo, translators, &serializedInfo);
}

IDirectReader *InMemoryIndexManager::selectKey(ScoredRowFilter &filter, const ITranslatorSet *translators, IRoxieContextLogger &logctx) const
IDirectReader *InMemoryIndexManager::selectKey(ScoredRowFilter &filter, const ITranslatorSet *translators, CBaseRoxieContextLogger &logctx) const
{
if (!inMemoryKeysEnabled)
return nullptr;
Expand Down
2 changes: 1 addition & 1 deletion roxie/ccd/ccdkey.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ interface IInMemoryIndexManager : extends IInterface
{
virtual void load(IFileIOArray *, IOutputMetaData *preloadLayout, bool preload) = 0;
virtual bool IsShared() const = 0;
virtual IDirectReader *selectKey(ScoredRowFilter &filter, const ITranslatorSet *translators, IRoxieContextLogger &logctx) const = 0;
virtual IDirectReader *selectKey(ScoredRowFilter &filter, const ITranslatorSet *translators, CBaseRoxieContextLogger &logctx) const = 0;
virtual IDirectReader *selectKey(MemoryBuffer &sig, ScoredRowFilter &filter, const ITranslatorSet *translators) const = 0;
virtual IDirectReader *createReader(const RowFilter &postFilter, bool _grouped, offset_t readPos, unsigned partNo, unsigned numParts, const ITranslatorSet *translators) const = 0;
virtual void setKeyInfo(IPropertyTree &indexInfo) = 0;
Expand Down
Loading

0 comments on commit a72b6ae

Please sign in to comment.