Bläddra i källkod

HPCC-18858 Remove activityId and ctx from readahead

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 7 år sedan
förälder
incheckning
6e79937c34

+ 1 - 1
common/remote/sockfile.cpp

@@ -3558,7 +3558,7 @@ class CRemoteDiskReadActivity : public CSimpleInterfaceOf<IRemoteActivity>
 
             inputStream.setown(createFileSerialStream(iFileIO, startPos));
             prefetchBuffer.setStream(inputStream);
-            prefetcher.setown(helper->queryDiskRecordSize()->createDiskPrefetcher(nullptr, 0));
+            prefetcher.setown(helper->queryDiskRecordSize()->createDiskPrefetcher());
 
             outBuilder = new MemoryBufferBuilder(resultBuffer, helper->queryOutputMeta()->getMinRecordSize());
             chooseN = helper->getChooseNLimit();

+ 1 - 1
common/thorhelper/roxierow.cpp

@@ -637,7 +637,7 @@ protected:
         virtual void destruct(byte * self) {}
         virtual IOutputRowSerializer * createDiskSerializer(ICodeContext * ctx, unsigned activityId) { return NULL; }
         virtual IOutputRowDeserializer * createDiskDeserializer(ICodeContext * ctx, unsigned activityId) { return NULL; }
-        virtual ISourceRowPrefetcher * createDiskPrefetcher(ICodeContext * ctx, unsigned activityId) { return NULL; }
+        virtual ISourceRowPrefetcher * createDiskPrefetcher() { return NULL; }
         virtual IOutputRowSerializer * createInternalSerializer(ICodeContext * ctx, unsigned activityId) { return NULL; }
         virtual IOutputRowDeserializer * createInternalDeserializer(ICodeContext * ctx, unsigned activityId) { return NULL; }
         virtual void walkIndirectMembers(const byte * self, IIndirectMemberVisitor & visitor) {}

+ 1 - 1
common/thorhelper/thorcommon.cpp

@@ -991,7 +991,7 @@ public:
             strm.setown(createFileSerialStream(fileio,_ofs,_len,(size32_t)-1, _tallycrc?&crccb:NULL));
         else
             strm.setown(createFileSerialStream(mmfile,_ofs,_len,_tallycrc?&crccb:NULL));
-        prefetcher.setown(rowif->queryRowMetaData()->createDiskPrefetcher(rowif->queryCodeContext(), rowif->queryActivityId()));
+        prefetcher.setown(rowif->queryRowMetaData()->createDiskPrefetcher());
         if (prefetcher)
             prefetchBuffer.setStream(strm);
         source.setStream(strm);

+ 4 - 4
common/thorhelper/thorcommon.ipp

@@ -337,9 +337,9 @@ public:
     {
         return new CPrefixedRowDeserializer(offset, original->createDiskDeserializer(ctx, activityId));
     }
-    virtual ISourceRowPrefetcher * createDiskPrefetcher(ICodeContext * ctx, unsigned activityId) 
+    virtual ISourceRowPrefetcher * createDiskPrefetcher()
     {
-        return new CPrefixedRowPrefetcher(offset, original->createDiskPrefetcher(ctx, activityId));
+        return new CPrefixedRowPrefetcher(offset, original->createDiskPrefetcher());
     }
     virtual IOutputMetaData * querySerializedDiskMeta()
     {
@@ -475,9 +475,9 @@ public:
     {
         return new CSuffixedRowDeserializer(offset, original->createDiskDeserializer(ctx, activityId));
     }
-    virtual ISourceRowPrefetcher * createDiskPrefetcher(ICodeContext * ctx, unsigned activityId) 
+    virtual ISourceRowPrefetcher * createDiskPrefetcher()
     {
-        return new CSuffixedRowPrefetcher(offset, original->createDiskPrefetcher(ctx, activityId));
+        return new CSuffixedRowPrefetcher(offset, original->createDiskPrefetcher());
     }
     virtual IOutputMetaData * querySerializedDiskMeta()
     {

+ 1 - 1
ecl/eclagent/eclagent.ipp

@@ -695,7 +695,7 @@ public:
     virtual void destruct(byte * self) {}
     virtual IOutputRowSerializer * createDiskSerializer(ICodeContext * ctx, unsigned activityId) { return NULL; }
     virtual IOutputRowDeserializer * createDiskDeserializer(ICodeContext * ctx, unsigned activityId) { return NULL; }
-    virtual ISourceRowPrefetcher * createDiskPrefetcher(ICodeContext * ctx, unsigned activityId) { return NULL; }
+    virtual ISourceRowPrefetcher * createDiskPrefetcher() { return NULL; }
     virtual IOutputMetaData * querySerializedDiskMeta() { return this; }
     virtual IOutputRowSerializer * createInternalSerializer(ICodeContext * ctx, unsigned activityId) { return NULL; }
     virtual IOutputRowDeserializer * createInternalDeserializer(ICodeContext * ctx, unsigned activityId) { return NULL; }

+ 3 - 0
ecl/hqlcpp/hqlcerrors.hpp

@@ -329,6 +329,8 @@
 #define HQLERR_AccessUnavailableGraph           4839
 #define HQLERR_NoMappingForField                4840
 #define HQLERR_InvalidMatchedPatternInJoin      4841
+#define HQLERR_CodeContextNotAvailable          4842
+
 //#define HQLERR_Max                            4999
 
 //---- Text for all errors (make it easy to internationalise) ---------------------------
@@ -626,6 +628,7 @@
 #define HQLERR_CouldNotGenerateDefault_Text     "INTERNAL: Could not generate default value for field %s"
 #define HQLERR_AccessUnavailableGraph_Text      "INTERNAL: Attempt to access result from unavailable graph (%s)"
 #define HQLERR_NoMappingForField_Text           "INTERNAL: Mapping for field %s is missing from transform"
+#define HQLERR_CodeContextNotAvailable_Text     "INTERNAL: ICodeContext is not available"
 
 #define WARNINGAT(cat, e, x)                 reportWarning(cat, SeverityUnknown, e, x, x##_Text)
 #define WARNINGAT1(cat, e, x, a)             reportWarning(cat, SeverityUnknown, e, x, x##_Text, a)

+ 25 - 24
ecl/hqlcpp/hqlhtcpp.cpp

@@ -2872,8 +2872,8 @@ void initBoundStringTarget(CHqlBoundTarget & target, ITypeInfo * type, const cha
 
 //---------------------------------------------------------------------------
 
-GlobalClassBuilder::GlobalClassBuilder(HqlCppTranslator & _translator, BuildCtx & _ctx, const char * _className, const char * _baseName, const char * _accessorInterface)
-: translator(_translator), classctx(_ctx), nestedctx(_ctx), startctx(_ctx), createctx(_ctx)
+GlobalClassBuilder::GlobalClassBuilder(HqlCppTranslator & _translator, BuildCtx & _ctx, const char * _className, const char * _baseName, const char * _accessorInterface, bool _hasCodeContext)
+: translator(_translator), classctx(_ctx), nestedctx(_ctx), startctx(_ctx), createctx(_ctx), hasCodeContext(_hasCodeContext)
 {
     className.set(_className);
     baseName.set(_baseName);
@@ -2898,9 +2898,12 @@ void GlobalClassBuilder::buildClass(unsigned priority)
     if (priority)
         classctx.setNextPriority(priority);
     classStmt = classctx.addQuotedCompound(s, ";");
-    if (!baseName)
-        classctx.addQuotedLiteral("ICodeContext * ctx;");
-    classctx.associateExpr(codeContextMarkerExpr, codeContextMarkerExpr);
+    if (hasCodeContext)
+    {
+        if (!baseName)
+            classctx.addQuotedLiteral("ICodeContext * ctx;");
+        classctx.associateExpr(codeContextMarkerExpr, codeContextMarkerExpr);
+    }
 
     //Generate functions in the order i) always callable ii) after create iii) after start
     nestedctx.set(classctx);
@@ -2913,11 +2916,17 @@ void GlobalClassBuilder::buildClass(unsigned priority)
     evalContext.setown(new GlobalClassEvalContext(translator, parentExtract, parentEvalContext, createctx, startctx));
     classctx.associate(*evalContext);
 
-    //virtual void onCreate(ICodeContext * ctx, IHThorArg * colocalParent, MemoryBuffer * serializedCreate)
+    //virtual void onCreate(ICodeContext * ctx)
     BuildCtx oncreatectx(createctx);
-    onCreateStmt = oncreatectx.addQuotedCompoundLiteral("void onCreate(ICodeContext * _ctx)");
+    if (hasCodeContext)
+    {
+        onCreateStmt = oncreatectx.addQuotedCompoundLiteral("void onCreate(ICodeContext * _ctx)");
+        oncreatectx.addQuotedLiteral("ctx = _ctx;");
+    }
+    else
+        onCreateStmt = oncreatectx.addQuotedCompoundLiteral("void onCreate()");
+
     oncreatectx.associateExpr(insideOnCreateMarker, NULL);
-    oncreatectx.addQuotedLiteral("ctx = _ctx;");
 
     evalContext->onCreate.createFunctionStructure(translator, oncreatectx, true, NULL);
     onCreateStmt->finishedFramework();
@@ -3469,7 +3478,7 @@ IHqlExpression * HqlCppTranslator::createRowAllocator(BuildCtx & ctx, IHqlExpres
 void HqlCppTranslator::buildMetaSerializerClass(BuildCtx & ctx, IHqlExpression * record, const char * serializerName, IAtom * serializeForm)
 {
     StringBuffer s;
-    GlobalClassBuilder serializer(*this, ctx, serializerName, "COutputRowSerializer", "IOutputRowSerializer");
+    GlobalClassBuilder serializer(*this, ctx, serializerName, "COutputRowSerializer", "IOutputRowSerializer", true);    // not sure this needs ctx or an activity id
 
     serializer.buildClass(RowMetaPrio);
     serializer.setIncomplete(true);
@@ -3512,7 +3521,7 @@ void HqlCppTranslator::buildMetaSerializerClass(BuildCtx & ctx, IHqlExpression *
 void HqlCppTranslator::buildMetaDeserializerClass(BuildCtx & ctx, IHqlExpression * record, const char * deserializerName, IAtom * serializeForm)
 {
     StringBuffer s;
-    GlobalClassBuilder deserializer(*this, ctx, deserializerName, "COutputRowDeserializer", "IOutputRowDeserializer");
+    GlobalClassBuilder deserializer(*this, ctx, deserializerName, "COutputRowDeserializer", "IOutputRowDeserializer", true);
 
     deserializer.buildClass(RowMetaPrio);
     deserializer.setIncomplete(true);
@@ -3543,18 +3552,12 @@ void HqlCppTranslator::buildMetaDeserializerClass(BuildCtx & ctx, IHqlExpression
 bool HqlCppTranslator::buildMetaPrefetcherClass(BuildCtx & ctx, IHqlExpression * record, const char * prefetcherName)
 {
     StringBuffer s;
-    GlobalClassBuilder prefetcher(*this, ctx, prefetcherName, "CSourceRowPrefetcher", NULL);
+    GlobalClassBuilder prefetcher(*this, ctx, prefetcherName, "CSourceRowPrefetcher", NULL, false);
 
     prefetcher.buildClass(RowMetaPrio);
     prefetcher.setIncomplete(true);
 
     BuildCtx & classctx = prefetcher.classctx;
-    s.clear().append("inline ").append(prefetcherName).append("(unsigned _activityId) : CSourceRowPrefetcher(_activityId) {}");
-    classctx.addQuoted(s);
-
-    OwnedHqlExpr id = createVariable("activityId", LINK(sizetType));
-    prefetcher.classctx.associateExpr(queryActivityIdMarker(), id);
-
     OwnedHqlExpr dataset = createDataset(no_null, LINK(record));
     bool ok;
     {
@@ -4507,10 +4510,10 @@ void HqlCppTranslator::generateMetaRecordSerialize(BuildCtx & ctx, IHqlExpressio
     if (prefetcherName && *prefetcherName)
     {
         BuildCtx deserializectx(ctx);
-        deserializectx.addQuotedFunction("virtual CSourceRowPrefetcher * doCreateDiskPrefetcher(unsigned activityId) override");
+        deserializectx.addQuotedFunction("virtual CSourceRowPrefetcher * doCreateDiskPrefetcher() override");
 
         StringBuffer s;
-        s.append("return new ").append(prefetcherName).append("(activityId);");
+        s.append("return new ").append(prefetcherName).append("();");
         deserializectx.addQuoted(s);
     }
 }
@@ -4625,10 +4628,7 @@ void HqlCppTranslator::ensureRowPrefetcher(StringBuffer & prefetcherName, BuildC
     buildMetaInfo(meta);
 
     s.clear().append(uid).append(".setown(").append(meta.queryInstanceObject());
-    s.append(".createDiskPrefetcher(ctx, ");
-    OwnedHqlExpr activityId = getCurrentActivityId(ctx);
-    generateExprCpp(s, activityId);
-    s.append("));");
+    s.append(".createDiskPrefetcher());");
     callctx->addQuoted(s);
 
     OwnedHqlExpr value = createVariable(uid.str(), makeBoolType());
@@ -7345,6 +7345,7 @@ IHqlExpression * HqlCppTranslator::getClearRecordFunction(IHqlExpression * recor
     {
         MemberFunction clearFunc(*this, clearctx, s, MFdynamicproto);
         clearFunc.setIncomplete(true);
+        clearFunc.ctx.associateExpr(codeContextMarkerExpr, codeContextMarkerExpr);
 
         OwnedHqlExpr dataset = createDataset(no_anon, LINK(record));
         BoundRow * cursor = bindSelf(clearFunc.ctx, dataset, "crSelf");
@@ -10348,7 +10349,7 @@ ABoundActivity * HqlCppTranslator::doBuildActivityOutputIndex(BuildCtx & ctx, IH
 
     buildExpiryHelper(instance->createctx, expr->queryAttribute(expireAtom));
     buildUpdateHelper(instance->createctx, *instance, dataset, updateAttr);
-    buildClusterHelper(instance->classctx, expr);
+    buildClusterHelper(instance->startctx, expr);
 
     // virtual unsigned getKeyedSize()
     HqlExprArray fields;

+ 2 - 1
ecl/hqlcpp/hqlhtcpp.ipp

@@ -90,7 +90,7 @@ class GlobalClassEvalContext;
 class GlobalClassBuilder
 {
 public:
-    GlobalClassBuilder(HqlCppTranslator & _translator, BuildCtx & ctx, const char * className, const char * baseName, const char * _accessorInterface);
+    GlobalClassBuilder(HqlCppTranslator & _translator, BuildCtx & ctx, const char * className, const char * baseName, const char * _accessorInterface, bool _hasCodeContext);
 
     void buildClass(unsigned priority=0);
     void completeClass(unsigned priority=0);
@@ -114,6 +114,7 @@ public:
     StringAttr baseName;
     StringAttr accessorInterface;
     StringAttr accessorName;
+    bool hasCodeContext;
 };
 
 

+ 2 - 0
ecl/hqlcpp/hqlinline.cpp

@@ -2056,6 +2056,8 @@ void HqlCppTranslator::ensureContextAvailable(BuildCtx & ctx)
     EvalContext * instance = queryEvalContext(ctx);
     if (instance)
         instance->ensureContextAvailable();
+    if (!ctx.queryMatchExpr(codeContextMarkerExpr))
+        throwError(HQLERR_CodeContextNotAvailable);
 }
 
 /*

+ 3 - 1
ecl/hqlcpp/hqlsource.cpp

@@ -41,6 +41,7 @@
 #include "hqlfold.hpp"
 #include "hqlcerrors.hpp"
 #include "hqlcatom.hpp"
+#include "hqlccommon.hpp"
 #include "hqltrans.ipp"
 #include "hqlpmap.hpp"
 #include "hqlttcpp.ipp"
@@ -2286,6 +2287,7 @@ void SourceBuilder::buildGroupAggregateProcessHelper(ParentExtract * extractBuil
         MemberEvalContext * evalContext = new MemberEvalContext(translator, extractBuilder, translator.queryEvalContext(validateFunc.ctx), validateFunc.ctx);
         validateFunc.ctx.associateOwn(*evalContext);
         evalContext->initContext();
+        validateFunc.ctx.associateExpr(codeContextMarkerExpr, codeContextMarkerExpr);
     }
 
     if (aggregate->getOperator() == no_aggregate)
@@ -6878,7 +6880,7 @@ void HqlCppTranslator::buildXmlReadTransform(IHqlExpression * dataset, StringBuf
     prolog.append("struct ").append(className).append(" : public RtlCInterface, implements ").append(interfaceName);
     epilog.append(";");
 
-    GlobalClassBuilder builder(*this, declarectx, className, "CXmlToRowTransformer", interfaceName);
+    GlobalClassBuilder builder(*this, declarectx, className, "CXmlToRowTransformer", interfaceName, true);
     builder.buildClass(XmlTransformerPrio);
     builder.setIncomplete(true);
 

+ 4 - 13
ecl/hqlcpp/hqltcppc.cpp

@@ -1387,19 +1387,10 @@ void CIfBlockInfo::buildSerialize(HqlCppTranslator & translator, BuildCtx & ctx,
 
 bool CIfBlockInfo::buildReadAhead(HqlCppTranslator & translator, BuildCtx & ctx, ReadAheadState & state)
 {
-    try
-    {
-        OwnedHqlExpr mappedCondition = state.selector->queryRootRow()->bindToRow(condition, queryRootSelf());
-        BuildCtx condctx(ctx);
-        translator.buildFilter(condctx, mappedCondition);
-        return CContainerInfo::buildReadAhead(translator, condctx, state);
-    }
-    catch (IException * e)
-    {
-        //yuk yuk yuk!!  Could't resolve the test condition for very unusual reason, e.g., based on a variable length string.
-        e->Release();
-    }
-    return false;
+    OwnedHqlExpr mappedCondition = state.selector->queryRootRow()->bindToRow(condition, queryRootSelf());
+    BuildCtx condctx(ctx);
+    translator.buildFilter(condctx, mappedCondition);
+    return CContainerInfo::buildReadAhead(translator, condctx, state);
 }
 
 void CIfBlockInfo::setColumn(HqlCppTranslator & translator, BuildCtx & ctx, IReferenceSelector * selector, IHqlExpression * value)

+ 2 - 2
ecl/hthor/hthor.cpp

@@ -8444,7 +8444,7 @@ void CHThorBinaryDiskReadBase::ready()
     fieldFilters.kill();
     numFieldsRequired = 0;
     segHelper.createSegmentMonitors(this);
-    prefetcher.setown(diskMeta->createDiskPrefetcher(agent.queryCodeContext(), activityId));
+    prefetcher.setown(diskMeta->createDiskPrefetcher());
     deserializer.setown(diskMeta->createDiskDeserializer(agent.queryCodeContext(), activityId));
 }
 
@@ -9606,7 +9606,7 @@ public:
     virtual void destruct(byte * self)  {}
     virtual IOutputRowSerializer * createDiskSerializer(ICodeContext * ctx, unsigned activityId) { return NULL; }
     virtual IOutputRowDeserializer * createDiskDeserializer(ICodeContext * ctx, unsigned activityId) { return NULL; }
-    virtual ISourceRowPrefetcher * createDiskPrefetcher(ICodeContext * ctx, unsigned activityId) { return NULL; }
+    virtual ISourceRowPrefetcher * createDiskPrefetcher() { return NULL; }
     virtual IOutputMetaData * querySerializedDiskMeta() { return this; }
     virtual IOutputRowSerializer * createInternalSerializer(ICodeContext * ctx, unsigned activityId) { return NULL; }
     virtual IOutputRowDeserializer * createInternalDeserializer(ICodeContext * ctx, unsigned activityId) { return NULL; }

+ 4 - 4
roxie/ccd/ccdactivities.cpp

@@ -1919,7 +1919,7 @@ public:
     UnkeyedNormalizeRecordProcessor(IInMemoryIndexCursor *_cursor, CRoxieDiskNormalizeActivity &_owner, IDirectReader *_reader) 
         : NormalizeRecordProcessor(_cursor, _owner), reader(_reader), deserializeSource(_reader)
     {
-        prefetcher.setown(owner.diskSize.queryOriginal()->createDiskPrefetcher(owner.queryContext->queryCodeContext(), owner.basefactory->queryId()));
+        prefetcher.setown(owner.diskSize.queryOriginal()->createDiskPrefetcher());
     }
 
     virtual void doQuery(IMessagePacker *output, unsigned processed, unsigned __int64 rowLimit, unsigned __int64 stopAfter)
@@ -2195,7 +2195,7 @@ public:
     UnkeyedVariableCountRecordProcessor(IInMemoryIndexCursor *_cursor, CRoxieDiskCountActivity &_owner, IDirectReader *_reader)
         : UnkeyedCountRecordProcessor(_cursor, _owner, _reader), deserializeSource(reader)
     {
-        prefetcher.setown(owner.diskSize.queryOriginal()->createDiskPrefetcher(owner.queryContext->queryCodeContext(), owner.basefactory->queryId()));
+        prefetcher.setown(owner.diskSize.queryOriginal()->createDiskPrefetcher());
     }
 
     // This version is used for variable size rows 
@@ -2666,7 +2666,7 @@ public:
     UnkeyedVariableAggregateRecordProcessor(IInMemoryIndexCursor *_cursor, CRoxieDiskAggregateActivity &_owner, IDirectReader *_reader) 
         : UnkeyedAggregateRecordProcessor(_cursor, _owner, _reader), deserializeSource(_reader)
     {
-        prefetcher.setown(owner.diskSize.queryOriginal()->createDiskPrefetcher(owner.queryContext->queryCodeContext(), owner.basefactory->queryId()));
+        prefetcher.setown(owner.diskSize.queryOriginal()->createDiskPrefetcher());
     }
 
     virtual void doQuery(IMessagePacker *output, unsigned processed, unsigned __int64 rowLimit, unsigned __int64 stopAfter)
@@ -3021,7 +3021,7 @@ public:
                                                  ICodeContext *ctx, unsigned activityId)
     : UnkeyedGroupAggregateRecordProcessor(_cursor, _results, _helper, _reader), deserializeSource(_reader)
     {
-        prefetcher.setown(helper.queryDiskRecordSize()->createDiskPrefetcher(ctx, activityId));
+        prefetcher.setown(helper.queryDiskRecordSize()->createDiskPrefetcher());
     }
 
     virtual void doQuery(IMessagePacker *output, unsigned processed, unsigned __int64 rowLimit, unsigned __int64 stopAfter)

+ 2 - 2
roxie/ccd/ccdfile.cpp

@@ -1725,9 +1725,9 @@ public:
         IOutputMetaData *actualLayout = actualLayouts.item(subFile);
         assertex(actualLayout);
         if (addGroupFlag && actualLayout->isGrouped())
-            return new CSuffixedRowPrefetcher(1, actualLayout->createDiskPrefetcher(ctx, actId));
+            return new CSuffixedRowPrefetcher(1, actualLayout->createDiskPrefetcher());
         else
-            return actualLayout->createDiskPrefetcher(ctx, actId);
+            return actualLayout->createDiskPrefetcher();
     }
 
     virtual IOutputMetaData *queryActualLayout(unsigned subFile) const override

+ 2 - 2
roxie/ccd/ccdserver.cpp

@@ -15434,7 +15434,7 @@ public:
     virtual void destruct(byte * self)  {}
     virtual IOutputRowSerializer * createDiskSerializer(ICodeContext * ctx, unsigned activityId) { return NULL; }
     virtual IOutputRowDeserializer * createDiskDeserializer(ICodeContext * ctx, unsigned activityId) { return NULL; }
-    virtual ISourceRowPrefetcher * createDiskPrefetcher(ICodeContext * ctx, unsigned activityId) { return NULL; }
+    virtual ISourceRowPrefetcher * createDiskPrefetcher() { return NULL; }
     virtual IOutputMetaData * querySerializedDiskMeta() { return this; }
     virtual IOutputRowSerializer * createInternalSerializer(ICodeContext * ctx, unsigned activityId) { return NULL; }
     virtual IOutputRowDeserializer * createInternalDeserializer(ICodeContext * ctx, unsigned activityId) { return NULL; }
@@ -27750,7 +27750,7 @@ public:
     virtual void destruct(byte * self)  {}
     virtual IOutputRowSerializer * createDiskSerializer(ICodeContext * ctx, unsigned activityId) { return NULL; }
     virtual IOutputRowDeserializer * createDiskDeserializer(ICodeContext * ctx, unsigned activityId) { return NULL; }
-    virtual ISourceRowPrefetcher * createDiskPrefetcher(ICodeContext * ctx, unsigned activityId) { return NULL; }
+    virtual ISourceRowPrefetcher * createDiskPrefetcher() { return NULL; }
     virtual IOutputMetaData * querySerializedDiskMeta() { return NULL; }
     virtual IOutputRowSerializer * createInternalSerializer(ICodeContext * ctx, unsigned activityId) { return NULL; }
     virtual IOutputRowDeserializer * createInternalDeserializer(ICodeContext * ctx, unsigned activityId) { return NULL; }

+ 11 - 11
rtl/eclrtl/rtlrecord.cpp

@@ -798,9 +798,9 @@ IOutputRowSerializer * COutputMetaData::createDiskSerializer(ICodeContext * ctx,
     return new CVariableOutputRowSerializer(activityId, this);
 }
 
-ISourceRowPrefetcher * COutputMetaData::createDiskPrefetcher(ICodeContext * ctx, unsigned activityId)
+ISourceRowPrefetcher * COutputMetaData::createDiskPrefetcher()
 {
-    ISourceRowPrefetcher * fetcher = defaultCreateDiskPrefetcher(ctx, activityId);
+    ISourceRowPrefetcher * fetcher = defaultCreateDiskPrefetcher();
     if (fetcher)
         return fetcher;
     return new CDefaultPrefetcher(queryRecordAccessor(true));
@@ -811,14 +811,14 @@ IOutputRowDeserializer *COutputMetaData::createDiskDeserializer(ICodeContext * c
     return new CDefaultDeserializer(queryRecordAccessor(true));
 }
 
-ISourceRowPrefetcher *COutputMetaData::defaultCreateDiskPrefetcher(ICodeContext * ctx, unsigned activityId)
+ISourceRowPrefetcher *COutputMetaData::defaultCreateDiskPrefetcher()
 {
     if (getMetaFlags() & MDFneedserializedisk)
-        return querySerializedDiskMeta()->createDiskPrefetcher(ctx, activityId);
-    CSourceRowPrefetcher * fetcher = doCreateDiskPrefetcher(activityId);
+        return querySerializedDiskMeta()->createDiskPrefetcher();
+    CSourceRowPrefetcher * fetcher = doCreateDiskPrefetcher();
     if (fetcher)
     {
-        fetcher->onCreate(ctx);
+        fetcher->onCreate();
         return fetcher;
     }
     return NULL;
@@ -834,12 +834,12 @@ IOutputRowDeserializer *CFixedOutputMetaData::createDiskDeserializer(ICodeContex
     return new CFixedOutputRowDeserializer(activityId, fixedSize);
 }
 
-ISourceRowPrefetcher *CFixedOutputMetaData::createDiskPrefetcher(ICodeContext * ctx, unsigned activityId)
+ISourceRowPrefetcher *CFixedOutputMetaData::createDiskPrefetcher()
 {
-    ISourceRowPrefetcher * fetcher = defaultCreateDiskPrefetcher(ctx, activityId);
+    ISourceRowPrefetcher * fetcher = defaultCreateDiskPrefetcher();
     if (fetcher)
         return fetcher;
-    return new CFixedSourceRowPrefetcher(activityId, fixedSize);
+    return new CFixedSourceRowPrefetcher(fixedSize);
 }
 
 IOutputRowSerializer * CActionOutputMetaData::createDiskSerializer(ICodeContext * ctx, unsigned activityId)
@@ -852,9 +852,9 @@ IOutputRowDeserializer * CActionOutputMetaData::createDiskDeserializer(ICodeCont
     return new CFixedOutputRowDeserializer(activityId, 0);
 }
 
-ISourceRowPrefetcher * CActionOutputMetaData::createDiskPrefetcher(ICodeContext * ctx, unsigned activityId)
+ISourceRowPrefetcher * CActionOutputMetaData::createDiskPrefetcher()
 {
-    return new CFixedSourceRowPrefetcher(activityId, 0);
+    return new CFixedSourceRowPrefetcher(0);
 }
 
 

+ 8 - 13
rtl/eclrtl/rtlrecord.hpp

@@ -73,16 +73,11 @@ protected:
 class CSourceRowPrefetcher : implements ISourceRowPrefetcher, public RtlCInterface
 {
 public:
-    inline CSourceRowPrefetcher(unsigned _activityId) { activityId = _activityId; ctx = NULL; }
+    inline CSourceRowPrefetcher() { }
     RTLIMPLEMENT_IINTERFACE
 
-    virtual void onCreate(ICodeContext * _ctx) { ctx = _ctx; }
-
+    virtual void onCreate() {}
     virtual void readAhead(IRowPrefetcherSource & in) override = 0;
-
-protected:
-    ICodeContext * ctx;
-    unsigned activityId;
 };
 
 
@@ -111,7 +106,7 @@ protected:
 class CFixedSourceRowPrefetcher : public CSourceRowPrefetcher
 {
 public:
-    inline CFixedSourceRowPrefetcher(unsigned _activityId, unsigned _fixedSize) : CSourceRowPrefetcher(_activityId) { fixedSize = _fixedSize; }
+    inline CFixedSourceRowPrefetcher(unsigned _fixedSize) { fixedSize = _fixedSize; }
 
     virtual void readAhead(IRowPrefetcherSource & in) { in.skip(fixedSize); }
 
@@ -368,7 +363,7 @@ public:
     virtual void destruct(byte * self) override                      {}
     virtual IOutputMetaData * querySerializedDiskMeta() override    { return this; }
     virtual IOutputRowSerializer * createDiskSerializer(ICodeContext * ctx, unsigned activityId) override;
-    virtual ISourceRowPrefetcher * createDiskPrefetcher(ICodeContext * ctx, unsigned activityId) override;
+    virtual ISourceRowPrefetcher * createDiskPrefetcher() override;
     virtual IOutputRowDeserializer * createDiskDeserializer(ICodeContext * ctx, unsigned activityId) override;
     //Default internal serializers are the same as the disk versions
     virtual IOutputRowSerializer * createInternalSerializer(ICodeContext * ctx, unsigned activityId) override
@@ -398,9 +393,9 @@ public:
 
 protected:
     //This is the prefetch function that is actually generated by the code generator
-    virtual CSourceRowPrefetcher * doCreateDiskPrefetcher(unsigned activityId) { return NULL; }
+    virtual CSourceRowPrefetcher * doCreateDiskPrefetcher() { return NULL; }
 
-    ISourceRowPrefetcher * defaultCreateDiskPrefetcher(ICodeContext * ctx, unsigned activityId);
+    ISourceRowPrefetcher * defaultCreateDiskPrefetcher();
     mutable RtlRecord *recordAccessor[2];
 };
 
@@ -434,7 +429,7 @@ public:
 
     virtual IOutputRowSerializer * createDiskSerializer(ICodeContext * ctx, unsigned activityId);
     virtual IOutputRowDeserializer * createDiskDeserializer(ICodeContext * ctx, unsigned activityId);
-    virtual ISourceRowPrefetcher * createDiskPrefetcher(ICodeContext * ctx, unsigned activityId);
+    virtual ISourceRowPrefetcher * createDiskPrefetcher();
 
 protected:
     size32_t fixedSize;
@@ -461,7 +456,7 @@ public:
     virtual void toXML(const byte * self, IXmlWriter & out) { }
     virtual IOutputRowSerializer * createDiskSerializer(ICodeContext * ctx, unsigned activityId);
     virtual IOutputRowDeserializer * createDiskDeserializer(ICodeContext * ctx, unsigned activityId);
-    virtual ISourceRowPrefetcher * createDiskPrefetcher(ICodeContext * ctx, unsigned activityId);
+    virtual ISourceRowPrefetcher * createDiskPrefetcher();
 };
 
 

+ 1 - 1
rtl/include/eclhelper.hpp

@@ -515,7 +515,7 @@ interface IOutputMetaData : public IRecordSize
     virtual IOutputMetaData * querySerializedDiskMeta() = 0;
     virtual IOutputRowSerializer * createDiskSerializer(ICodeContext * ctx, unsigned activityId) = 0;        // ctx is currently allowed to be NULL
     virtual IOutputRowDeserializer * createDiskDeserializer(ICodeContext * ctx, unsigned activityId) = 0;
-    virtual ISourceRowPrefetcher * createDiskPrefetcher(ICodeContext * ctx, unsigned activityId) = 0;
+    virtual ISourceRowPrefetcher * createDiskPrefetcher() = 0;
 
     virtual IOutputRowSerializer * createInternalSerializer(ICodeContext * ctx, unsigned activityId) = 0;        // ctx is currently allowed to be NULL
     virtual IOutputRowDeserializer * createInternalDeserializer(ICodeContext * ctx, unsigned activityId) = 0;

+ 2 - 2
thorlcr/thorutil/thmem.cpp

@@ -2558,10 +2558,10 @@ public:
             diskDeserializer.setown(new CDeserializer(childMeta->createDiskDeserializer(ctx, activityId), childAllocator, extraSz));
         return LINK(diskDeserializer);
     }
-    virtual ISourceRowPrefetcher * createDiskPrefetcher(ICodeContext * ctx, unsigned activityId)
+    virtual ISourceRowPrefetcher * createDiskPrefetcher()
     {
         if (!prefetcher)
-            prefetcher.setown(new CPrefetcher(childMeta->createDiskPrefetcher(ctx, activityId), extraSz));
+            prefetcher.setown(new CPrefetcher(childMeta->createDiskPrefetcher(), extraSz));
         return LINK(prefetcher);
     }
     virtual IOutputMetaData * querySerializedDiskMeta() { return this; }