瀏覽代碼

HPCC-12257 Faster dafilesrv version check on thor startup when replicate is on

remove global CS in stopRemoteServer() as per comments.
moved dedup of nodes from thormaster into validateNodes()

Signed-off-by: Mark Kelly <mark.kelly@lexisnexis.com>
Mark Kelly 10 年之前
父節點
當前提交
6f1fb3e40d
共有 2 個文件被更改,包括 7 次插入5 次删除
  1. 5 1
      common/remote/rmtfile.cpp
  2. 2 4
      common/remote/sockfile.cpp

+ 5 - 1
common/remote/rmtfile.cpp

@@ -656,10 +656,14 @@ public:
     }
 };
 
-unsigned validateNodes(const SocketEndpointArray &eps,const char *dataDir, const char *mirrorDir, bool chkver, const char *script, unsigned scripttimeout, SocketEndpointArray &failures, UnsignedArray &failedcodes, StringArray &failedmessages, const char *filename)
+unsigned validateNodes(const SocketEndpointArray &epso,const char *dataDir, const char *mirrorDir, bool chkver, const char *script, unsigned scripttimeout, SocketEndpointArray &failures, UnsignedArray &failedcodes, StringArray &failedmessages, const char *filename)
 {
     // used for detecting duff nodes
     IPointerArrayOf<ISocket> sockets;
+    // dedup nodes
+    SocketEndpointArray eps;
+    ForEachItemIn(i1,epso)
+        eps.appendUniq(epso.element(i1));
     unsigned to=30*1000;
     unsigned n=eps.ordinality();    // use approx log scale (timeout is long but only for failure situation)
     while (n>1) {

+ 2 - 4
common/remote/sockfile.cpp

@@ -2598,8 +2598,7 @@ void CRemoteFile::copyTo(IFile *dest, size32_t buffersize, ICopyFileProgress *pr
 
 unsigned getRemoteVersion(ISocket * socket, StringBuffer &ver)
 {
-    static CriticalSection sect;
-    CriticalBlock block(sect);
+    // used to have a global critical section here
     if (!socket)
         return 0;
     unsigned ret;
@@ -2638,8 +2637,7 @@ unsigned getRemoteVersion(ISocket * socket, StringBuffer &ver)
 
 extern unsigned stopRemoteServer(ISocket * socket)
 {
-    static CriticalSection sect;
-    CriticalBlock block(sect);
+    // used to have a global critical section here
     if (!socket)
         return 0;
     MemoryBuffer sendbuf;