فهرست منبع

HPCC-10770 - updates following review

Signed-off-by: Jake Smith <jake.smith@lexisnexis.com>
Jake Smith 11 سال پیش
والد
کامیت
f2af629069
4فایلهای تغییر یافته به همراه21 افزوده شده و 33 حذف شده
  1. 1 4
      common/fileview2/fvrelate.cpp
  2. 4 16
      dali/base/dadfs.cpp
  3. 0 1
      dali/base/dadfs.hpp
  4. 16 12
      dali/daliadmin/daliadmin.cpp

+ 1 - 4
common/fileview2/fvrelate.cpp

@@ -467,10 +467,7 @@ ViewFile * ViewFileWeb::walkFile(const char * filename, IDistributedFile * alrea
             options.primaryDepth++;
         }
 
-        /* JCS->GH - See HPCC-10770, I'd like to remove isSubFile (this is the only place that calls it)
-         * is it necessary here, could it _just_ call getOwningsuperFiles() ?
-         */
-        if ((options.superDepth > 0) && resolved->isSubFile())
+        if ((options.superDepth > 0))
         {
             options.superDepth--;
             Owned<IDistributedSuperFileIterator> iter = resolved->getOwningSuperFiles();

+ 4 - 16
dali/base/dadfs.cpp

@@ -414,7 +414,7 @@ class CFileLockBase
 protected:
     Owned<IRemoteConnection> lock;
 
-    bool init(StringBuffer &lockPath, unsigned mode, IRemoteConnection *_conn, unsigned timeout, const char *msg)
+    bool init(const char *lockPath, unsigned mode, IRemoteConnection *_conn, unsigned timeout, const char *msg)
     {
         conn = NULL;
         lock.clear();
@@ -423,7 +423,7 @@ protected:
         {
             try
             {
-                lock.setown(querySDS().connect(lockPath.str(), myProcessSession(), mode, timeout>60000 ? 60000 : timeout));
+                lock.setown(querySDS().connect(lockPath, myProcessSession(), mode, timeout>60000 ? 60000 : timeout));
                 if (lock.get())
                 {
                     conn = _conn;
@@ -433,8 +433,7 @@ protected:
             }
             catch (ISDSException *e)
             {
-                unsigned remaining;
-                if (SDSExcpt_LockTimeout != e->errorCode() || tm.timedout(&remaining))
+                if (SDSExcpt_LockTimeout != e->errorCode() || tm.timedout())
                     throw;
                 WARNLOG("CFileAttrLockBase(%s) blocked for %ds", msg, tm.elapsed()/1000);
                 e->Release();
@@ -449,7 +448,7 @@ public:
     ~CFileLockBase()
     {
         // if conn provided, 'lock' was just a surrogate for the owner connection, commit now to conn if write lock
-        if (conn && lock && write)
+        if (conn && lock)
             conn->commit();
     }
     IRemoteConnection *detach()
@@ -2841,16 +2840,6 @@ public:
 #endif
     }
 
-
-    virtual bool isSubFile()
-    {
-        CriticalBlock block(sect);
-        // JCSMORE - this method should probably be removed, only file view uses it.
-        if (conn) // SuperOwner, could have changed whilst locked, ensure refreshed
-            conn->reload("SuperOwner");
-        return root&&root->hasProp("SuperOwner[1]");
-    }
-
     void setProtect(const char *owner, bool protect, unsigned timems)
     {
         if (logicalName.isForeign()) {
@@ -2872,7 +2861,6 @@ public:
         }
     }
 
-
     virtual IDistributedSuperFileIterator *getOwningSuperFiles(IDistributedFileTransaction *_transaction)
     {
         CriticalBlock block(sect);

+ 0 - 1
dali/base/dadfs.hpp

@@ -342,7 +342,6 @@ interface IDistributedFile: extends IInterface
     virtual unsigned getPositionPart(offset_t pos,offset_t &base)=0;            // get the part for a given position and the base offset of that part
 
     virtual IDistributedSuperFile *querySuperFile()=0;                          // returns non NULL if superfile
-    virtual bool isSubFile()=0;                                         // returns true if sub file of any SuperFile
     virtual IDistributedSuperFileIterator *getOwningSuperFiles(IDistributedFileTransaction *_transaction=NULL)=0;           // returns iterator for all parents
     virtual bool isCompressed(bool *blocked=NULL)=0;
 

+ 16 - 12
dali/daliadmin/daliadmin.cpp

@@ -710,20 +710,24 @@ static void dfsparents(const char *lname, IUserDescriptor *user)
 
 static void dfsunlink(const char *lname, IUserDescriptor *user)
 {
-    loop {
+    loop
+    {
         Owned<IDistributedFile> file = queryDistributedFileDirectory().lookup(lname,user,false,false,true);
-        if (file) {
-            Owned<IDistributedSuperFileIterator> iter = file->getOwningSuperFiles();
-            if (!iter->first())
-                break;
-            file.clear();
-            Owned<IDistributedSuperFile> sf = &iter->get();
-            iter.clear();
-            if (sf->removeSubFile(lname,false))
-                OUTLOG("removed %s from %s",lname,sf->queryLogicalName());
-            else
-                ERRLOG("FAILED to remove %s from %s",lname,sf->queryLogicalName());
+        if (!file)
+        {
+            ERRLOG("File '%s' not found", lname);
+            break;
         }
+        Owned<IDistributedSuperFileIterator> iter = file->getOwningSuperFiles();
+        if (!iter->first())
+            break;
+        file.clear();
+        Owned<IDistributedSuperFile> sf = &iter->get();
+        iter.clear();
+        if (sf->removeSubFile(lname,false))
+            OUTLOG("removed %s from %s",lname,sf->queryLogicalName());
+        else
+            ERRLOG("FAILED to remove %s from %s",lname,sf->queryLogicalName());
     }
 }