Jelajahi Sumber

Remove port from renamePhysucal, too

Renato Golin 13 tahun lalu
induk
melakukan
b062bc3601

+ 25 - 42
dali/base/dadfs.cpp

@@ -909,7 +909,7 @@ public:
     void addEntry(CDfsLogicalFileName &lfn,IPropertyTree *root,bool superfile, bool ignoreexists);
     bool removeEntry(const char *_logicalname,IUserDescriptor *user);
     bool removePhysical(const char *_logicalname,const char *cluster,IMultiException *mexcept,IUserDescriptor *user);
-    bool renamePhysical(const char *oldname,const char *newname,unsigned short port,IMultiException *exceptions,IUserDescriptor *user);
+    bool renamePhysical(const char *oldname,const char *newname,IMultiException *exceptions,IUserDescriptor *user);
     void removeEmptyScope(const char *name);
 
     IDistributedSuperFile *lookupSuperFile(const char *logicalname,IUserDescriptor *user,IDistributedFileTransaction *transaction,bool fixmissing=false,unsigned timeout=INFINITE);
@@ -925,7 +925,7 @@ public:
     DistributedFileCompareResult fileCompare(const char *lfn1,const char *lfn2,DistributedFileCompareMode mode,StringBuffer &errstr,IUserDescriptor *user);
     bool filePhysicalVerify(const char *lfn1,bool includecrc,StringBuffer &errstr,IUserDescriptor *user);
     void setDefaultPreferredClusters(const char *clusters);
-    void fixDates(IDistributedFile *fil,unsigned short port);
+    void fixDates(IDistributedFile *fil);
 
     GetFileClusterNamesType getFileClusterNames(const char *logicalname,StringArray &out); // returns 0 for normal file, 1 for
 
@@ -3304,7 +3304,6 @@ public:
 
     bool renamePhysicalPartFiles(const char *newname,
                                  const char *cluster,
-                                 unsigned short port,
                                  IMultiException *mexcept,
                                  const char *newbasedir)
     {
@@ -3382,7 +3381,6 @@ public:
             StringAttrArray &newnamesrep;
             IDistributedFile *file;
             unsigned width;
-            unsigned short port;
             IMultiException *mexcept;
             bool *ignoreprim;
             bool *ignorerep;
@@ -3392,12 +3390,11 @@ public:
             bool * donerep;
             IException *except;
 
-            casyncforbase(IDistributedFile *_file,StringAttrArray &_newnamesprim,StringAttrArray &_newnamesrep,unsigned _width,unsigned short _port,IMultiException *_mexcept,CriticalSection &_crit,bool *_ignoreprim,bool *_ignorerep)
+            casyncforbase(IDistributedFile *_file,StringAttrArray &_newnamesprim,StringAttrArray &_newnamesrep,unsigned _width,IMultiException *_mexcept,CriticalSection &_crit,bool *_ignoreprim,bool *_ignorerep)
                 : newnamesprim(_newnamesprim),newnamesrep(_newnamesrep),crit(_crit)
             {
                 width = _width;
                 file = _file;
-                port = _port;
                 ok = true;
                 mexcept = _mexcept;
                 doneprim = (bool *)calloc(sizeof(bool),width);
@@ -3445,10 +3442,6 @@ public:
                         continue;
                     RemoteFilename newrfn;
                     newrfn.setPath(part->queryNode(copy)->endpoint(),newfn);
-                    if (port) {
-                        newrfn.setPort(port); // if daliservix
-                        oldrfn.setPort(port);
-                    }
                     try {
                         pok = doPart(part,copy!=0,oldrfn,newrfn,(copy==0)?doneprim[idx]:donerep[idx]);
 
@@ -3479,8 +3472,8 @@ public:
         class casyncfor1: public casyncforbase
         {
         public:
-            casyncfor1(IDistributedFile *_file,StringAttrArray &_newnamesprim,StringAttrArray &_newnamesrep,unsigned _width,unsigned short _port,IMultiException *_mexcept,CriticalSection &_crit,bool *_ignoreprim,bool *_ignorerep)
-                : casyncforbase(_file,_newnamesprim,_newnamesrep,_width,_port,_mexcept,_crit,_ignoreprim,_ignorerep)
+            casyncfor1(IDistributedFile *_file,StringAttrArray &_newnamesprim,StringAttrArray &_newnamesrep,unsigned _width,IMultiException *_mexcept,CriticalSection &_crit,bool *_ignoreprim,bool *_ignorerep)
+                : casyncforbase(_file,_newnamesprim,_newnamesrep,_width,_mexcept,_crit,_ignoreprim,_ignorerep)
             {
             }
             bool doPart(IDistributedFilePart *part,bool isrep,RemoteFilename &oldrfn,RemoteFilename &newrfn, bool &done)
@@ -3510,7 +3503,7 @@ public:
                 return true;
             }
 
-        } afor1 (this,newnamesprim,newnamesrep,width,port,mexcept,crit,NULL,NULL);
+        } afor1 (this,newnamesprim,newnamesrep,width,mexcept,crit,NULL,NULL);
         afor1.For(width,10,false,true);
         if (afor1.except)
             throw afor1.except; // no recovery needed
@@ -3539,8 +3532,8 @@ public:
         class casyncfor2: public casyncforbase
         {
         public:
-            casyncfor2(IDistributedFile *_file,StringAttrArray &_newnamesprim,StringAttrArray &_newnamesrep,unsigned _width,unsigned short _port,IMultiException *_mexcept,CriticalSection &_crit,bool *_ignoreprim,bool *_ignorerep)
-                : casyncforbase(_file,_newnamesprim,_newnamesrep,_width,_port,_mexcept,_crit,_ignoreprim,_ignorerep)
+            casyncfor2(IDistributedFile *_file,StringAttrArray &_newnamesprim,StringAttrArray &_newnamesrep,unsigned _width,IMultiException *_mexcept,CriticalSection &_crit,bool *_ignoreprim,bool *_ignorerep)
+                : casyncforbase(_file,_newnamesprim,_newnamesrep,_width,_mexcept,_crit,_ignoreprim,_ignorerep)
             {
             }
             bool doPart(IDistributedFilePart *part,bool isrep,RemoteFilename &oldrfn,RemoteFilename &newrfn, bool &done)
@@ -3559,7 +3552,7 @@ public:
                 return true;;
             }
 
-        } afor2 (this,newnamesprim,newnamesrep,width,port,mexcept,crit,ignoreprim,ignorerep);
+        } afor2 (this,newnamesprim,newnamesrep,width,mexcept,crit,ignoreprim,ignorerep);
         afor2.For(width,10,false,true);
         if (afor2.ok) {
             // now rename directory and partmask
@@ -3591,10 +3584,6 @@ public:
                             continue;
                         RemoteFilename newrfn;
                         newrfn.setPath(part->queryNode(copy)->endpoint(),newfn);
-                        if (port) {
-                            newrfn.setPort(port); // if daliservix
-                            oldrfn.setPort(port);
-                        }
                         for (unsigned t=1;t<3;t++) {    // 3 goes
                             try {
                                 StringBuffer oldfn;
@@ -4641,7 +4630,7 @@ public:
         return true; 
     }
 
-    bool renamePhysicalPartFiles(const char *newlfn,const char *cluster, unsigned short port,IMultiException *mexcept,const char *newbasedir)
+    bool renamePhysicalPartFiles(const char *newlfn,const char *cluster,IMultiException *mexcept,const char *newbasedir)
     {
         throw MakeStringException(-1,"renamePhysicalPartFiles not supported for SuperFiles");
         return false; 
@@ -6843,7 +6832,7 @@ bool CDistributedFileDirectory::removePhysical(const char *_logicalname,const ch
 }
 
     
-bool CDistributedFileDirectory::renamePhysical(const char *oldname,const char *newname,unsigned short port,IMultiException *exceptions,IUserDescriptor *user)
+bool CDistributedFileDirectory::renamePhysical(const char *oldname,const char *newname,IMultiException *exceptions,IUserDescriptor *user)
 {
     CriticalBlock block(removesect);
     if (!user)
@@ -6905,19 +6894,17 @@ bool CDistributedFileDirectory::renamePhysical(const char *oldname,const char *n
         splitfrom = true;
     }
     
-    if (port!=(unsigned short)-1) {
-        try {
-            if (!file->renamePhysicalPartFiles(newlogicalname.get(),splitfrom?oldcluster.str():NULL,port,exceptions))   
-                return false;
-        }
-        catch (IException *e)
-        {
-            StringBuffer msg("Renaming ");
-            msg.append(oldname).append(" to ").append(newname);
-            EXCLOG(e,msg.str());
-            e->Release();
+    try {
+        if (!file->renamePhysicalPartFiles(newlogicalname.get(),splitfrom?oldcluster.str():NULL,exceptions))
             return false;
-        }
+    }
+    catch (IException *e)
+    {
+        StringBuffer msg("Renaming ");
+        msg.append(oldname).append(" to ").append(newname);
+        EXCLOG(e,msg.str());
+        e->Release();
+        return false;
     }
     if (splitfrom) {
         oldfile->removeCluster(oldcluster.str());
@@ -6927,14 +6914,14 @@ bool CDistributedFileDirectory::renamePhysical(const char *oldname,const char *n
         ClusterPartDiskMapSpec mspec = file->queryPartDiskMapping(0);
         file->detach();
         newfile->addCluster(newcluster.str(),mspec);
-        fixDates(newfile,port);
+        fixDates(newfile);
     }
     else
         file->rename(newname,user);
     return true;
 }
 
-void CDistributedFileDirectory::fixDates(IDistributedFile *file,unsigned short port)
+void CDistributedFileDirectory::fixDates(IDistributedFile *file)
 {
     // should do in parallel 
     unsigned width = file->numParts();
@@ -6942,16 +6929,14 @@ void CDistributedFileDirectory::fixDates(IDistributedFile *file,unsigned short p
     class casyncfor: public CAsyncFor
     {
         IDistributedFile *file;
-        unsigned short port;
         CriticalSection &crit;
         unsigned width;
     public:
         bool ok;
-        casyncfor(IDistributedFile *_file,unsigned _width,unsigned short _port,CriticalSection &_errcrit)
+        casyncfor(IDistributedFile *_file,unsigned _width,CriticalSection &_errcrit)
             : crit(_errcrit)
         {
             file = _file;
-            port = _port;
             ok = true;
             width = _width;
             ok = true;
@@ -6967,8 +6952,6 @@ void CDistributedFileDirectory::fixDates(IDistributedFile *file,unsigned short p
             for (unsigned copy = 0; copy < nc; copy++) {
                 RemoteFilename rfn;
                 part->getFilename(rfn,copy);
-                if (port)
-                    rfn.setPort(port); // if daliservix
                 Owned<IFile> partfile = createIFile(rfn);
                 try {
                     CriticalUnblock unblock(crit);
@@ -6989,7 +6972,7 @@ void CDistributedFileDirectory::fixDates(IDistributedFile *file,unsigned short p
                 }
             }
         }
-    } afor(file,width,port,crit);
+    } afor(file,width,crit);
     afor.For(width,10,false,true);
 }
 

+ 2 - 2
dali/base/dadfs.hpp

@@ -243,7 +243,7 @@ interface IDistributedFile: extends IInterface
 
     virtual bool existsPhysicalPartFiles(unsigned short port) = 0;              // returns true if physical patrs all exist (on primary OR secondary)
 
-    virtual bool renamePhysicalPartFiles(const char *newlfn,const char *cluster=NULL,unsigned short port=0,IMultiException *exceptions=NULL,const char *newbasedir=NULL) = 0;           // renames all physical part files
+    virtual bool renamePhysicalPartFiles(const char *newlfn,const char *cluster=NULL,IMultiException *exceptions=NULL,const char *newbasedir=NULL) = 0;           // renames all physical part files
                                                                                 // returns true if no major errors
 
 
@@ -462,7 +462,7 @@ interface IDistributedFileDirectory: extends IInterface
 
     virtual bool removeEntry(const char *name,IUserDescriptor *user=NULL) = 0;  // equivalent to lookup/detach/release
     virtual bool removePhysical(const char *name,const char *cluster=NULL,IMultiException *exceptions=NULL,IUserDescriptor *user=NULL) = 0;                           // removes the physical parts as well as entry
-    virtual bool renamePhysical(const char *oldname,const char *newname,unsigned short port=0,IMultiException *exceptions=NULL,IUserDescriptor *user=NULL) = 0;                         // renames the physical parts as well as entry
+    virtual bool renamePhysical(const char *oldname,const char *newname,IMultiException *exceptions=NULL,IUserDescriptor *user=NULL) = 0;                         // renames the physical parts as well as entry
     virtual void removeEmptyScope(const char *scope) = 0;   // does nothing if called on non-empty scope
     
 

+ 1 - 1
dali/dfu/dfurun.cpp

@@ -1423,7 +1423,7 @@ public:
                         newfile.clear();
                         StringBuffer fromname(srcName);
                         srcFile.clear();
-                        if (!queryDistributedFileDirectory().renamePhysical(fromname.str(),toname.str(),0,NULL,userdesc))
+                        if (!queryDistributedFileDirectory().renamePhysical(fromname.str(),toname.str(),NULL,userdesc))
                             throw MakeStringException(-1,"rename failed"); // could do with better error here
                         StringBuffer timetaken;
                         timetaken.appendf("%dms",msTick()-start);

+ 1 - 1
plugins/fileservices/fileservices.cpp

@@ -463,7 +463,7 @@ FILESERVICES_API void FILESERVICES_CALL fsRenameLogicalFile(ICodeContext *ctx, c
     Linked<IUserDescriptor> udesc = ctx->queryUserDescriptor();
     Owned<IMultiException> exceptions = MakeMultiException();
 
-    if (queryDistributedFileDirectory().renamePhysical(lfn.str(),nlfn.str(),0,exceptions,udesc)) {
+    if (queryDistributedFileDirectory().renamePhysical(lfn.str(),nlfn.str(),exceptions,udesc)) {
         StringBuffer s("RenameLogicalFile ('");
         s.append(lfn).append(", '").append(nlfn).append("') done");
         WUmessage(ctx,ExceptionSeverityInformation,NULL,s.str());

+ 1 - 1
thorlcr/graph/thgraphmaster.cpp

@@ -1594,7 +1594,7 @@ bool CJobMaster::go()
 
                 StringBuffer newName;
                 queryThorFileManager().addScope(*this, tmpName, newName, true, true);
-                verifyex(file->renamePhysicalPartFiles(newName.str(), NULL, 0, NULL, queryBaseDirectory()));
+                verifyex(file->renamePhysicalPartFiles(newName.str(), NULL, NULL, queryBaseDirectory()));
 
                 file->attach(newName);