Bläddra i källkod

Merge pull request #2592 from jakesmith/dllsToSlaves-fix

Fix dllsToSlaves option

Reviewed-By: Gavin Halliday <gavin.halliday@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 13 år sedan
förälder
incheckning
c444630890
1 ändrade filer med 27 tillägg och 33 borttagningar
  1. 27 33
      thorlcr/slave/slavmain.cpp

+ 27 - 33
thorlcr/slave/slavmain.cpp

@@ -158,25 +158,17 @@ public:
                         queryClusterComm().flush(mptag);
                         deserializeMPtag(msg, slaveMsgTag);
                         queryClusterComm().flush(slaveMsgTag);
-                        StringBuffer soPath;
-                        StringAttr wuid, graphName, remoteSoPath;
+                        StringAttr wuid, graphName, soPath;
                         msg.read(wuid);
                         msg.read(graphName);
-                        msg.read(remoteSoPath);
+                        msg.read(soPath);
                         bool sendSo;
                         msg.read(sendSo);
-                        const SocketEndpoint &masterEp = queryClusterGroup().queryNode(0).endpoint();
                         if (sendSo)
                         {
                             size32_t size;
                             msg.read(size);
-                            globals->getProp("@query_so_dir", soPath);
-                            if (soPath.length())
-                                addPathSepChar(soPath);
-                            RemoteFilename rfn;
-                            rfn.setPath(masterEp, remoteSoPath);
-                            rfn.getTail(soPath);
-                            Owned<IFile> iFile = createIFile(soPath.str());
+                            Owned<IFile> iFile = createIFile(soPath);
                             try
                             {
                                 const void *soPtr = msg.readDirect(size);
@@ -199,36 +191,38 @@ public:
                                     ERRLOG("CJobListener::main: Current directory path too big, setting it to null");
                                     buf[0] = 0;
                                 }
-                                msg.append(buf).append(", path = ").append(soPath.str());
+                                msg.append(buf).append(", path = ").append(soPath);
                                 EXCLOG(e, msg.str());
                                 e->Release();
                             }
                             assertex(globals->getPropBool("Debug/@dllsToSlaves", true));
-                            querySoCache.add(soPath.str());
+                            querySoCache.add(soPath);
                         }
-                        else if (globals->getPropBool("Debug/@dllsToSlaves", true))
+                        else
                         {
-                            // i.e. should have previously been sent.
-                            globals->getProp("@query_so_dir", soPath);
-                            if (soPath.length())
-                                addPathSepChar(soPath);
                             RemoteFilename rfn;
-                            rfn.setPath(masterEp, remoteSoPath);
-                            rfn.getTail(soPath);
-                            OwnedIFile iFile = createIFile(soPath.str());
-                            if (!iFile->exists())
-                            {
-                                WARNLOG("Slave cached query dll missing: %s, will attempt to fetch from master", soPath.str());
-                                StringBuffer rpath;
+                            SocketEndpoint masterEp = queryClusterGroup().queryNode(0).endpoint();
+                            masterEp.port = 0;
+                            rfn.setPath(masterEp, soPath);
+                            StringBuffer rpath;
+                            if (rfn.isLocal())
+                                rfn.getLocalPath(rpath);
+                            else
                                 rfn.getRemotePath(rpath);
-                                if (rfn.isLocal())
-                                    rfn.getLocalPath(rpath.clear());
-                                copyFile(soPath.str(), rpath.str());
+                            if (globals->getPropBool("Debug/@dllsToSlaves", true))
+                            {
+                                // i.e. should have previously been sent.
+                                OwnedIFile iFile = createIFile(soPath);
+                                if (!iFile->exists())
+                                {
+                                    WARNLOG("Slave cached query dll missing: %s, will attempt to fetch from master", soPath.get());
+                                    copyFile(soPath, rpath.str());
+                                }
+                                querySoCache.add(soPath);
                             }
-                            querySoCache.add(soPath.str());
+                            else
+                                soPath.set(rpath.str());
                         }
-                        else
-                            soPath.append(remoteSoPath);
 
                         Owned<IPropertyTree> workUnitInfo = createPTree(msg);
                         StringBuffer user;
@@ -236,8 +230,8 @@ public:
 
                         PROGLOG("Started wuid=%s, user=%s, graph=%s\n", wuid.get(), user.str(), graphName.get());
 
-                        PROGLOG("Using query: %s", soPath.str());
-                        Owned<CJobSlave> job = new CJobSlave(watchdog, workUnitInfo, graphName, soPath.str(), mptag, slaveMsgTag);
+                        PROGLOG("Using query: %s", soPath.get());
+                        Owned<CJobSlave> job = new CJobSlave(watchdog, workUnitInfo, graphName, soPath, mptag, slaveMsgTag);
                         jobs.replace(*LINK(job));
 
                         Owned<IPropertyTree> deps = createPTree(msg);