Browse Source

Merge remote-tracking branch 'origin/candidate-3.10.0' into candidate-3.10.x

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 12 years ago
parent
commit
196599fd5c

+ 7 - 0
ecllibrary/std/system/Thorlib.ecl

@@ -18,6 +18,7 @@ varstring daliServer() : once, ctxmethod, entrypoint='getDaliServers';
 varstring cluster() : once, ctxmethod, entrypoint='getClusterName';
 varstring getExpandLogicalName(const varstring name) : pure, ctxmethod, entrypoint='getExpandLogicalName';
 varstring group() : once, ctxmethod, entrypoint='getGroupName';
+varstring platform() : pure ,ctxmethod, entrypoint='getPlatform';
     END;
 
 RETURN MODULE
@@ -68,6 +69,12 @@ export getExpandLogicalName(const varstring name) := externals.getExpandLogicalN
 export cluster() := externals.cluster();
 
 /*
+ * Returns the platform the query is currently executing on.
+ */
+
+export platform() := externals.platform();
+
+/*
  * The following are either unused, or should be replaced with a different syntax.
  
 export getenv(const varstring name, const varstring defaultValue) := externals.getenv(name, defaultValue);

+ 5 - 2
initfiles/sbin/hpcc_setenv.in

@@ -46,6 +46,11 @@ HPCC_CONFIG=${HPCC_CONFIG:-${CONFIG_DIR}/${ENV_CONF_FILE}}
 #SECTION=${1:-DEFAULT}
 SECTION="DEFAULT"
 
+OIFS="${IFS}"
+unset IFS
+source /etc/profile
+IFS="${OIFS}"
+
 PATH_PREFIX=`cat ${HPCC_CONFIG} | sed -n "/\[${SECTION}\]/,/\[/p" | grep "^path *= *" | sed -e 's/^path *= *//'`
 
 export PID=`cat ${HPCC_CONFIG} | sed -n "/\[${SECTION}\]/,/\[/p" | grep "^pid *= *" | sed -e 's/^pid *= *//'`
@@ -156,5 +161,3 @@ else
         fi
     fi
 fi
-
-source /etc/profile

+ 10 - 0
testing/ecl/hthor/key/platform.xml

@@ -0,0 +1,10 @@
+<Dataset name='Result 1'>
+ <Row><Result_1>hthor</Result_1></Row>
+</Dataset>
+<Dataset name='Result 2'>
+ <Row><x>hthor1</x></Row>
+ <Row><x>hthor2</x></Row>
+ <Row><x>hthor3</x></Row>
+ <Row><x>hthor4</x></Row>
+ <Row><x>hthor5</x></Row>
+</Dataset>

+ 10 - 0
testing/ecl/key/platform.xml

@@ -0,0 +1,10 @@
+<Dataset name='Result 1'>
+ <Row><Result_1>thor</Result_1></Row>
+</Dataset>
+<Dataset name='Result 2'>
+ <Row><x>thor1</x></Row>
+ <Row><x>thor2</x></Row>
+ <Row><x>thor3</x></Row>
+ <Row><x>thor4</x></Row>
+ <Row><x>thor5</x></Row>
+</Dataset>

+ 27 - 0
testing/ecl/platform.ecl

@@ -0,0 +1,27 @@
+/*##############################################################################
+
+    HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+############################################################################## */
+
+import std.system.thorlib;
+
+output(thorlib.platform());
+
+pl := thorlib.platform() : independent;
+
+ds := NOFOLD(dataset([1,2,3,4,5],{ unsigned id; }));
+p := table(ds, { string x := thorlib.platform() + (string)id });
+output(p);
+

+ 10 - 0
testing/ecl/roxie/key/platform.xml

@@ -0,0 +1,10 @@
+<Dataset name='Result 1'>
+ <Row><Result_1>roxie</Result_1></Row>
+</Dataset>
+<Dataset name='Result 2'>
+ <Row><x>roxie1</x></Row>
+ <Row><x>roxie2</x></Row>
+ <Row><x>roxie3</x></Row>
+ <Row><x>roxie4</x></Row>
+ <Row><x>roxie5</x></Row>
+</Dataset>

+ 11 - 1
thorlcr/activities/loop/thloop.cpp

@@ -149,6 +149,8 @@ class CLoopActivityMaster : public CLoopActivityMasterBase
     IHThorLoopArg *helper;
     IThorBoundLoopGraph *boundGraph;
     unsigned flags;
+    Owned<IBarrier> barrier;
+
     void checkEmpty()
     {
         // similar to sync, but continiously listens for messages from slaves
@@ -184,7 +186,7 @@ public:
     CLoopActivityMaster(CMasterGraphElement *info) : CLoopActivityMasterBase(info)
     {
         if (!container.queryLocalOrGrouped())
-            mpTag = container.queryJob().allocateMPTag();
+            barrier.setown(container.queryJob().createBarrier(mpTag));
     }
     void init()
     {
@@ -237,11 +239,19 @@ public:
                     initLoopResults(loopCounter);
                 boundGraph->execute(*this, (flags & IHThorLoopArg::LFcounter)?loopCounter:0, ownedResults, (IRowWriterMultiReader *)NULL, 0, extractBuilder.size(), extractBuilder.getbytes());
                 ++loopCounter;
+                if (!barrier->wait(false))
+                    break;
             }
         }
         else
             checkEmpty();
     }
+    virtual void abort()
+    {
+        CLoopActivityMasterBase::abort();
+        if (barrier)
+            barrier->cancel();
+    }
 };
 
 CActivityBase *createLoopActivityMaster(CMasterGraphElement *container)

+ 15 - 1
thorlcr/activities/loop/thloopslave.cpp

@@ -222,6 +222,7 @@ class CLoopSlaveActivity : public CLoopSlaveActivityBase
     unsigned flags, lastMs;
     IHThorLoopArg *helper;
     bool eof, finishedLooping;
+    Owned<IBarrier> barrier;
 
 public:
     IMPLEMENT_IINTERFACE_USING(CSimpleInterface);
@@ -239,6 +240,8 @@ public:
             if (container.queryOwner().isGlobal())
                 global = true;
         }
+        if (!container.queryLocalOrGrouped())
+            barrier.setown(container.queryJob().createBarrier(mpTag));
     }
     virtual void kill()
     {
@@ -246,6 +249,12 @@ public:
         loopPending.clear();
         curInput.clear();
     }
+    virtual void abort()
+    {
+        CLoopSlaveActivityBase::abort();
+        if (barrier)
+            barrier->cancel();
+    }
 // IThorDataLink
     virtual void start()
     {
@@ -364,7 +373,7 @@ public:
                 unsigned doLoopAgain = (flags & IHThorLoopArg::LFnewloopagain) ? helper->loopAgainResult() : 0;
                 ownedResults.setown(queryGraph().createThorGraphResults(3));
                 // ensures remote results are available, via owning activity (i.e. this loop act)
-                // so that when aggreagate result is fetched from the master, it will retreive from the act, not the (already cleaned) graph localresults
+                // so that when aggregate result is fetched from the master, it will retrieve from the act, not the (already cleaned) graph localresults
                 ownedResults->setOwner(container.queryId());
 
                 boundGraph->prepareLoopResults(*this, ownedResults);
@@ -380,6 +389,11 @@ public:
 
                 if (flags & IHThorLoopArg::LFnewloopagain)
                 {
+                    if (!container.queryLocalOrGrouped())
+                    {
+                        if (!barrier->wait(false))
+                            return NULL; // aborted
+                    }
                     Owned<IThorResult> loopAgainResult = ownedResults->getResult(helper->loopAgainResult(), !queryGraph().isLocalChild());
                     assertex(loopAgainResult);
                     Owned<IRowStream> loopAgainRows = loopAgainResult->getRowStream();