Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPCC-30365 Add XREF Sasha service to K8s #18798

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 42 additions & 3 deletions dali/base/dadfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,9 @@ extern da_decl cost_type calcDiskWriteCost(const StringArray & clusters, stat_ty
return writeCost;
}

// JCSMORE - I suspect this function should be removed/deprecated. It does not deal with dirPerPart or striping.
// makePhysicalPartName supports both, but does not deal with groups/endpoints)
RemoteFilename &constructPartFilename(IGroup *grp,unsigned partno,unsigned partmax,const char *name,const char *partmask,const char *partdir,unsigned copy,ClusterPartDiskMapSpec &mspec,RemoteFilename &rfn)

// Deprecated and should be removed and new feature tested
RemoteFilename &deprecatedConstructPartFilename(IGroup *grp,unsigned partno,unsigned partmax,const char *name,const char *partmask,const char *partdir,unsigned copy,ClusterPartDiskMapSpec &mspec,RemoteFilename &rfn)
{
partno--;
StringBuffer tmp;
Expand All @@ -273,6 +273,45 @@ RemoteFilename &constructPartFilename(IGroup *grp,unsigned partno,unsigned partm
return rfn;
}

RemoteFilename &constructPartFilename(IGroup *grp,unsigned partNo,unsigned copy,unsigned max,unsigned lfnHash,int replicateOffset,bool dirPerPart,const char *lname,const char *prefix,const char *pmask,unsigned numDevices,RemoteFilename &rfn)
{
partNo--;
StringBuffer partName;
if (!lname||!*lname)
{
if (!pmask)
{
pmask = "!ERROR!._$P$_of_$N$";
IERRLOG("No partmask for constructPartFilename");
}
lname = expandMask(partName, pmask, partNo, max);
}

unsigned stripeNum = calcStripeNumber(partNo+1, lfnHash, numDevices);

StringBuffer fullname;
makePhysicalPartName(lname, partNo+1, max, fullname, 0, DFD_OSdefault, prefix, dirPerPart, stripeNum);

// revisit: constructPartFilename should be refactored not to deal with replicate directories, by pre-determining the alternate prefix if copy>0
// If copy>0 it could do calPartLocation, find the replicate plane, get it's prefix, and pass to makePhysicalPartName
unsigned n = 0;
if (!isContainerized())
jakesmith marked this conversation as resolved.
Show resolved Hide resolved
{
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;
}

inline void LOGPTREE(const char *title,IPropertyTree *pt)
{
StringBuffer buf;
Expand Down
7 changes: 4 additions & 3 deletions dali/base/dadfs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -811,14 +811,15 @@ enum DistributedFileSystemError


// utility routines (used by xref and dfu)
extern da_decl RemoteFilename &constructPartFilename(IGroup *grp,unsigned partno,unsigned partmax,const char *name,const char *partmask,const char *partdir,unsigned copy,ClusterPartDiskMapSpec &mspec,RemoteFilename &rfn);
extern da_decl RemoteFilename &constructPartFilename(IGroup *grp,unsigned partNo,unsigned copy,unsigned max,unsigned lfnHash,int replicateOffset,bool dirPerPart,const char *lname,const char *prefix,const char *pmask,unsigned numDevices,RemoteFilename &rfn);
extern da_decl RemoteFilename &deprecatedConstructPartFilename(IGroup *grp,unsigned partno,unsigned partmax,const char *name,const char *partmask,const char *partdir,unsigned copy,ClusterPartDiskMapSpec &mspec,RemoteFilename &rfn);
// legacy version
inline RemoteFilename &constructPartFilename(IGroup *grp,unsigned partno,unsigned partmax,const char *name,const char *partmask,const char *partdir,bool replicate,int replicateoffset,RemoteFilename &rfn,bool localmount=false)
inline RemoteFilename &deprecatedConstructPartFilename(IGroup *grp,unsigned partno,unsigned partmax,const char *name,const char *partmask,const char *partdir,bool replicate,int replicateoffset,RemoteFilename &rfn,bool localmount=false)
{
// local mount ignored!
ClusterPartDiskMapSpec mspec;
mspec.replicateOffset = replicateoffset;
return constructPartFilename(grp,partno,partmax,name,partmask,partdir,replicate?1:0,mspec,rfn);
return deprecatedConstructPartFilename(grp,partno,partmax,name,partmask,partdir,replicate?1:0,mspec,rfn);
}

extern da_decl IDFPartFilter *createPartFilter(const char *filter);
Expand Down
9 changes: 9 additions & 0 deletions dali/base/dafdesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3576,10 +3576,19 @@ void GroupInformation::createStoragePlane(IPropertyTree * storage, unsigned copy
return;

IPropertyTree * plane = storage->addPropTree("planes");

// Revisit: Ignore hthor planes when running XRef on storage planes
if (startsWith(name, "hthor"))
plane->setPropBool("@hthorplane", true);

StringBuffer mirrorname;
const char * planeName = name;
if (copy != 0)
{
planeName = mirrorname.append(name).append("_mirror");
// Set copy to true to be able to avoid running XRef on mirror planes
plane->setPropBool("@copy", true);
}

plane->setProp("@name", planeName);

Expand Down
3 changes: 1 addition & 2 deletions dali/datest/datest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ static void addTestFile(const char *name,unsigned n)
StringBuffer path;
for (unsigned m=0; m<n; m++) {
RemoteFilename rfn;
constructPartFilename(group,m+1,n,NULL,partmask.str(),dir.str(),false,1,rfn);
constructPartFilename(group,m+1,1,n,0,0,false,"",dir.str(),partmask.str(),0,rfn);
rfn.getLocalPath(path.clear());
Owned<IPropertyTree> pp = createPTree("Part");
pp->setPropInt64("@size",1234*(m+1));
Expand Down Expand Up @@ -3328,7 +3328,6 @@ void usage(const char *error=NULL)

struct ReleaseAtomBlock { ~ReleaseAtomBlock() { releaseAtoms(); } };


int main(int argc, char* argv[])
{
ReleaseAtomBlock rABlock;
Expand Down
4 changes: 3 additions & 1 deletion dali/dfuXRefLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ include_directories (
./../../common/environment
./../../common/workunit
./../../system/security/shared
${HPCC_SOURCE_DIR}/testing/unittests
)

ADD_DEFINITIONS( -D_USRDLL -DDFUXREFLIB_EXPORTS )
Expand All @@ -57,7 +58,8 @@ target_link_libraries ( dfuXRefLib
mp
hrpc
dafsclient
dalibase
dalibase
${CppUnit_LIBRARIES}
)

if (NOT CONTAINERIZED)
Expand Down
Loading
Loading