Przeglądaj źródła

HPCC-11555 Remove contention on GeneratedDlls

Signed-off-by: Jake Smith <jake.smith@lexisnexis.com>
Jake Smith 11 lat temu
rodzic
commit
2a63ffbd25
1 zmienionych plików z 6 dodań i 3 usunięć
  1. 6 3
      common/dllserver/dllserver.cpp

+ 6 - 3
common/dllserver/dllserver.cpp

@@ -525,8 +525,6 @@ IDllEntry * DllServer::createEntry(IPropertyTree *owner, IPropertyTree *entry)
 
 void DllServer::doRegisterDll(const char * name, const char * kind, const char * dllPath, const char * libPath)
 {
-    Owned<IRemoteConnection> lock = querySDS().connect("/GeneratedDlls", myProcessSession(), RTM_LOCK_WRITE, CONNECTION_TIMEOUT);
-
     RemoteFilename dllRemote;
     StringBuffer ipText, dllText;
     dllRemote.setRemotePath(dllPath);
@@ -538,7 +536,9 @@ void DllServer::doRegisterDll(const char * name, const char * kind, const char *
     Owned<IRemoteConnection> conn = querySDS().connect(path.str(), myProcessSession(), RTM_LOCK_WRITE, CONNECTION_TIMEOUT);
     if (conn)
     {
-        //check the entry doesn't exist already....
+        /* check the entry doesn't exist already....
+         * Ideally the connection above would be a RTM_LOCK_READ and be changed to a RTM_LOCK_WRITE only when 'location' not found
+         */
         Owned<IPropertyTreeIterator> iter = conn->queryRoot()->getElements("location");
         ForEach(*iter)
         {
@@ -550,6 +550,9 @@ void DllServer::doRegisterDll(const char * name, const char * kind, const char *
     }
     else
     {
+        /* in theory, two clients/threads could get here at the same time
+         * in practice only one client/thread will be adding a unique named generated dll
+         */
         conn.setown(querySDS().connect("/GeneratedDlls/GeneratedDll", myProcessSession(), RTM_LOCK_WRITE|RTM_CREATE_ADD, CONNECTION_TIMEOUT));
         if (!conn)
         {