Bläddra i källkod

Merge branch 'candidate-5.4.4' into candidate-6.0.0

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 9 år sedan
förälder
incheckning
88daf4e964

+ 73 - 74
common/remote/sockfile.cpp

@@ -2933,7 +2933,7 @@ inline void appendErr3(MemoryBuffer &reply, RemoteFileCommandType e, int code, c
 
 
 
-#define MAPCOMMAND(c,p) case c: { ret =  this->p(msg, reply) ; break; }
+#define MAPCOMMAND(c,p) case c: { ret = this->p(msg, reply) ; break; }
 #define MAPCOMMANDCLIENT(c,p,client) case c: { ret = this->p(msg, reply, client); break; }
 #define MAPCOMMANDCLIENTTHROTTLE(c,p,client,throttler) case c: { ret = this->p(msg, reply, client, throttler); break; }
 #define MAPCOMMANDSTATS(c,p,stats) case c: { ret = this->p(msg, reply, stats); break; }
@@ -2946,39 +2946,38 @@ static CriticalSection ClientCountSect;
 #define DEFAULT_THROTTLOG_LOG_INTERVAL_SECS 60 // log total throttled delay period
 
 
-struct ClientStats
+class CClientStats : public CInterface
 {
-    ClientStats(const char *_client) : client(_client) { count = 0; bRead = 0; bWritten = 0; }
+    SpinLock spin;
+public:
+    CClientStats(const char *_client) : client(_client) { count = 0; bRead = 0; bWritten = 0; }
     const char *queryFindString() const { return client; }
+    inline void addRead(unsigned len)
+    {
+        SpinBlock b(spin); // rare event, but we should change to a atomic<__int64> for >= c++11
+        bRead += len;
+    }
+    inline void addWrite(unsigned len)
+    {
+        SpinBlock b(spin); // rare event, but we should change to a atomic<__int64> for >= c++11
+        bWritten += len;
+    }
 
     StringAttr client;
     unsigned __int64 count;
     unsigned __int64 bRead;
     unsigned __int64 bWritten;
 };
-class CClientStatsTable : public StringSuperHashTableOf<ClientStats>
+class CClientStatsTable : public OwningStringSuperHashTableOf<CClientStats>
 {
-    typedef StringSuperHashTableOf<ClientStats> PARENT;
+    typedef OwningStringSuperHashTableOf<CClientStats> PARENT;
     CriticalSection crit;
     unsigned cmdStats[RFCmax];
 
-    inline ClientStats *addClientCommon(RemoteFileCommandType cmd, const char *client)
-    {
-        ClientStats *stats = PARENT::find(client);
-        if (!stats)
-        {
-            stats = new ClientStats(client);
-            PARENT::replace(*stats);
-        }
-        cmdStats[cmd]++;
-        ++stats->count;
-        return stats;
-    }
-
     static int compareElement(void* const *ll, void* const *rr)
     {
-        const ClientStats *l = (const ClientStats *) *ll;
-        const ClientStats *r = (const ClientStats *) *rr;
+        const CClientStats *l = (const CClientStats *) *ll;
+        const CClientStats *r = (const CClientStats *) *rr;
         if (l->count == r->count)
             return 0;
         else if (l->count<r->count)
@@ -2995,30 +2994,19 @@ public:
     {
         kill();
     }
-    void kill()
+    CClientStats *getClientReference(RemoteFileCommandType cmd, const char *client)
     {
-        SuperHashIteratorOf<ClientStats> iter(*this);
-        ForEach(iter)
+        CriticalBlock b(crit);
+        CClientStats *stats = PARENT::find(client);
+        if (!stats)
         {
-            ClientStats *elem = &iter.query();
-            delete elem;
+            stats = new CClientStats(client);
+            PARENT::replace(*stats);
         }
-        PARENT::kill();
-    }
-    ClientStats *addClientReference(RemoteFileCommandType cmd, const char *client)
-    {
-        CriticalBlock b(crit);
-        return addClientCommon(cmd, client);
-    }
-    void addRead(ClientStats &stats, unsigned len)
-    {
-        CriticalBlock b(crit);
-        stats.bRead += len;
-    }
-    void addWrite(ClientStats &stats, unsigned len)
-    {
-        CriticalBlock b(crit);
-        stats.bWritten += len;
+        if (cmd<RFCmax) // i.e. ignore duff command (which will be traced), but still record client connected
+            cmdStats[cmd]++;
+        ++stats->count;
+        return LINK(stats);
     }
     StringBuffer &getInfo(StringBuffer &info, unsigned level=1)
     {
@@ -3040,11 +3028,11 @@ public:
         }
         if (totalClients)
         {
-            SuperHashIteratorOf<ClientStats> iter(*this);
-            PointerArrayOf<ClientStats> elements;
+            SuperHashIteratorOf<CClientStats> iter(*this);
+            PointerArrayOf<CClientStats> elements;
             ForEach(iter)
             {
-                ClientStats &elem = iter.query();
+                CClientStats &elem = iter.query();
                 elements.append(&elem);
             }
             elements.sort(&compareElement);
@@ -3057,7 +3045,7 @@ public:
                 info.append("Top 10 clients:").newline();
                 for (unsigned e=0; e<max; e++)
                 {
-                    const ClientStats &element = *elements.item(e);
+                    const CClientStats &element = *elements.item(e);
                     info.appendf("Client %s - %" I64F "d requests handled, bytes read = %" I64F "d, bytes written = % " I64F "d",
                             element.client.get(), element.count, element.bRead, element.bWritten).newline();
                 }
@@ -3067,7 +3055,7 @@ public:
                 info.append("All clients:").newline();
                 ForEachItemIn(e, elements)
                 {
-                    const ClientStats &element = *elements.item(e);
+                    const CClientStats &element = *elements.item(e);
                     info.appendf("Client %s - %" I64F "d requests handled, bytes read = %" I64F "d, bytes written = % " I64F "d",
                             element.client.get(), element.count, element.bRead, element.bWritten).newline();
                 }
@@ -3111,25 +3099,32 @@ class CRemoteFileServer : public CInterface, implements IRemoteFileServer
             : socket(_socket), user(_user), globallasttick(_globallasttick)
         {
             previdx = (unsigned)-1;
-            if (socket)
+            StringBuffer peerBuf;
+            char name[256];
+            name[0] = 0;
+            int port = socket->peer_name(name,sizeof(name)-1);
+            if (port>=0)
             {
-                StringBuffer peerBuf;
-                char name[256];
-                name[0] = 0;
-                int port = socket->peer_name(name,sizeof(name)-1);
-                if (port>=0)
-                {
-                    peerBuf.append(name);
-                    if (port)
-                        peerBuf.append(':').append(port);
-                    peerName.set(peerBuf);
-                }
+                peerBuf.append(name);
+                if (port)
+                    peerBuf.append(':').append(port);
+                peerName.set(peerBuf);
+            }
+            else
+            {
+                /* There's a possibility the socket closed before got here, in which case, peer name is unavailable
+                 * May potentially be unavailable for other reasons also.
+                 * Must be set, as used in client stats HT.
+                 * If socket closed, the handler will start up but notice closed and quit
+                 */
+                peerName.set("UNKNOWN PEER NAME");
             }
             {
                 CriticalBlock block(ClientCountSect);
                 if (++ClientCount>MaxClientCount)
                     MaxClientCount = ClientCount;
-                if (TF_TRACE_CLIENT_CONN) {
+                if (TF_TRACE_CLIENT_CONN)
+                {
                     StringBuffer s;
                     s.appendf("Connecting(%p) [%d,%d] to ",this,ClientCount,MaxClientCount);
                     s.append(peerName);
@@ -3352,6 +3347,7 @@ class CRemoteFileServer : public CInterface, implements IRemoteFileServer
                  */
                 selecthandled = true;
                 parent->addClient(this);    // add to select handler
+                // NB: this (CRemoteClientHandler) is now linked by the selecthandler and owned by the 'clients' list
             }
         }
 
@@ -3456,7 +3452,7 @@ class CRemoteFileServer : public CInterface, implements IRemoteFileServer
         unsigned queryQueueLimit() const { return queueLimit; }
         StringBuffer &getInfoSummary(StringBuffer &info)
         {
-            info.appendf("Thottler(%s) - limit=%u, delayMs=%u, cpuThreshold=%u, queueLimit=%u", title.get(), limit, delayMs, cpuThreshold, queueLimit).newline();
+            info.appendf("Throttler(%s) - limit=%u, delayMs=%u, cpuThreshold=%u, queueLimit=%u", title.get(), limit, delayMs, cpuThreshold, queueLimit).newline();
             unsigned elapsedSecs = totalThrottleDelayTimer.elapsedMs()/1000;
             time_t simple;
             time(&simple);
@@ -3593,10 +3589,7 @@ class CRemoteFileServer : public CInterface, implements IRemoteFileServer
                          * NB: The overall number of threads is still capped by the thread pool.
                          */
                         unsigned ms = timer.elapsedMs();
-                        {
-                            CriticalBlock b(crit);
-                            totalThrottleDelay += ms;
-                        }
+                        totalThrottleDelay += ms;
                         PROGLOG("Throttler(%s): transaction delayed [cmd=%s] for : %u milliseconds, proceeding as cpu(%u)<throttleCPULimit(%u)", title.get(), getRFCText(cmd), cpu, ms, cpuThreshold);
                         hadSem = false;
                     }
@@ -3623,7 +3616,7 @@ class CRemoteFileServer : public CInterface, implements IRemoteFileServer
 
             /* Whilst holding on this throttle slot (i.e. before signalling semaphore back), process
              * queued items. NB: other threads that are finishing will do also.
-             * Queued items are processed 1st, the current request, then anything that was queued when handling current request
+             * Queued items are processed 1st, then the current request, then anything that was queued when handling current request
              * Throttle slot (semaphore) is only given back when no more to do.
              */
             Linked<CRemoteClientHandler> currentClient;
@@ -3929,8 +3922,14 @@ public:
         StringBuffer s(client->queryPeerName());
         PROGLOG("onCloseSocket(%d) %s",which,s.str());
 #endif
-        if (client->socket) {
-            try {
+        if (client->socket)
+        {
+            try
+            {
+                /* JCSMORE - shouldn't this really be dependent on whether selecthandled=true
+                 * It has not been added to the selecthandler
+                 * Harmless, but wasteful if so.
+                 */
                 selecthandler->remove(client->socket);
             }
             catch (IException *e) {
@@ -4018,7 +4017,7 @@ public:
         return true;
     }
 
-    bool cmdRead(MemoryBuffer & msg, MemoryBuffer & reply, ClientStats &stats)
+    bool cmdRead(MemoryBuffer & msg, MemoryBuffer & reply, CClientStats &stats)
     {
         int handle;
         __int64 pos;
@@ -4052,7 +4051,7 @@ public:
             e->Release();
             return false;
         }
-        clientStatsTable.addRead(stats, len);
+        stats.addRead(len);
         if (TF_TRACE)
             PROGLOG("read file,  handle = %d, pos = %" I64F "d, toread = %d, read = %d",handle,pos,len,numRead);
         {
@@ -4092,7 +4091,7 @@ public:
     }
 
 
-    bool cmdWrite(MemoryBuffer & msg, MemoryBuffer & reply, ClientStats &stats)
+    bool cmdWrite(MemoryBuffer & msg, MemoryBuffer & reply, CClientStats &stats)
     {
         int handle;
         __int64 pos;
@@ -4106,7 +4105,7 @@ public:
         if (TF_TRACE_PRE_IO)
             PROGLOG("before write file,  handle = %d, towrite = %d",handle,len);
         size32_t numWritten = fileio->write(pos,len,data);
-        clientStatsTable.addWrite(stats, numWritten);
+        stats.addWrite(numWritten);
         if (TF_TRACE)
             PROGLOG("write file,  handle = %d, towrite = %d, written = %d",handle,len,numWritten);
         reply.append((unsigned)RFEnoerror).append(numWritten);
@@ -4198,7 +4197,7 @@ public:
         return true;
     }
 
-    bool cmdAppend(MemoryBuffer & msg, MemoryBuffer & reply, CRemoteClientHandler &client, ClientStats &stats)
+    bool cmdAppend(MemoryBuffer & msg, MemoryBuffer & reply, CRemoteClientHandler &client, CClientStats &stats)
     {
         IMPERSONATE_USER(client);
         int handle;
@@ -4212,7 +4211,7 @@ public:
 
         Owned<IFile> file = createIFile(srcname.get());
         __int64 written = fileio->appendFile(file,pos,len);
-        clientStatsTable.addWrite(stats, written);
+        stats.addWrite(written);
         if (TF_TRACE)
             PROGLOG("append file,  handle = %d, file=%s, pos = %" I64F "d len = %" I64F "d written = %" I64F "d",handle,srcname.get(),pos,len,written);
         reply.append((unsigned)RFEnoerror).append(written);
@@ -4854,7 +4853,7 @@ public:
 
     bool processCommand(RemoteFileCommandType cmd, MemoryBuffer & msg, MemoryBuffer & reply, CRemoteClientHandler *client, CThrottler *throttler)
     {
-        ClientStats *stats = clientStatsTable.addClientReference(cmd, client->queryPeerName());
+        Owned<CClientStats> stats = clientStatsTable.getClientReference(cmd, client->queryPeerName());
         bool ret = true;
         try
         {

+ 5 - 5
docs/ECLPlayground/ECLPlay-Mods/ECL_Playground.xml

@@ -30,7 +30,7 @@
       Playground then shows you the results and the graph in your browser. The
       view is very similar to what the ECL IDE displays.</para>
 
-      <sect2>
+      <sect2 id="ECLPlayground_AccessingThePlayground">
         <title>Accessing ECL Playground</title>
 
         <para>ECL Playground is installed with the HPCC platform. You can
@@ -90,7 +90,7 @@
           </orderedlist></para>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="ECLPlayground_Introduction" role="brk">
         <title>Introducing the ECL Playground</title>
 
         <para>The ECL Playground page is a work area where you can see and run
@@ -134,7 +134,7 @@
         The results display at the bottom portion of the page.</para>
       </sect2>
 
-      <sect2>
+      <sect2 id="ECLPlayground_RunningECLCode">
         <title>Running ECL Code</title>
 
         <para>To run the selected sample code, choose a target cluster from
@@ -180,7 +180,7 @@
         in the <emphasis>Editor</emphasis>. If there are warnings they are
         displayed in yellow.</para>
 
-        <sect3>
+        <sect3 id="ECLPlayground_AnalyzeResutls">
           <title>Analyze the results</title>
 
           <para>When running ECL Code that has multiple results, each result
@@ -200,7 +200,7 @@
         </sect3>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="ECLPlayground_ECLFromAWorkunit" role="brk">
         <title>ECL from a Workunit</title>
 
         <para>You can access ECL code from inside a Workunit Details page in

+ 2 - 2
docs/ECLScheduler/ECLSched-Mods/ECLSchedComp.xml

@@ -159,7 +159,7 @@
       role="bold">PushEvent</emphasis> button. This is the same as triggering
       an event using NOTIFY.</para>
 
-      <sect2>
+      <sect2 id="ECLSched_WorkunitList">
         <title>Scheduler Workunit List</title>
 
         <para>You can search scheduled workunits by cluster or event name. To
@@ -184,7 +184,7 @@
         link for the workunit.</para>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="ECLSched_PushingEvents" role="brk">
         <title>Pushing Events</title>
 
         <para>The Event Scheduler allow you to trigger or "push" an event to

+ 1 - 1
docs/ECLWatch/ECLWa_mods/ECLWatchQueries.xml

@@ -279,7 +279,7 @@ depending on where they wind up.-->
           provides access to even more advanced graphing options.</para>
         </sect3>
 
-        <sect3>
+        <sect3 id="ECLWatch_Queries_LogicalFiles">
           <title>Logical Files Tab</title>
 
           <para>The Published queries details page provides a link to the

+ 20 - 20
docs/ECLWatch/ECLWa_mods/ECLWatchSrc.xml

@@ -293,7 +293,7 @@
           </varlistentry>
         </variablelist>
 
-        <sect3>
+        <sect3 id="ECLWatch_SortingColumns">
           <title>Sorting Columns</title>
 
           <para>You can sort a column by clicking on the column heading. Click
@@ -416,7 +416,7 @@
 
         <!-- added WU Details stuff here -->
 
-        <sect3 role="brk">
+        <sect3 id="ECLWatch_PublishActionButton" role="brk">
           <title>Publish Action Button</title>
 
           <para>Click on the Publish action button to publish a query. <figure>
@@ -530,7 +530,7 @@
           personally identifiable information (PII).</para>
         </sect3>
 
-        <sect3 role="brk">
+        <sect3 id="ECLWatch_ECLWorkunitsOutputsTab" role="brk">
           <title>Outputs tab</title>
 
           <para>Click on the Outputs tab to see all results.<figure>
@@ -578,7 +578,7 @@
           </itemizedlist>
         </sect3>
 
-        <sect3 role="brk">
+        <sect3 id="ECLWatch_ECLWorkunitsVisualizations" role="brk">
           <title>Visualizations</title>
 
           <para>You can see visual representations of select workunits.
@@ -604,7 +604,7 @@
           menu, to change the parameters.</para>
         </sect3>
 
-        <sect3 role="brk">
+        <sect3 id="ECLWatch_ECLWorkunitsInputsTab" role="brk">
           <title>Inputs tab</title>
 
           <para>Click on the <emphasis role="bold">Inputs</emphasis> tab to
@@ -627,8 +627,8 @@
           how many times a file was used in the workunit.</para>
         </sect3>
 
-        <sect3 role="brk">
-          <title>Timers tab</title>
+        <sect3 id="ECLWatch_ECLWorkunitsTimersTab" role="brk">
+          <title id="ECLWatch_ECLWorkunits_TimersTab">Timers tab</title>
 
           <para>Click on the <emphasis role="bold">Timers</emphasis> tab to
           see the workunit timings. <figure>
@@ -648,7 +648,7 @@
           the lighter the color indicates that portion took less time.</para>
         </sect3>
 
-        <sect3>
+        <sect3 id="ECLWatch_ECLWorkunitsGraphsTab">
           <title>Graphs tab</title>
 
           <para>Click on the <emphasis role="bold">Graphs</emphasis> tab to
@@ -667,7 +667,7 @@
           the graph.</para>
         </sect3>
 
-        <sect3 role="brk">
+        <sect3 id="ECLWatch_ECLWorkunitsTimersTab" role="brk">
           <title>Timers tab</title>
 
           <para>Click on the <emphasis role="bold">Timers</emphasis> tab to
@@ -690,7 +690,7 @@
           <para><emphasis role="bold">Usage:</emphasis> how many times a file
           was used in the work unit.</para>
 
-          <sect4>
+          <sect4 id="ECLWatch_ECLWorkunitsStatsTab">
             <title>Stats</title>
 
             <para>On the workunit Timers tab is another tab for Stats. The
@@ -712,7 +712,7 @@
           </sect4>
         </sect3>
 
-        <sect3>
+        <sect3 id="ECLWatch_ECLWorkunitsWorkflowsTab">
           <title>Workflows tab</title>
 
           <para>The workflows tab only exists if you have an attribute
@@ -726,7 +726,7 @@
           remain to occur.</para>
         </sect3>
 
-        <sect3>
+        <sect3 id="ECLWatch_ECLWorkunitsQueriesTab">
           <title>Queries tab</title>
 
           <para>Queries will only appear in the work unit details if the work
@@ -737,7 +737,7 @@
           <para></para>
         </sect3>
 
-        <sect3>
+        <sect3 id="ECLWatch_ECLWorkunitsHelpersTab">
           <title>Helpers tab</title>
 
           <para>The Helpers tab display several helpful elements. Which show
@@ -750,14 +750,14 @@
           portion of the log that pertains to that workunit.</para>
         </sect3>
 
-        <sect3 id="WUDetails_ECL_Playground_TAB">
+        <sect3 id="WUDetails_ECL__TAB">
           <title>ECL Tab</title>
 
           <para>Shows the ECL code for that workunit. It is the same thing as
           the Helpers ECL link.</para>
         </sect3>
 
-        <sect3>
+        <sect3 id="ECLWatch_ECLWorkunitsXMLTab">
           <title>XML tab</title>
 
           <para>The workunits XML record as stored in Dali.</para>
@@ -1008,7 +1008,7 @@
             </listitem>
           </itemizedlist></para>
 
-        <sect3>
+        <sect3 id="ECLWatch_DFUWorkunits_XMLTab">
           <title>XML Tab</title>
 
           <para>The XML Tab on the workunit details page allows you to see the
@@ -1023,7 +1023,7 @@
             </figure></para>
         </sect3>
 
-        <sect3>
+        <sect3 id="ECLWatch_DFUWorkunits_SourceTab">
           <title>Source Tab</title>
 
           <para>The Source Tab on the workunit details page allows you to view
@@ -1038,7 +1038,7 @@
             </figure></para>
         </sect3>
 
-        <sect3>
+        <sect3 id="ECLWatch_DFUWorkunits_TargetTab">
           <title>Target Tab</title>
 
           <para>The Target Tab on the workunit details page allows you to view
@@ -1211,7 +1211,7 @@
         <para>You can press the <emphasis role="bold">Open</emphasis> button
         to open a tab with the details for each selected file.</para>
 
-        <sect3>
+        <sect3 id="ECLWatch_Files_RemoteCopy">
           <title>Remote Copy</title>
 
           <para>Press the <emphasis role="bold">Remote Copy</emphasis> button
@@ -1449,7 +1449,7 @@
           </listitem>
         </itemizedlist>
 
-        <sect3>
+        <sect3 id="ECLWatch_LogicalFiles_SuperFiles">
           <title>Superfiles</title>
 
           <para>A superfile is a managed list of sub-files (Logical Files)

+ 26 - 26
docs/ECLWatch/TheECLWatchMan.xml

@@ -60,10 +60,10 @@
     </mediaobject>
   </bookinfo>
 
-  <chapter>
+  <chapter id="ECLWatch_Intro">
     <title>Introducing ECL Watch</title>
 
-    <sect1 role="nobrk">
+    <sect1 id="ECLWatch_Introduction" role="nobrk">
       <title>Introduction</title>
 
       <para>ECL Watch is a service that runs on the Enterprise Services
@@ -80,7 +80,7 @@
     </sect1>
   </chapter>
 
-  <chapter>
+  <chapter id="ECLWatch_Home_Chapter">
     <title>ECL Watch Home</title>
 
     <para>Click on the <emphasis role="bold">ECL Watch home</emphasis> link in
@@ -99,7 +99,7 @@
         </mediaobject>
       </figure></para>
 
-    <sect1 role="nobrk">
+    <sect1 id="ECLWatch_Activity" role="nobrk">
       <title>Activity</title>
 
       <para>The Activity page displays activity on all clusters in the
@@ -179,7 +179,7 @@
           </figure></para>
       </sect2>
 
-      <sect2>
+      <sect2 id="ECLWatch_GlobalSearch">
         <title>Global Search</title>
 
         <para>On the navigation bar at the top of the ECL Watch page, about
@@ -197,7 +197,7 @@
         the search box. The search box supports wild cards.</para>
       </sect2>
 
-      <sect2 id="AutoRefresh">
+      <sect2 id="ECLWatch_AutoRefresh">
         <title>Auto Refresh</title>
 
         <para><figure>
@@ -212,16 +212,16 @@
         active ECL or DFU workunits either running or in the queue on your
         cluster. To refresh the list, press the <emphasis
         role="bold">Refresh</emphasis> button. Auto Refresh shows the list in
-        real-time, but this feature is disabled by default. </para>
+        real-time, but this feature is disabled by default.</para>
 
-        <para>To enable Auto Refresh, toggle the Auto Refresh button. </para>
+        <para>To enable Auto Refresh, toggle the Auto Refresh button.</para>
 
         <para>In an environment with a large number of active users, Auto
         Refresh could impact performance of your ESP server.</para>
       </sect2>
     </sect1>
 
-    <sect1>
+    <sect1 id="ECLWatch_EventScheduler">
       <title>ECL Event Scheduler</title>
 
       <para>The Event Scheduler page provides an interface to the ECL
@@ -269,7 +269,7 @@
                 xmlns:xi="http://www.w3.org/2001/XInclude" />
   </chapter>
 
-  <chapter>
+  <chapter id="ECLWatch_ECLWorkunits">
     <title>ECL Workunits</title>
 
     <para>ECL Watch provides information about ECL jobs and workunits. Links
@@ -288,7 +288,7 @@
                 xmlns:xi="http://www.w3.org/2001/XInclude" />
   </chapter>
 
-  <chapter>
+  <chapter id="ECLWatch_FilesChapter">
     <title>Files</title>
 
     <para>This chapter contains sections dealing with HPCC Platform Files,
@@ -389,7 +389,7 @@
                   xmlns:xi="http://www.w3.org/2001/XInclude" />
     </sect1>
 
-    <sect1>
+    <sect1 id="ECLWatch_Xref">
       <title>XRef</title>
 
       <para>Under the <emphasis role="bold">Files</emphasis> Icon on the
@@ -505,7 +505,7 @@
         </listitem>
       </itemizedlist>
 
-      <sect2>
+      <sect2 id="ECLWatch_WorkingWithXref">
         <title>Working with XREF results:</title>
 
         <para>After XRef completes you will see a list of available reports.
@@ -555,7 +555,7 @@
     </sect1>
   </chapter>
 
-  <chapter>
+  <chapter id="ECLWatch_Queries">
     <title>Queries</title>
 
     <para>The link for the Published Queries (icon) header provides more
@@ -593,7 +593,7 @@
                 xmlns:xi="http://www.w3.org/2001/XInclude" />
   </chapter>
 
-  <chapter>
+  <chapter id="ECLWatch_OperationsLink">
     <title>Operations</title>
 
     <para>The Operations link provides access to several components useful for
@@ -617,7 +617,7 @@
     Groups, Permissions, and Resources. These links allow you to perform some
     system administration tasks through ECL watch.</para>
 
-    <sect1>
+    <sect1 id="ECLWatch_Operations_Topology">
       <title>Topology</title>
 
       <para>The Topology page provides a visual tree display with information
@@ -686,7 +686,7 @@
         selected component.</para>
       </sect2>
 
-      <sect2>
+      <sect2 id="ECLWatch_Operations_TopologyMachines">
         <title>Machines</title>
 
         <para>Press the <emphasis role="bold">Machines</emphasis> Action
@@ -710,7 +710,7 @@
       </sect2>
     </sect1>
 
-    <sect1>
+    <sect1 id="ECLWatch_Operations_DiskUsage">
       <title>Disk Usage</title>
 
       <para>When you click on the Operations link, it opens the Disk Usage
@@ -729,7 +729,7 @@
       role="bold">Filter</emphasis> action button.</para>
     </sect1>
 
-    <sect1>
+    <sect1 id="ECLWatch_Operations_TargetClusters">
       <title>Operations: Target Clusters</title>
 
       <para>The Target Clusters link from the navigation sub-menu bar, on the
@@ -775,7 +775,7 @@
   <chapter id="User_Permissions_Chapter">
     <title>Users Permissions</title>
 
-    <sect1 role="nobrk">
+    <sect1 id="ECLWatch_Operations_UserAdministrations" role="nobrk">
       <title>User Administration</title>
 
       <para>There are User Administration features available through ECL
@@ -867,7 +867,7 @@
           </figure></para>
       </sect2>
 
-      <sect2>
+      <sect2 id="ECLWatch_Monitoring_InstallingGanglia">
         <title>Installing Ganglia in ECL Watch</title>
 
         <para>In order to use Ganglia in ECL Watch, you need to have Ganglia
@@ -902,7 +902,7 @@
     during your session. Click on the advanced menu to display a list of
     features.</para>
 
-    <sect1>
+    <sect1 id="ECLWatch_AdvancedMenuAccess">
       <title>Access the Advanced menu</title>
 
       <para>You access the advanced menu items from the advanced menu link at
@@ -943,7 +943,7 @@
       graph controls installed on your server.</para>
     </sect1>
 
-    <sect1 role="nobrk">
+    <sect1 id="ECLWatch_AdvancedMenuUserDetails" role="nobrk">
       <title>User Details</title>
 
       <para>The LOGGED IN AS link shows information about the current user on
@@ -987,7 +987,7 @@
           </listitem>
         </orderedlist></para>
 
-      <sect2 role="nobrk">
+      <sect2 id="ECLWatch_AdvancedMenuChangePassword" role="nobrk">
         <title>Change Password</title>
 
         <para>If authentication is enabled on your HPCC system, you can change
@@ -1022,7 +1022,7 @@
           </orderedlist></para>
       </sect2>
 
-      <sect2>
+      <sect2 id="ECLWatch_AdvancedMenuPermissionGroups">
         <title>Permission groups</title>
 
         <para>The second tab on the User Details window labelled Member Of,
@@ -1033,7 +1033,7 @@
         settings.</para>
       </sect2>
 
-      <sect2>
+      <sect2 id="ECLWatch_AdvancedMenuUserPermissions">
         <title>User Permissions tab</title>
 
         <para>The third tab on the User Details window labelled <emphasis

+ 17 - 17
docs/HPCCClientTools/CT_Mods/CT_Comm_Line_DFU.xml

@@ -128,7 +128,7 @@
             </tgroup>
           </informaltable></para>
 
-        <sect3>
+        <sect3 id="CLI_DFU_GeneralOptions">
           <title>General Options:</title>
 
           <para>The following <emphasis>options </emphasis>are common to every
@@ -281,7 +281,7 @@
 
         <?hard-pagebreak ?>
 
-        <sect3>
+        <sect3 id="CLI_DFU_dfuplus.ini">
           <title>dfuplus.ini</title>
 
           <para>Any <emphasis>options</emphasis> can be specified in a file
@@ -320,7 +320,7 @@ replicate=1</programlisting>
             </informaltable></para>
         </sect3>
 
-        <sect3>
+        <sect3 id="CLI_DFU_SprayOperations">
           <title>Spray Operations:</title>
 
           <para>The <emphasis role="bold">spray</emphasis>
@@ -568,7 +568,7 @@ DATA image; //first 4 bytes contain the length of the image data
 END;</programlisting>
         </sect3>
 
-        <sect3>
+        <sect3 id="CLI_DFU_DeSprayOperations">
           <title>Despray Operations:</title>
 
           <para>The <emphasis role="bold">despray</emphasis>
@@ -701,7 +701,7 @@ dfuplus action=dspray srcname=le::imagedb
 </programlisting>
         </sect3>
 
-        <sect3>
+        <sect3 id="CLI_DFU_CopyOps">
           <title>Copy Operations:</title>
 
           <para>The <emphasis role="bold">copy</emphasis>
@@ -789,7 +789,7 @@ dfuplus action=dspray srcname=le::imagedb
           dstname=srcname=RTTEMP::COPY::timezones.txt dstcluster=thor</programlisting>
         </sect3>
 
-        <sect3>
+        <sect3 id="CLI_DFU_RemoveOps">
           <title>Remove Operations:</title>
 
           <para>The <emphasis role="bold">remove</emphasis> operation deletes
@@ -820,7 +820,7 @@ dfuplus action=dspray srcname=le::imagedb
           <para></para>
         </sect3>
 
-        <sect3>
+        <sect3 id="CLI_DFU_renameOps">
           <title>Rename Operations:</title>
 
           <para>The <emphasis role="bold">rename</emphasis> operation renames
@@ -856,7 +856,7 @@ dfuplus action=dspray srcname=le::imagedb
           <programlisting>dfuplus action=rename srcname=RTTEMP::timezones.txt dstname=RTTEMP::NewTimezones.txt</programlisting>
         </sect3>
 
-        <sect3>
+        <sect3 id="CLI_DFU_ListOperations">
           <title>List Operations:</title>
 
           <para>The <emphasis role="bold">list</emphasis> operation produces a
@@ -887,7 +887,7 @@ dfuplus action=dspray srcname=le::imagedb
           <programlisting>dfuplus action=list name=*</programlisting>
         </sect3>
 
-        <sect3>
+        <sect3 id="CLI_DFU_AddOperations">
           <title>Add Operations:</title>
 
           <para>The <emphasis role="bold">add</emphasis> operation adds a new
@@ -977,7 +977,7 @@ dfuplus action=dspray srcname=le::imagedb
           <para></para>
         </sect3>
 
-        <sect3>
+        <sect3 id="CLI_DFU_AddSuperOperations">
           <title>Addsuper Operations:</title>
 
           <para>The <emphasis role="bold">addsuper</emphasis> operation adds
@@ -1027,7 +1027,7 @@ dfuplus action=dspray srcname=le::imagedb
           <programlisting>dfuplus action=addsuper superfile=mysuper subfiles=file1,file2</programlisting>
         </sect3>
 
-        <sect3>
+        <sect3 id="CLI_DFU_RemoveSuperOperations">
           <title>Removesuper Operations:</title>
 
           <para>The <emphasis role="bold">removesuper</emphasis> operation
@@ -1079,7 +1079,7 @@ dfuplus action=dspray srcname=le::imagedb
           <programlisting>dfuplus action=removesuper superfile=mysuper subfiles=file1,file2</programlisting>
         </sect3>
 
-        <sect3>
+        <sect3 id="CLI_DFU_ListSuperOperations">
           <title>Listsuper Operations:</title>
 
           <para>The <emphasis role="bold">listsuper</emphasis> operation lists
@@ -1113,7 +1113,7 @@ dfuplus action=dspray srcname=le::imagedb
           <programlisting>dfuplus action=listsuper superfile=mysuper</programlisting>
         </sect3>
 
-        <sect3>
+        <sect3 id="CLI_DFU_StatusOperations">
           <title>Status Operations:</title>
 
           <para>The <emphasis role="bold">status</emphasis> operation returns
@@ -1144,7 +1144,7 @@ dfuplus action=dspray srcname=le::imagedb
           <para></para>
         </sect3>
 
-        <sect3>
+        <sect3 id="CLI_DFU_AbortOperations">
           <title>Abort Operations:</title>
 
           <para>The <emphasis role="bold">abort</emphasis> operation aborts
@@ -1177,7 +1177,7 @@ dfuplus action=dspray srcname=le::imagedb
           <para></para>
         </sect3>
 
-        <sect3>
+        <sect3 id="CLI_DFU_ResubmitOperations">
           <title>Resubmit Operations:</title>
 
           <para>The <emphasis role="bold">resubmit</emphasis> operation
@@ -1211,7 +1211,7 @@ dfuplus action=dspray srcname=le::imagedb
           <para></para>
         </sect3>
 
-        <sect3>
+        <sect3 id="CLI_DFU_SaveXMLOperations">
           <title>Savexml Operations:</title>
 
           <para>The <emphasis role="bold">savexml</emphasis> operation saves
@@ -1283,7 +1283,7 @@ dfuplus action=dspray srcname=le::imagedb
     &lt;/File&gt;</programlisting>
         </sect3>
 
-        <sect3>
+        <sect3 id="CLI_DFU_MonitorOperations">
           <title>Monitor Operations:</title>
 
           <para>The <emphasis role="bold">monitor</emphasis> operation

+ 17 - 17
docs/HPCCClientTools/CT_Mods/CT_Comm_Line_ECL.xml

@@ -174,7 +174,7 @@
         file in the same directory as the executable, or any
         combination.</para>
 
-        <sect3 role="brk">
+        <sect3 id="CT_CLI_eclplus.ini" role="brk">
           <title>eclplus.ini</title>
 
           <para>All the options can be put directly on the command line, or
@@ -213,7 +213,7 @@ password=password</programlisting>
             </informaltable></para>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_RunningQueriesBatchMode">
           <title>Running queries in batch mode</title>
 
           <para>Batch mode queries are executed using the
@@ -265,7 +265,7 @@ Richard Taylor
 Richard Chapman</programlisting>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_CLI_WorkunitManipulation">
           <title>Workunit manipulation</title>
 
           <para>A workunit is a data structure that is passed among eclplus,
@@ -274,7 +274,7 @@ Richard Chapman</programlisting>
           the workunit.</para>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_CLI_ListAllWorkunits">
           <title>List all work units</title>
 
           <para>To list all work units:</para>
@@ -301,7 +301,7 @@ W20090226-100958-85552898 yma datasetquery.txt completed</programlisting>
           <programlisting>eclplus jobname=myquery1 @datasetquery.txt</programlisting>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_CLI_ViewResultofWorkunit">
           <title>View the result of a certain workunit</title>
 
           <para>You can look at specific workunit results, like this:</para>
@@ -317,7 +317,7 @@ Richard Taylor
 Richard Chapman</programlisting>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_CLI_DumpWorkunit">
           <title>Dump a workunit</title>
 
           <para>If you want to get all the details describing a workunit, use
@@ -328,8 +328,8 @@ Richard Chapman</programlisting>
           <para>See the Workunit Dump section below for the result.</para>
         </sect3>
 
-        <sect3>
-          <title>Return graph data for a workunit:</title>
+        <sect3 id="CT_CLI_SeeTheThorGraph">
+          <title>See the thor graph of a workunit:</title>
 
           <para>This action returns the XML data for one or more workunit
           graphs.</para>
@@ -339,7 +339,7 @@ Richard Chapman</programlisting>
           <para>Graph name must be supplied in the graph= parameter.</para>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_CLI_AbortWorkunit">
           <title>Aborting a workunit</title>
 
           <para>If a query is taking an usually long time and you doubt
@@ -351,7 +351,7 @@ Richard Chapman</programlisting>
           abort to abort it.</para>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_CLI_Timeout">
           <title>Timeout</title>
 
           <para>Before you run a query, if you know the query is going to take
@@ -373,7 +373,7 @@ Richard Chapman</programlisting>
           monitor its status.</para>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_CLI_OutputFormat">
           <title>Output format</title>
 
           <para>By default, the result displays on the screen. You can direct
@@ -389,7 +389,7 @@ Richard Chapman</programlisting>
           <para>Also, you may specify the following output formats:</para>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_CLI_CSV">
           <title>csv</title>
 
           <programlisting>eclplus @datasetquery.txt format=csv
@@ -399,7 +399,7 @@ Richard Chapman</programlisting>
 "Richard ","Chapman "</programlisting>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_CLI_CSVH">
           <title>csvh</title>
 
           <programlisting>eclplus @datasetquery.txt format=csvh
@@ -410,7 +410,7 @@ Richard Chapman</programlisting>
 "Richard ","Chapman "</programlisting>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_CLI_RAW">
           <title>raw</title>
 
           <programlisting>eclplus @datasetquery.txt format=raw
@@ -419,7 +419,7 @@ Richard    Taylor
 Richard    Chapman</programlisting>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_CLI_RUNECL">
           <title>runecl</title>
 
           <programlisting>eclplus @datasetquery.txt format=runecl
@@ -435,14 +435,14 @@ firstname -&gt; Richard
 lastname -&gt; Chapman</programlisting>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_CLI_Bin-ary-">
           <title>bin(ary)</title>
 
           <programlisting>eclplus @datasetquery.txt format=bin
 Yanrui Ma Richard Taylor Richard Chapman</programlisting>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_CLI_WorkUnitDump">
           <title>Workunit Dump</title>
 
           <para>A Workunit dump is an XML representation of every piece of

+ 26 - 26
docs/HPCCClientTools/CT_Mods/CT_ECL_CLI.xml

@@ -145,7 +145,7 @@
 
         <para></para>
 
-        <sect3 role="brk">
+        <sect3 id="CT_ECL_CLI_ecl.ini" role="brk">
           <title>ecl.ini</title>
 
           <para>Many options can be placed in a file called <emphasis
@@ -208,7 +208,7 @@ resultLimit=200
           </itemizedlist>
         </sect3>
 
-        <sect3 role="brk">
+        <sect3 id="CT_CLI_Syntax_EnvironmentVariables" role="brk">
           <title>Environment Variables</title>
 
           <para>Some options can be stored in Environment Variables on your
@@ -245,7 +245,7 @@ ECL_RESULT_LIMIT
         </sect3>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_CLI_SyntaxECLDeploy" role="brk">
         <title>ecl deploy</title>
 
         <para><emphasis role="bold">ecl deploy &lt;target&gt; &lt;file&gt;
@@ -415,7 +415,7 @@ ecl deploy roxie - --name=FindPersonService
           </informaltable></para>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_CLI_SyntaxECLPublish" role="brk">
         <title>ecl publish</title>
 
         <para><emphasis role="bold">ecl publish &lt;target&gt; &lt;file&gt;
@@ -724,7 +724,7 @@ ecl publish roxie ArchiveQuery.xml --name=FindPersonService --no-activate
           </informaltable></para>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_CLI_SyntaxECLUnPublish" role="brk">
         <title>ecl unpublish</title>
 
         <para><emphasis role="bold">ecl unpublish &lt;queryset&gt;
@@ -815,7 +815,7 @@ ecl unpublish roxie "FindpersonService*"
           </informaltable></para>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_CLI_SyntaxECLRun" role="brk">
         <title>ecl run</title>
 
         <para><emphasis role="bold">ecl run &lt;target&gt; &lt;file&gt;
@@ -1044,7 +1044,7 @@ ecl run thor findperson.ecl -I C:\MyECL\
           </informaltable></para>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_CLI_SyntaxECLActivate" role="brk">
         <title>ecl activate</title>
 
         <para><emphasis role="bold">ecl activate &lt;queryset&gt;
@@ -1133,7 +1133,7 @@ ecl run thor findperson.ecl -I C:\MyECL\
           </informaltable></para>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_CLI_SyntaxECLDeactivate" role="brk">
         <title>ecl deactivate</title>
 
         <para><emphasis role="bold">ecl deactivate &lt;queryset&gt;
@@ -1223,7 +1223,7 @@ ecl run thor findperson.ecl -I C:\MyECL\
           </informaltable></para>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_CLI_SyntaxECLQueriesList" role="brk">
         <title id="eclquerieslist">ecl queries list</title>
 
         <para><emphasis role="bold">ecl queries list
@@ -1362,7 +1362,7 @@ ecl queries list roxie --target=roxie --show=A </programlisting>
           </informaltable></para>
       </sect2>
 
-      <sect2 id="eclqueriescopy" role="brk">
+      <sect2 id="CT_CLI_eclqueriescopy" role="brk">
         <title>ecl queries copy</title>
 
         <para><emphasis role="bold">ecl queries copy &lt;source_query_path&gt;
@@ -1534,7 +1534,7 @@ ecl queries copy //192.168.1.10:8010/thor/findperson thor
           </informaltable></para>
       </sect2>
 
-      <sect2 id="eclqueriescopyset" role="brk">
+      <sect2 id="CT_CLI_eclqueriescopyset" role="brk">
         <title>ecl queries copy-set</title>
 
         <para><emphasis role="bold">ecl queries copy-set &lt;source_target&gt;
@@ -2539,7 +2539,7 @@ ecl packagemap validate roxie --active</programlisting>
           </informaltable></para>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_CLI_SyntaxECLRoxieAttach" role="brk">
         <title>ecl roxie attach</title>
 
         <para><emphasis role="bold">ecl roxie attach
@@ -2611,7 +2611,7 @@ ecl packagemap validate roxie --active</programlisting>
           </informaltable></para>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_CLI_SyntaxECLRoxieDetach" role="brk">
         <title>ecl roxie detach</title>
 
         <para><emphasis role="bold">ecl roxie detach
@@ -2683,7 +2683,7 @@ ecl packagemap validate roxie --active</programlisting>
           </informaltable></para>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_CLI_SyntaxECLRoxieReload" role="brk">
         <title>ecl roxie reload</title>
 
         <para><emphasis role="bold">ecl roxie reload
@@ -2755,7 +2755,7 @@ ecl packagemap validate roxie --active</programlisting>
           </informaltable></para>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_CLI_SyntaxECLRoxieCheck" role="brk">
         <title>ecl roxie check</title>
 
         <para><emphasis role="bold">ecl roxie check
@@ -2833,7 +2833,7 @@ ecl packagemap validate roxie --active</programlisting>
           </informaltable><parameter></parameter></para>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_CLI_SyntaxECLBundleDepends" role="brk">
         <title>ecl bundle depends</title>
 
         <para><emphasis role="bold">ecl bundle depends &lt;bundleName&gt;
@@ -2891,7 +2891,7 @@ ecl bundle depends mybundle --version=2</programlisting>
           </informaltable></para>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_CLI_SyntaxECLBundleInfo" role="brk">
         <title>ecl bundle info</title>
 
         <para><emphasis role="bold">ecl bundle info &lt;bundleName&gt;
@@ -2944,7 +2944,7 @@ ecl bundle info mybundle --version=2</programlisting>
           </informaltable></para>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_CLI_SyntaxECLBundleInstall" role="brk">
         <title>ecl bundle install</title>
 
         <para><emphasis role="bold">ecl bundle install
@@ -3017,7 +3017,7 @@ ecl bundle install mybundle --keepprior</programlisting>
           </informaltable></para>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_CLI_SyntaxECLBundleUninstall" role="brk">
         <title>ecl bundle uninstall</title>
 
         <para><emphasis role="bold">ecl bundle uninstall
@@ -3085,7 +3085,7 @@ ecl bundle install mybundle --keepprior</programlisting>
           </informaltable></para>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_CLI_SyntaxECLBundleList" role="brk">
         <title>ecl bundle list</title>
 
         <para><emphasis role="bold">ecl bundle list
@@ -3139,7 +3139,7 @@ ecl bundle list myb*
           </informaltable></para>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_CLI_SyntaxECLBundleUse" role="brk">
         <title>ecl bundle use</title>
 
         <para><emphasis role="bold">ecl bundle use &lt;bundleName&gt;
@@ -3192,7 +3192,7 @@ ecl bundle list myb*
           </informaltable></para>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_CLI_SyntaxECLRoxieUnusedFiles" role="brk">
         <title>ecl roxie unused-files</title>
 
         <para><emphasis role="bold">ecl roxie unused-files
@@ -3273,7 +3273,7 @@ ecl bundle list myb*
           </informaltable></para>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_CLI_SyntaxECLAbort" role="brk">
         <title>ecl abort</title>
 
         <para><emphasis role="bold">ecl abort -wu &lt;WUID&gt; | -n
@@ -3358,7 +3358,7 @@ ecl abort -n MyJob</programlisting>
           </informaltable></para>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_CLI_SyntaxECLStatus" role="brk">
         <title>ecl status</title>
 
         <para><emphasis role="bold">ecl status -wu &lt;WUID&gt; | -n
@@ -3443,7 +3443,7 @@ ecl status -n MyJob</programlisting>
           </informaltable></para>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_CLI_SyntaxECLGetWUID" role="brk">
         <title>ecl getwuid</title>
 
         <para><emphasis role="bold">ecl getwuid -n &lt;jobName&gt;
@@ -3528,7 +3528,7 @@ ecl getwuid -n MyCommonJobName --limit=100</programlisting>
           </informaltable></para>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_CLI_SyntaxECLGetName" role="brk">
         <title>ecl getname</title>
 
         <para><emphasis role="bold">ecl getname -wu &lt;WUID&gt;

+ 45 - 45
docs/HPCCClientTools/CT_Mods/CT_ECL_IDE.xml

@@ -252,7 +252,7 @@
       <sect2 id="Using_the_Preferences_Window">
         <title>Using the Preferences Window</title>
 
-        <sect3>
+        <sect3 id="CT_ECLIDE_ServerTab">
           <title>Server Tab</title>
 
           <para>The <emphasis role="bold">Server tab</emphasis> has two modes
@@ -307,7 +307,7 @@
           </informaltable>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_ECLIDE_EditorTab">
           <title>Editor tab</title>
 
           <para>The <emphasis role="bold">Editor tab</emphasis> allows you to
@@ -434,7 +434,7 @@
           </informaltable>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_ECLIDE_ColorsTab">
           <title>Colors tab</title>
 
           <para>The <emphasis role="bold">Colors tab</emphasis> allows you to
@@ -503,7 +503,7 @@
           <para></para>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_ECLIDE_ResultsTab">
           <title>Results tab</title>
 
           <para>The <emphasis role="bold">Results tab</emphasis> allows you to
@@ -544,7 +544,7 @@
           </informaltable>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_ECLIDE_CompilerTab">
           <title>Compiler tab</title>
 
           <para>The <emphasis role="bold">Compliler tab</emphasis> allows you
@@ -644,7 +644,7 @@
           </informaltable>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_ECLIDE_OtherTab">
           <title>Other tab</title>
 
           <para>The <emphasis role="bold">Other tab</emphasis> allows you to
@@ -794,7 +794,7 @@
 
         <para><graphic fileref="../../images/CT06.jpg" /></para>
 
-        <sect3>
+        <sect3 id="CT_ECLIDE_UsingTheRibbon">
           <title>Using the Ribbon</title>
 
           <para>The Ribbon makes the commands that you need use to complete a
@@ -853,7 +853,7 @@
           the option or command you want.</para>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_ECLIDE_QuickAccessToolbar">
           <title>The Quick Access Toolbar</title>
 
           <para>Quick Access toolbar provides shortcut buttons for commonly
@@ -883,7 +883,7 @@
           <para></para>
         </sect3>
 
-        <sect3 role="brk">
+        <sect3 id="CT_ECLIDE_WorkingWithToolBoxes" role="brk">
           <title>Working with Toolboxes</title>
 
           <para>Toolboxes can be docked, pinned, unpinned, grouped, or hidden.
@@ -891,7 +891,7 @@
           right (a pre-configured options on the View ribbon tab).</para>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_ECLIDE_GroupingDockingAutoHide">
           <title>Grouping, Docking, and AutoHide</title>
 
           <para>Once grouped, the toolboxes open and close as a group until
@@ -919,7 +919,7 @@
           <para></para>
         </sect3>
 
-        <sect3 role="brk">
+        <sect3 id="CT_ECLIDE_RepositoryToolbox" role="brk">
           <title>Repository Toolbox</title>
 
           <para>This toolbox displays the ECL Folders for the current
@@ -952,7 +952,7 @@
           the preferences window.<!--  --></para>
         </sect3>
 
-        <sect3 role="brk">
+        <sect3 id="CT_ECLIDE_FindRepoToolbox" role="brk">
           <title>Find (Repository) Toolbox</title>
 
           <para>This toolbox allows you to search the active Repository.
@@ -1066,7 +1066,7 @@
           <para></para>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_ECLIDE_WorkUnitsToolbox">
           <title>WorkunitsToolbox</title>
 
           <para>This toolbox displays Workunits for the environment to which
@@ -1075,7 +1075,7 @@
           Workunits within it.</para>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_ECLIDE_ActiveWorkunits">
           <title>Active Workunits</title>
 
           <para>This toolbox displays active Workunits for the environment to
@@ -1086,7 +1086,7 @@
           role="bold">Preferences</emphasis> window.</para>
         </sect3>
 
-        <sect3 role="brk">
+        <sect3 id="CT_ECLIDE_FindWorkunitsToolbox" role="brk">
           <title>Find (Workunits) Toolbox</title>
 
           <para>This toolbox allows you to search online Workunits in the
@@ -1160,7 +1160,7 @@
           <para></para>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_ECLIDE_DataSetsToobox">
           <title>Datasets Toolbox</title>
 
           <para>This toolbox displays Logical files for the environment to
@@ -1173,7 +1173,7 @@
           <para></para>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_ECLIDE_FindDatasetsToolbox">
           <title>Find (Datasets) Toolbox</title>
 
           <para>This toolbox allows you to search for Logical files in the
@@ -1231,7 +1231,7 @@
             </informaltable></para>
         </sect3>
 
-        <sect3 role="brk">
+        <sect3 id="CT_ECLIDE_SyntaxErrorsToolbox" role="brk">
           <title>Syntax Errors Toolbox</title>
 
           <para>The Syntax Errors toolbox displays syntax errors and warnings
@@ -1250,7 +1250,7 @@
           window.</para>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_ECLIDE_ErrorLogToolbox">
           <title>Error Log Toolbox</title>
 
           <para>The Error Log toolbox displays errors and warnings from the
@@ -1290,7 +1290,7 @@
       <sect2 id="Orb_Menu">
         <title><emphasis>Orb Menu</emphasis></title>
 
-        <sect3>
+        <sect3 id="CT_ECLIDE_OrbMenu">
           <title>Orb Menu</title>
 
           <para><graphic fileref="../../images/CT02.jpg" /></para>
@@ -1400,7 +1400,7 @@
 
         <para></para>
 
-        <sect3>
+        <sect3 id="CT_ECLIDE_RibbonCurrentTab">
           <title>Current Tab</title>
 
           <para>The <emphasis role="bold">Current Tab</emphasis> contains the
@@ -1437,7 +1437,7 @@
           </informaltable>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_ECLIDE_ClipboardTab">
           <title>Clipboard Tab</title>
 
           <para>The <emphasis role="bold">Clipboard Tab</emphasis> contains
@@ -1480,7 +1480,7 @@
           </informaltable>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_ECLIDE_TheEditorTab">
           <title>Editor Tab</title>
 
           <para><emphasis role="bold">The </emphasis><emphasis
@@ -1659,7 +1659,7 @@
           </informaltable>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_ECLIDE_SearchTab">
           <title>Search Tab</title>
 
           <para>The <emphasis role="bold">SearchTab</emphasis> contains the
@@ -1715,7 +1715,7 @@
           </informaltable>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_ECLIDE_SyntaxTab">
           <title>Syntax Tab</title>
 
           <para>The <emphasis role="bold">SyntaxTab</emphasis> contains the
@@ -1773,7 +1773,7 @@
           <para><emphasis role="bold"> </emphasis></para>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_ECLIDE_ECLTab">
           <title>ECL Tab</title>
 
           <para>The <emphasis role="bold">ECL Tab</emphasis> contains the
@@ -1840,7 +1840,7 @@
           <para><emphasis role="bold"> </emphasis></para>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_ECLIDE_BrowserTab">
           <title>Browser Tab</title>
 
           <para>The <emphasis role="bold">Browser </emphasis>tab is shown only
@@ -1910,7 +1910,7 @@
           <para><emphasis role="bold"> </emphasis></para>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_ECLIDE_WindowTab">
           <title>Window Tab</title>
 
           <para>The <emphasis role="bold">Window </emphasis>Tab contains
@@ -2011,7 +2011,7 @@
             </informaltable></para>
         </sect3>
 
-        <sect3 role="brk">
+        <sect3 id="CT_ECLIDE_WorkSpaceTab" role="brk">
           <title>Workspace(s) Tab</title>
 
           <graphic fileref="../../images/CT82.jpg" />
@@ -2030,7 +2030,7 @@
           you to use.</para>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_ECLIDE_ViewTab">
           <title>View Tab</title>
 
           <para><graphic fileref="../../images/CT47.jpg" /></para>
@@ -2041,7 +2041,7 @@
           locations.</para>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_ECLIDE_HelpMenu">
           <title>Help Menu</title>
 
           <para>The <emphasis role="bold">Help </emphasis>menu contains the
@@ -2076,10 +2076,10 @@
         </sect3>
       </sect2>
 
-      <sect2 id="Pop-Up_Menus">
+      <sect2 id="CT_ECLIDE_Pop-Up_Menus">
         <title><emphasis>Pop-up Menus</emphasis></title>
 
-        <sect3>
+        <sect3 id="CT_ECLIDE_WorkUnitPopUpMenu_">
           <title>Workunit Pop-up Menu</title>
 
           <para>Right-click on any Workunit for a Pop-up menu
@@ -2213,7 +2213,7 @@
           <para><emphasis role="bold"> </emphasis></para>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_ECLIDE_RepositoryPopUpMenu">
           <title>Repository Pop-up Menu</title>
 
           <para>Right-click in the <emphasis role="bold">Repository Window
@@ -2352,7 +2352,7 @@
           </informaltable>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_ECLIDE_ResultsPopUpMenu">
           <title>Results Pop-up Menu</title>
 
           <para>Right-click on Results Pop-up menu containing:</para>
@@ -2574,7 +2574,7 @@
           </informaltable>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_ECLIDE_UsingDrillDown">
           <title>Using Drilldown</title>
 
           <para>There are three different versions of drilldown: Drilldown,
@@ -2679,7 +2679,7 @@ ENDMACRO;
         <para>There is also a right-click pop-up menu with the all the options
         found on the <emphasis role="bold">Edit</emphasis> menu.</para>
 
-        <sect3 role="brk">
+        <sect3 id="CT_ECLIDE_AdvancedBuilderWindowOptions" role="brk">
           <title>Advanced Builder Window Options</title>
 
           <para>Press the <emphasis role="bold">More</emphasis> button to
@@ -2834,19 +2834,19 @@ ENDMACRO;
         <title><emphasis>ECL Watch View </emphasis></title>
 
         <para>A workunit’s Workunit Details page view is displayed in the ECL
-        Watch Tab. </para>
+        Watch Tab.</para>
 
         <para>The Workunit Details page provides more information about a
-        workunit. </para>
+        workunit.</para>
 
         <para>You can see specific information about the workunit by selecting
-        the various Workunit Detail tabs. </para>
+        the various Workunit Detail tabs.</para>
 
         <para><graphic fileref="../../images/ECLIDE_WuDetails.jpg"
         scalefit="1" /></para>
 
         <para>You can also perform actions on the workunit using the Workunit
-        Action buttons. </para>
+        Action buttons.</para>
 
         <informaltable colsep="1" frame="all" rowsep="1">
           <tgroup cols="2">
@@ -2860,8 +2860,8 @@ ENDMACRO;
 
                 <entry>You can copy a Workunit's ECL Watch URL by rt-clicking
                 on the <emphasis role="bold">Open in New Page</emphasis> icon
-                and selecting <emphasis role="bold">Copy Shortcut</emphasis>.
-                </entry>
+                and selecting <emphasis role="bold">Copy
+                Shortcut</emphasis>.</entry>
               </row>
             </tbody>
           </tgroup>
@@ -3151,7 +3151,7 @@ ENDMACRO;
         <para>The Home and View menu options are identical to those on the
         main the ECL IDE menu.</para>
 
-        <sect3>
+        <sect3 id="CT_ECLIDE_DeBug_BasicMenu">
           <title>Basic Menu</title>
 
           <para><emphasis role="bold">The </emphasis><emphasis
@@ -3384,7 +3384,7 @@ ENDMACRO;
           </informaltable>
         </sect3>
 
-        <sect3>
+        <sect3 id="CT_ECLIDE_DeBug_AdvancedMenu">
           <title>Advanced Menu</title>
 
           <para>The Advanced ribbon bar contains the following

+ 14 - 14
docs/HPCCClientTools/CT_Mods/CT_ESDL_CLI.xml

@@ -132,7 +132,7 @@
         <para></para>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_ESDL_CLI_esdl_xml" role="brk">
         <title>esdl xml</title>
 
         <para><emphasis role="bold">esdl xml [options] filename.ecm
@@ -188,7 +188,7 @@
 </programlisting>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_ESDL_CLI_esdl_ecl" role="brk">
         <title>esdl ecl</title>
 
         <para><emphasis role="bold">esdl ecl [options] filename.ecm
@@ -244,7 +244,7 @@
 </programlisting>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_ESDL_CLI_esdl_xsd" role="brk">
         <title>esdl xsd</title>
 
         <para><emphasis role="bold">esdl xsd [options] filename.ecm
@@ -298,7 +298,7 @@
 </programlisting>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_ESDL_CLI_esdl_wsdl" role="brk">
         <title>esdl wsdl</title>
 
         <para><emphasis role="bold">esdl wsdl [options] filename.ecm
@@ -352,7 +352,7 @@
 </programlisting>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_ESDL_CLI_esdl_publish" role="brk">
         <title>esdl publish</title>
 
         <para><emphasis role="bold">esdl publish &lt;servicename&gt;
@@ -442,7 +442,7 @@
 </programlisting>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_ESDL_CLI_esdl_list-definitions" role="brk">
         <title>esdl list-definitions</title>
 
         <para><emphasis role="bold">esdl list-definitions
@@ -511,7 +511,7 @@
         <para></para>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_ESDL_CLI_esdl_delete" role="brk">
         <title>esdl delete</title>
 
         <para><emphasis role="bold">esdl delete
@@ -596,7 +596,7 @@
         <para><emphasis role="bold"></emphasis></para>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_ESDL_CLI_esdl_bind-service" role="brk">
         <title>esdl bind-service</title>
 
         <para><emphasis role="bold">esdl bind-service</emphasis></para>
@@ -717,17 +717,17 @@
         inline or using a configuration file XML in the following
         syntax:</para>
 
-        <programlisting>&lt;Methods&gt;
+        <programlisting format="linespecific">&lt;Methods&gt;
   &lt;Method name="myMthd1" url="http://&lt;RoxieIP&gt;:9876/somepath?someparam=value" user="me" password="mypw"/&gt;
   &lt;Method name="myMthd2" url="http://&lt;RoxieIP&gt;:9876/somepath?someparam=value" user="me" password="mypw"/&gt;
 &lt;/Methods&gt;</programlisting>
 
         <para><emphasis role="bold">Example:</emphasis></para>
 
-        <programlisting>esdl bind-service myesp 8003 MathSvc.1 MathSvc --config MathSvcCfg.xml -s nnn.nnn.nnn.nnn -p 8010</programlisting>
+        <programlisting format="linespecific">esdl bind-service myesp 8003 MathSvc.1 MathSvc --config MathSvcCfg.xml -s nnn.nnn.nnn.nnn -p 8010</programlisting>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_ESDL_CLI_esdl_list-bindings" role="brk">
         <title>esdl list-bindings</title>
 
         <para><emphasis role="bold">esdl list-bindings
@@ -795,7 +795,7 @@
         <programlisting>esdl list-bindings -s nnn.nnn.nnn.nnn -p 8010</programlisting>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_ESDL_CLI_esdl_unbind-service" role="brk">
         <title>esdl unbind-service</title>
 
         <para><emphasis role="bold">esdl unbind-service
@@ -884,7 +884,7 @@
         <programlisting>esdl unbind-service myesp 8003 </programlisting>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_ESDL_CLI_esd_bind-method" role="brk">
         <title>esdl bind-method</title>
 
         <para><emphasis role="bold">esdl bind-method
@@ -1016,7 +1016,7 @@
         <programlisting>esdl bind-service myesp 8003 MathSvc.1 MathSvc --config MathSvcCfg.xml -s nnn.nnn.nnn.nnn -p 8010</programlisting>
       </sect2>
 
-      <sect2 role="brk">
+      <sect2 id="CT_ESDL_CLI_esdl_get-binding" role="brk">
         <title>esdl get-binding</title>
 
         <para><emphasis role="bold">esdl get-binding &lt;ESDLBindingId&gt;

+ 2 - 2
docs/HPCCClientTools/CT_Mods/CT_Overview.xml

@@ -76,7 +76,7 @@
       built-in functions in this document are always shown in ALL CAPS to make
       them stand out for easy identification.</para>
 
-      <sect3>
+      <sect3 id="CT_ECL_ExampleCode">
         <title>Example Code</title>
 
         <para>All example code in this document appears in the following
@@ -92,7 +92,7 @@
         purpose in examples.</para>
       </sect3>
 
-      <sect3>
+      <sect3 id="CT_ECL_Actions">
         <title>Actions</title>
 
         <para>In step-by-step sections, there will be explicit actions to

+ 3 - 3
docs/HPCCClientTools/CT_Mods/CT_Overview_withoutIDE.xml

@@ -62,7 +62,7 @@
       built-in functions in this document are always shown in ALL CAPS to make
       them stand out for easy identification.</para>
 
-      <sect3>
+      <sect3 id="CT_Conventions_ExampleCode">
         <title>Example Code</title>
 
         <para>All example code in this document appears in the following
@@ -78,7 +78,7 @@
         purpose in examples.</para>
       </sect3>
 
-      <sect3>
+      <sect3 id="CT_Convetions_Actions">
         <title>Actions</title>
 
         <para>In step-by-step sections, there will be explicit actions to
@@ -100,7 +100,7 @@
       </sect3>
     </sect2>
 
-    <sect2 id="Installation" role="brk">
+    <sect2 id="ClientTools_Installation" role="brk">
       <title>Installation</title>
 
       <para>The installation program installs all client tools, including the

+ 2 - 2
docs/HPCCClientTools/CT_Mods/ECLCC.xml

@@ -562,13 +562,13 @@
         </informaltable></para>
     </sect1>
 
-    <sect1 id="Examples">
+    <sect1 id="ECLCompiler_Examples">
       <title>Examples</title>
 
       <para>The following example demonstrates what you can do once the ECL
       Compiler is installed and operational.</para>
 
-      <sect2>
+      <sect2 id="ECLCompiler_RunningABasicECLProg_CLI">
         <title>Running a basic ECL program using the command line
         compiler</title>
 

+ 3 - 0
ecl/hqlcpp/hqlhtcpp.cpp

@@ -9293,7 +9293,10 @@ IHqlExpression * HqlCppTranslator::optimizeGraphPostResource(IHqlExpression * ex
     LinkedHqlExpr resourced = expr;
     // Second attempt to spot compound disk reads - this time of spill files for thor.
     resourced.setown(optimizeCompoundSource(resourced, csfFlags));
+
+    //MORE: This call (enabled by -fparanoid) isn't correct when this is processing a child query
     checkNormalized(resourced);
+
     //insert projects after compound created...
     if (options.optimizeResourcedProjects)
     {

+ 4 - 1
ecl/hqlcpp/hqlttcpp.cpp

@@ -8043,6 +8043,8 @@ void AutoScopeMigrateTransformer::doAnalyseExpr(IHqlExpression * expr)
     extra->firstUseIsSequential = isSequential;
     switch (expr->getOperator())
     {
+    //Really the child nodes should be visited, and marked to ensure they are never hoisted, implemented
+    //as a prior pass.  However long term this transformation should be removed, so not worth doing now.
     case no_allnodes:
     case no_keyedlimit:
     case no_nothor:
@@ -8095,7 +8097,6 @@ IHqlExpression * AutoScopeMigrateTransformer::createTransformed(IHqlExpression *
     switch (expr->getOperator())
     {
     case no_allnodes:
-    case no_keyedlimit:
     case no_libraryscope:
     case no_nothor:
     case no_sequential:
@@ -12659,6 +12660,8 @@ void normalizeHqlTree(HqlCppTranslator & translator, HqlExprArray & exprs)
         translator.noteFinishedTiming("compile:tree transform: normalize.scope", startCycles);
     }
 
+    translator.checkNormalized(exprs);
+
     if (translator.queryOptions().normalizeLocations)
         normalizeAnnotations(translator, exprs);
 

+ 9 - 3
esp/services/ws_workunits/ws_workunitsQuerySets.cpp

@@ -2509,9 +2509,15 @@ bool CWsWorkunitsEx::resetQueryStats(IEspContext& context, const char* target, I
         Owned<IPropertyIterator> it = queryIds->getIterator();
         ForEach(*it)
         {
-            const char *querySetId = it->getPropKey();
-            if (querySetId && *querySetId)
-                control.appendf("<Query id='%s'/>", querySetId);
+            const char *queryId = it->getPropKey();
+            if (queryId && *queryId)
+            {
+                appendXMLOpenTag(control, "Query", NULL, false);
+                appendXMLAttr(control, "id", queryId);
+                if (target && *target)
+                    appendXMLAttr(control, "target", target);
+                control.append("/>");
+            }
         }
         if (!control.length())
             throw MakeStringException(ECLWATCH_MISSING_PARAMS, "CWsWorkunitsEx::resetQueryStats: Query ID not specified");

+ 3 - 1
esp/src/eclwatch/HPCCPlatformWidget.js

@@ -411,7 +411,9 @@ define([
         _onMonitoring: function (evt) {
             this.stackContainer.selectChild(this.operationsPage);
             this.operationsPage.ensureWidget().then(function (operationsPage) {
-                operationsPage.widget.TabContainer.selectChild(operationsPage.widget._Monitoring);
+                operationsPage.widget._Topology.ensureWidget().then(function (topologyPage) {  //  This is needed otherwise topology will steal focus the first time it is delay loaded
+                    operationsPage.selectChild(operationsPage.widget._Monitoring);
+                });
             });
         },
 

+ 31 - 17
roxie/ccd/ccdstate.cpp

@@ -1328,24 +1328,21 @@ public:
         reply.appendf(" <PackageSet id=\"%s\" querySet=\"%s\"/>\n", queryPackageId(), querySet.get());
     }
 
-    void resetStats(const char *queryId, const IRoxieContextLogger &logctx)
+    bool resetStats(const char *queryId, const IRoxieContextLogger &logctx)
     {
         CriticalBlock b(updateCrit);
         if (queryId)
         {
             Owned<IQueryFactory> query = serverManager->getQuery(queryId, NULL, logctx);
-            if (query)
-            {
-                const char *id = query->queryQueryName();
-                serverManager->resetQueryTimings(id, logctx);
-                for (unsigned channel = 0; channel < numChannels; channel++)
-                    if (slaveManagers->item(channel))
-                    {
-                        slaveManagers->item(channel)->resetQueryTimings(id, logctx);
-                    }
-            }
-            else
-                throw MakeStringException(ROXIE_UNKNOWN_QUERY, "Unknown query %s", queryId);
+            if (!query)
+                return false;
+            const char *id = query->queryQueryName();
+            serverManager->resetQueryTimings(id, logctx);
+            for (unsigned channel = 0; channel < numChannels; channel++)
+                if (slaveManagers->item(channel))
+                {
+                    slaveManagers->item(channel)->resetQueryTimings(id, logctx);
+                }
         }
         else
         {
@@ -1354,6 +1351,7 @@ public:
                 if (slaveManagers->item(channel))
                     slaveManagers->item(channel)->resetAllQueryTimings();
         }
+        return true;
     }
 
     void getStats(const char *queryId, const char *action, const char *graphName, StringBuffer &reply, const IRoxieContextLogger &logctx) const
@@ -1393,6 +1391,10 @@ public:
         CriticalBlock b2(updateCrit);
         serverManager->getAllQueryInfo(reply, full, slaveManagers, logctx);
     }
+    const char *queryQuerySetName()
+    {
+        return querySet;
+    }
 protected:
 
     void reloadQueryManagers(CRoxieSlaveQuerySetManagerSet *newSlaveManagers, IRoxieQuerySetManager *newServerManager, hash64_t newHash)
@@ -1662,12 +1664,23 @@ public:
         }
     }
 
-    void resetStats(const char *id, const IRoxieContextLogger &logctx) const
+    void resetStats(const char *target, const char *id, const IRoxieContextLogger &logctx) const
     {
+        bool matched = false;
         ForEachItemIn(idx, allQueryPackages)
         {
-            allQueryPackages.item(idx).resetStats(id, logctx);
+            CRoxieQueryPackageManager &queryPackage = allQueryPackages.item(idx);
+            if (target && *target && !strieq(queryPackage.queryQuerySetName(), target))
+                continue;
+            if (allQueryPackages.item(idx).resetStats(id, logctx))
+            {
+                if (target && *target)
+                    return;
+                matched = true;
+            }
         }
+        if (!matched && id && *id)
+            throw MakeStringException(ROXIE_UNKNOWN_QUERY, "Unknown query %s", id);
     }
 
 private:
@@ -2526,14 +2539,15 @@ private:
                     {
                         IPropertyTree &query = queries->query();
                         const char *id = query.queryProp("@id");
+                        const char *target = query.queryProp("@target");
                         if (!id)
                             badFormat();
-                        allQueryPackages->resetStats(id, logctx);
+                        allQueryPackages->resetStats(target, id, logctx);
                         queries->next();
                     }
                 }
                 else
-                    allQueryPackages->resetStats(NULL, logctx);
+                    allQueryPackages->resetStats(NULL, NULL, logctx);
             }
             else if (stricmp(queryName, "control:resetremotedalicache")==0)
             {

+ 6 - 1
system/jlib/jsocket.cpp

@@ -4671,7 +4671,12 @@ public:
                             }
 # endif
                             if (epevents[j].data.fd >= 0) {
-                                assertex(epfdtbl[epevents[j].data.fd] >= 0);
+                                // assertex(epfdtbl[epevents[j].data.fd] >= 0);
+                                if (epfdtbl[epevents[j].data.fd] < 0)
+                                {
+                                    WARNLOG("epoll event for invalid fd: index = %d, fd = %d, eventmask = %u", j, epevents[j].data.fd, epevents[j].events);
+                                    continue;
+                                }
                                 SelectItem *epsi = items.getArray(epfdtbl[epevents[j].data.fd]);
                                 if (!epsi->del) {
                                     unsigned int ep_mode = 0;