Skip to content

Commit

Permalink
Add isContainerized() checks
Browse files Browse the repository at this point in the history
  • Loading branch information
jackdelv committed Nov 8, 2024
1 parent 5aa25a9 commit 7fe148a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 17 deletions.
17 changes: 11 additions & 6 deletions dali/base/dadfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
30 changes: 19 additions & 11 deletions dali/dfuXRefLib/dfuxreflib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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<IPropertyTreeIterator> planesIter = getPlanesIterator("data", nullptr);
ForEach(*planesIter)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -2773,12 +2782,11 @@ IPropertyTree * runXRef(unsigned nclusters,const char **clusters,IXRefProgressC
#endif
// assume all nodes same OS
Owned<IGroup> 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;
Expand Down

0 comments on commit 7fe148a

Please sign in to comment.