Sfoglia il codice sorgente

Merge pull request #4968 from richardkchapman/HPCC-10028-improvement

Hpcc 10028 improvement

Reviewed-by: Gavin Halliday <ghalliday@hpccsystems.com>
Gavin Halliday 11 anni fa
parent
commit
c6420659ba
2 ha cambiato i file con 6 aggiunte e 3 eliminazioni
  1. 5 2
      dali/base/dadfs.cpp
  2. 1 1
      dali/base/dadfs.hpp

+ 5 - 2
dali/base/dadfs.cpp

@@ -921,7 +921,7 @@ public:
     bool existsPhysical(const char *_logicalname,IUserDescriptor *user);
 
     void addEntry(CDfsLogicalFileName &lfn,IPropertyTree *root,bool superfile, bool ignoreexists);
-    bool removeEntry(const char *name, IUserDescriptor *user, IDistributedFileTransaction *transaction=NULL, unsigned timeoutms=INFINITE);
+    bool removeEntry(const char *name, IUserDescriptor *user, IDistributedFileTransaction *transaction=NULL, unsigned timeoutms=INFINITE, bool throwException=false);
     void renamePhysical(const char *oldname,const char *newname,IUserDescriptor *user,IDistributedFileTransaction *transaction);
     void removeEmptyScope(const char *name);
 
@@ -7544,7 +7544,7 @@ void CDistributedFileDirectory::removeSuperFile(const char *_logicalname, bool d
     localtrans->autoCommit();
 }
 
-bool CDistributedFileDirectory::removeEntry(const char *name, IUserDescriptor *user, IDistributedFileTransaction *transaction, unsigned timeoutms)
+bool CDistributedFileDirectory::removeEntry(const char *name, IUserDescriptor *user, IDistributedFileTransaction *transaction, unsigned timeoutms, bool throwException)
 {
     CDfsLogicalFileName logicalname;
     logicalname.set(name);
@@ -7573,6 +7573,9 @@ bool CDistributedFileDirectory::removeEntry(const char *name, IUserDescriptor *u
         StringBuffer msg;
         e->errorMessage(msg);
         ERRLOG("Error while deleting %s: %s", logicalname.get(), msg.str());
+        if (throwException)
+            throw;
+
         e->Release();
         return false;
     }

+ 1 - 1
dali/base/dadfs.hpp

@@ -449,7 +449,7 @@ interface IDistributedFileDirectory: extends IInterface
     virtual IDFScopeIterator *getScopeIterator(IUserDescriptor *user, const char *subscope=NULL,bool recursive=true,bool includeempty=false)=0;
 
     // Removes files and super-files with format: context/file@cluster
-    virtual bool removeEntry(const char *name, IUserDescriptor *user, IDistributedFileTransaction *transaction=NULL, unsigned timeoutms=INFINITE) = 0;
+    virtual bool removeEntry(const char *name, IUserDescriptor *user, IDistributedFileTransaction *transaction=NULL, unsigned timeoutms=INFINITE, bool throwException=false) = 0;
     virtual void renamePhysical(const char *oldname,const char *newname,IUserDescriptor *user,IDistributedFileTransaction *transaction) = 0;                         // renames the physical parts as well as entry
     virtual void removeEmptyScope(const char *scope) = 0;   // does nothing if called on non-empty scope