Browse Source

HPCC-9125 Add a check to ensure eclcc and gcc use the same include version

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 12 years ago
parent
commit
f6265e5bad
3 changed files with 14 additions and 4 deletions
  1. 9 2
      ecl/eclagent/eclagent.cpp
  2. 2 0
      ecl/hqlcpp/hqlhtcpp.cpp
  3. 3 2
      rtl/include/eclhelper.hpp

+ 9 - 2
ecl/eclagent/eclagent.cpp

@@ -1820,6 +1820,7 @@ void EclAgent::doProcess()
     try
     {
         LOG(MCrunlock, unknownJob, "Waiting for workunit lock");
+        unsigned eclccCodeVersion;
         {
             WorkunitUpdate w = updateWorkUnit();
             LOG(MCrunlock, unknownJob, "Obtained workunit lock");
@@ -1828,8 +1829,10 @@ void EclAgent::doProcess()
             w->setTracingValue("EclAgentBuild", BUILD_TAG);
             if (agentTopology->hasProp("@name"))
                 w->addProcess("EclAgent", agentTopology->queryProp("@name"), logname.str());
-            if (checkVersion && ((w->getCodeVersion() > ACTIVITY_INTERFACE_VERSION) || (w->getCodeVersion() < MIN_ACTIVITY_INTERFACE_VERSION)))
-                failv(0, "Workunit was compiled for eclagent interface version %d, this eclagent requires version %d..%d", w->getCodeVersion(), MIN_ACTIVITY_INTERFACE_VERSION, ACTIVITY_INTERFACE_VERSION);
+
+            eclccCodeVersion = w->getCodeVersion();
+            if (checkVersion && ((eclccCodeVersion > ACTIVITY_INTERFACE_VERSION) || (eclccCodeVersion < MIN_ACTIVITY_INTERFACE_VERSION)))
+                failv(0, "Workunit was compiled for eclagent interface version %d, this eclagent requires version %d..%d", eclccCodeVersion, MIN_ACTIVITY_INTERFACE_VERSION, ACTIVITY_INTERFACE_VERSION);
             if(noRetry && (w->getState() == WUStateFailed))
                 throw MakeStringException(0, "Ecl agent started in 'no retry' mode for failed workunit, so failing");
             w->setState(WUStateRunning);
@@ -1854,6 +1857,10 @@ void EclAgent::doProcess()
         {
             MTIME_SECTION(timer, "Process");
             Owned<IEclProcess> process = loadProcess();
+
+            if (checkVersion && (process->getActivityVersion() != eclccCodeVersion))
+                failv(0, "Inconsistent interface versions.  Workunit was created using eclcc for version %u, but the c++ compiler used version %u", eclccCodeVersion, process->getActivityVersion());
+
             PrintLog("Starting process");
             runProcess(process);
             failed = false;

+ 2 - 0
ecl/hqlcpp/hqlhtcpp.cpp

@@ -17158,6 +17158,8 @@ void HqlCppTranslator::buildWorkflow(WorkflowArray & workflow)
     BuildCtx classctx(*code, goAtom);
     classctx.addQuotedCompound("struct MyEclProcess : public EclProcess", ";");
 
+    classctx.addQuoted("virtual unsigned getActivityVersion() const { return ACTIVITY_INTERFACE_VERSION; }");
+
     BuildCtx performctx(classctx);
     performctx.addQuotedCompound("virtual int perform(IGlobalCodeContext * gctx, unsigned wfid)");
     performctx.addQuoted("ICodeContext * ctx;");

+ 3 - 2
rtl/include/eclhelper.hpp

@@ -39,8 +39,8 @@ if the supplied pointer was not from the roxiemem heap. Usually an OwnedRoxieStr
 
 //Should be incremented whenever the virtuals in the context or a helper are changed, so
 //that a work unit can't be rerun.  Try as hard as possible to retain compatibility.
-#define ACTIVITY_INTERFACE_VERSION      148
-#define MIN_ACTIVITY_INTERFACE_VERSION  148             //minimum value that is compatible with current interface - without using selectInterface
+#define ACTIVITY_INTERFACE_VERSION      149
+#define MIN_ACTIVITY_INTERFACE_VERSION  149             //minimum value that is compatible with current interface - without using selectInterface
 
 typedef unsigned char byte;
 
@@ -2745,6 +2745,7 @@ struct IGlobalCodeContext
 struct IEclProcess : public IInterface
 {
     virtual int perform(IGlobalCodeContext * gctx, unsigned wfid) = 0;
+    virtual unsigned getActivityVersion() const = 0;
 };