From 7fe148a5fab65ce7f1676db8cc2a79a173fbfb44 Mon Sep 17 00:00:00 2001 From: Jack Del Vecchio Date: Fri, 8 Nov 2024 15:06:48 -0500 Subject: [PATCH] Add isContainerized() checks --- dali/base/dadfs.cpp | 17 +++++++++++------ dali/dfuXRefLib/dfuxreflib.cpp | 30 +++++++++++++++++++----------- 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/dali/base/dadfs.cpp b/dali/base/dadfs.cpp index ad289138bc9..0c6660eea98 100644 --- a/dali/base/dadfs.cpp +++ b/dali/base/dadfs.cpp @@ -277,16 +277,21 @@ RemoteFilename &constructPartFilename(IGroup *grp,unsigned partNo,unsigned copy, StringBuffer fullname; makePhysicalPartName(lname, partNo+1, max, fullname, 0, DFD_OSdefault, prefix, dirPerPart, stripeNum); - ClusterPartDiskMapSpec mspec; - mspec.replicateOffset = replicateOffset; - unsigned n; - unsigned d; - mspec.calcPartLocation(partNo, max, copy, grp?grp->ordinality():max, n, d); - setReplicateFilename(fullname, d); + unsigned n = 0; + if (!isContainerized()) + { + ClusterPartDiskMapSpec mspec; + mspec.replicateOffset = replicateOffset; + unsigned d; + mspec.calcPartLocation(partNo, max, copy, grp?grp->ordinality():max, n, d); + setReplicateFilename(fullname, d); + } + SocketEndpoint ep; if (grp) ep = grp->queryNode(n).endpoint(); rfn.setPath(ep, fullname.toLowerCase().str()); + return rfn; } diff --git a/dali/dfuXRefLib/dfuxreflib.cpp b/dali/dfuXRefLib/dfuxreflib.cpp index b6b62e63b4b..2ffc7482877 100644 --- a/dali/dfuXRefLib/dfuxreflib.cpp +++ b/dali/dfuXRefLib/dfuxreflib.cpp @@ -769,9 +769,9 @@ struct CLogicalNameEntry: public CInterface return false; } - RemoteFilename &constructPartFilename(unsigned partNo, unsigned copy, RemoteFilename &rfn) + RemoteFilename &constructPartFilename(unsigned partNo, bool replicate, RemoteFilename &rfn) { - return ::constructPartFilename(grp, partNo, copy, max, lfnHash, replicateOffset, dirPerPart, lname, prefix, pmask, plane, rfn); + return ::constructPartFilename(grp, partNo, replicate?1:0, max, lfnHash, replicateOffset, dirPerPart, lname, prefix, pmask, plane, rfn); } void resolve(CFileEntry *entry); @@ -939,10 +939,14 @@ static void constructPartname(const char *filename,unsigned n, StringBuffer &pn, static bool parseFileName(const char *name,StringBuffer &mname,unsigned &num,unsigned &max,bool &replicate) { // takes filename and creates mask filename with $P$ extension - StringBuffer nonrepdir; - replicate = setReplicateDir(name,nonrepdir,false); - if (replicate) - name = nonrepdir.str(); + if (!isContainerized()) + { + // Replicate dir is not supported in containerized environment + StringBuffer nonrepdir; + replicate = setReplicateDir(name,nonrepdir,false); + if (replicate) + name = nonrepdir.str(); + } Owned planesIter = getPlanesIterator("data", nullptr); ForEach(*planesIter) @@ -1644,6 +1648,11 @@ void loadFromDFS(CXRefManagerBase &manager,IGroup *grp,unsigned numdirs,const ch if (lnentry->outsidenodes.find(rep)==NotFound) lnentry->outsidenodes.append(rep); } + if (isContainerized()) + { + UWARNLOG("Replication not supported in containerized version"); + break; + } if (replicate) break; replicate = true; @@ -2773,12 +2782,11 @@ IPropertyTree * runXRef(unsigned nclusters,const char **clusters,IXRefProgressC #endif // assume all nodes same OS Owned group = queryNamedGroupStore().lookup(clusters[0]); -#ifdef _CONTAINERIZED - WARNLOG("CONTAINERIZED(runXRef calls queryOS())"); -#else - if (group) + if (isContainerized()) + WARNLOG("CONTAINERIZED(runXRef calls queryOS())"); + else if (group) islinux = queryOS(group->queryNode(0).endpoint())==MachineOsLinux; -#endif + dirs[0] = queryBaseDirectory(grp_unknown, 0,islinux?DFD_OSunix:DFD_OSwindows); // MORE - should use the info from the group store dirs[1] = queryBaseDirectory(grp_unknown, 1,islinux?DFD_OSunix:DFD_OSwindows); numdirs = 2;