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

Draft
wants to merge 32 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
19dd2f0
HPCC-30365 Add XREF Sasha service to K8s
jackdelv Apr 25, 2024
98e8920
Add constructPartFilename to CLogicalNameEntry
jackdelv Jul 8, 2024
8264482
Check if running on localhost before setting Dafs port to 0.
jackdelv Jul 8, 2024
a5171b1
Change error message to report missing storage planes rather than clu…
jackdelv Jul 8, 2024
6c65052
Move group combination to BM only.
jackdelv Jul 9, 2024
42e3436
Common up XRefNodes code with containerized case
jackdelv Jul 9, 2024
a54359c
Add call to calcStripeNumber and use makePhysucalPartName
jackdelv Jul 10, 2024
3106f80
Use lfnHash from file metadata instead of logical filename
jackdelv Jul 11, 2024
0c65a8e
Remove ifdef _CONTAINERIZED from constructPartFilename
jackdelv Aug 6, 2024
24017ae
Fix dir-per-part and stripNum masks in parseFileName.
jackdelv Aug 6, 2024
48b4a98
Remove Containerized DBGLOG message from generalized BM code in onDFU…
jackdelv Aug 8, 2024
7efc261
Co-locate fullname closer to makePhysicalPartName
jackdelv Aug 8, 2024
99c38f0
Properly check for dirPerPart in file flags.
jackdelv Aug 8, 2024
5058f0f
Add comment specifying meaning of localhost in xrefRemoteDirectories
jackdelv Aug 8, 2024
a3a5a14
Remove changes to runXref and add directory getting code to CXRefMana…
jackdelv Aug 9, 2024
f3a179f
Remove use of addUniqueXrefNode
jackdelv Nov 6, 2024
2978bd4
Add example options to xref
jackdelv Nov 6, 2024
09d8bfe
Move constructPartFilename funtion to dadfs.cpp
jackdelv Nov 7, 2024
c5a4c09
Change to makeStringException
jackdelv Nov 7, 2024
c02e30b
Treat paths as case sensitive
jackdelv Nov 7, 2024
58cc7f6
Match file prefix to storage plane definition
jackdelv Nov 8, 2024
c799d21
Add isContainerized() checks
jackdelv Nov 8, 2024
e12cbfb
Add tests for parseFileName to datest.cpp
jackdelv Nov 20, 2024
cbbc80a
Add comments for future work
jackdelv Nov 21, 2024
f4b8549
Change required argument to false
jackdelv Nov 21, 2024
85fd240
Update parseFilename and move tests
jackdelv Dec 10, 2024
0f3f7b8
Add constructPartFilename to CLogicalNameEntry
jackdelv Jul 8, 2024
ccab469
Add tests for parseFileName to datest.cpp
jackdelv Nov 20, 2024
6cb1c8f
Remove old changes
jackdelv Dec 10, 2024
d584c6b
Fix rebase issue.
jackdelv Dec 10, 2024
8c3bc48
Changed name increment
jackdelv Dec 17, 2024
c49964c
Rename deprecated version of constructPartFilename
jackdelv Dec 17, 2024
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
6 changes: 3 additions & 3 deletions dali/base/dadfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ 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,IStoragePlane *plane,RemoteFilename &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;
Expand All @@ -286,8 +286,8 @@ RemoteFilename &constructPartFilename(IGroup *grp,unsigned partNo,unsigned copy,
}
lname = expandMask(partName, pmask, partNo, max);
}
// Get stripeNum from storage plane
unsigned stripeNum = calcStripeNumber(partNo+1, lfnHash, plane->numDevices());

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

StringBuffer fullname;
makePhysicalPartName(lname, partNo+1, max, fullname, 0, DFD_OSdefault, prefix, dirPerPart, stripeNum);
Expand Down
2 changes: 1 addition & 1 deletion dali/base/dadfs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ enum DistributedFileSystemError


// utility routines (used by xref and dfu)
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,IStoragePlane *plane,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 &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)
Expand Down
3 changes: 3 additions & 0 deletions dali/base/dafdesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3579,7 +3579,10 @@ void GroupInformation::createStoragePlane(IPropertyTree * storage, unsigned copy
StringBuffer mirrorname;
const char * planeName = name;
if (copy != 0)
{
planeName = mirrorname.append(name).append("_mirror");
plane->setPropBool("@copy", true);
}

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

Expand Down
4 changes: 1 addition & 3 deletions dali/datest/datest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ include_directories (
${HPCC_SOURCE_DIR}/fs/dafsstream
${HPCC_SOURCE_DIR}/rtl/include
${HPCC_SOURCE_DIR}/rtl/eclrtl
${HPCC_SOURCE_DIR}/dali/dfuXRefLib
)

HPCC_ADD_EXECUTABLE ( datest ${SRCS} )
Expand All @@ -51,8 +50,7 @@ target_link_libraries ( datest
dafsstream
eclrtl
wsdfuaccess
dalibase
dfuXRefLib
dalibase
${CppUnit_LIBRARIES}
)

Expand Down
105 changes: 2 additions & 103 deletions dali/datest/datest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@

#include "rtlformat.hpp"

#include "dfuxreflib.hpp"

#include "jptree.hpp"
#include "wsdfuaccess.hpp"

Expand Down Expand Up @@ -80,10 +78,9 @@ static void addTestFile(const char *name,unsigned n)
StringBuffer partmask;
getPartMask(partmask,name,n);
StringBuffer path;
IStoragePlane *plane = getDataStoragePlane("mystorageplane", true);
for (unsigned m=0; m<n; m++) {
RemoteFilename rfn;
constructPartFilename(group,m+1,1,n,0,0,false,"",dir.str(),partmask.str(),plane,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 @@ -3320,108 +3317,17 @@ void testlockprop(const char *lfn)
printf("done\n");
}

void TestParseFileName()
{
StringBuffer mname;
unsigned num;
unsigned max;
bool replicate;

// Standard file name with multiple parts
assertex(testParseFileName("/var/lib/HPCCSystems/hpcc-data/test/myname._1_of_3", mname.clear(), num, max, replicate));
assertex(strcmp(mname.str(), "/var/lib/HPCCSystems/hpcc-data/test/myname._$P$_of_3")==0);
assertex(num==1);
assertex(max==3);
assertex(replicate==true);

// Standard file name with multiple parts is striped across directories, storage plane has numDevices set for it
assertex(testParseFileName("/var/lib/HPCCSystems/hpcc-data-two/d1/test/myname._10_of_30", mname.clear(), num, max, replicate));
assertex(strcmp(mname.str(), "/var/lib/HPCCSystems/hpcc-data-two/d$P$/test/myname._$P$_of_30")==0);
assertex(num==10);
assertex(max==30);
assertex(replicate==true);

// Standard file name with multiple parts is striped across directories and each part has its own directory, storage plane has numDevices set for it
assertex(testParseFileName("/var/lib/HPCCSystems/hpcc-data-two/d1/test/42/myname._42_of_100", mname.clear(), num, max, replicate));
assertex(strcmp(mname.str(), "/var/lib/HPCCSystems/hpcc-data-two/d$P$/test/$P$/myname._$P$_of_100")==0);
assertex(num==42);
assertex(max==100);
assertex(replicate==true);

// Test a longer part number
assertex(testParseFileName("/var/lib/HPCCSystems/hpcc-data-two/d110/test/12345/myname._12345_of_100000", mname.clear(), num, max, replicate));
assertex(strcmp(mname.str(), "/var/lib/HPCCSystems/hpcc-data-two/d$P$/test/$P$/myname._$P$_of_100000")==0);
assertex(num==12345);
assertex(max==100000);
assertex(replicate==true);

// A file without a storage plane throws an exception
try {
testParseFileName("/test/myname._1_of_3", mname.clear(), num, max, replicate);
assertex(false);
} catch (IException *e) {
StringBuffer msg;
e->errorMessage(msg);
e->Release();
assertex(strcmp(msg.str(), "Could not find matching prefix in plane definition for file /test/myname._1_of_3")==0);
}

// A file with a storage plane that has numDevices>1 but no stripe number in the path throws an exception
try {
testParseFileName("/var/lib/HPCCSystems/hpcc-data-two/test/myname.42_of_100", mname.clear(), num, max, replicate);
assertex(false);
} catch (IException *e) {
StringBuffer msg;
e->errorMessage(msg);
e->Release();
assertex(strcmp(msg.str(), "In storage plane definition numDevices>1, but no stripe sub-directory found in file /var/lib/HPCCSystems/hpcc-data-two/test/myname.42_of_100")==0);
}

// A file where the dir-per-part number does not match the part number
try {
testParseFileName("/var/lib/HPCCSystems/hpcc-data-two/d1/test/42/myname._43_of_100", mname.clear(), num, max, replicate);
assertex(false);
} catch (IException *e) {
StringBuffer msg;
e->errorMessage(msg);
e->Release();
assertex(strcmp(msg.str(), "Dir-per-part # does not match part # of file /var/lib/HPCCSystems/hpcc-data-two/d1/test/42/myname._43_of_100")==0);
}

printf("All parseFileName tests passed\n");
}

void usage(const char *error=NULL)
{
if (error) printf("%s\n", error);
printf("usage: DATEST <server_ip:port>* [/test <name> [<test params...>] [/NITER <iterations>]\n");
printf("where name = RANDTEST | DFS | QTEST | QTEST2 | SESSION | LOCKS | SDS1 | SDS2 | XPATHS| STRESS | STRESS2 | SHUTDOWN | EXTERNAL | SUBLOCKS | SUBSCRIPTION | CONNECTIONSUBS | MULTIFILE | NODESUBS | DFUSTREAMREAD | DFUSTREAMWRITE | DFUSTREAMCOPY | PARSEFILENAME\n");
printf("where name = RANDTEST | DFS | QTEST | QTEST2 | SESSION | LOCKS | SDS1 | SDS2 | XPATHS| STRESS | STRESS2 | SHUTDOWN | EXTERNAL | SUBLOCKS | SUBSCRIPTION | CONNECTIONSUBS | MULTIFILE | NODESUBS | DFUSTREAMREAD | DFUSTREAMWRITE | DFUSTREAMCOPY\n");
printf("eg: datest . /test QTEST put -- one coven server running locally, running qtest with param \"put\"\n");
printf(" datest eq0001016 eq0001017 -- two coven servers, use default test %s\n", DEFAULT_TEST);
}

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

static constexpr const char * defaultYaml = R"!!(
version: "1.0"
datest:
name: datest
global:
storage:
planes:
- name: mystorageplane
storageClass: ""
storageSize: 1Gi
prefix: "/var/lib/HPCCSystems/hpcc-data"
category: data
- name: mystripedplane
storageClass: ""
storageSize: 1Gi
prefix: "/var/lib/HPCCSystems/hpcc-data-two"
numDevices: 2
category: data
)!!";

int main(int argc, char* argv[])
{
ReleaseAtomBlock rABlock;
Expand All @@ -3430,10 +3336,6 @@ int main(int argc, char* argv[])
EnableSEHtoExceptionMapping();

try {
//NB: required initialization for anything that may call getGlobalConfig*() or getComponentConfig*()
Owned<IPropertyTree> globals = loadConfiguration(defaultYaml, (const char **)argv, "datest", nullptr, nullptr, nullptr, nullptr, false);
initializeStorageGroups(true);

StringBuffer cmd;
splitFilename(argv[0], NULL, NULL, &cmd, NULL);
StringBuffer lf;
Expand Down Expand Up @@ -3573,7 +3475,6 @@ int main(int argc, char* argv[])
case 10: TestSubLocks(); break;
case 11: TestSDS3(group); break;
case 12: TestNodeSubs(); break;
case 13: TestParseFileName(); break;
}
}
else if (TEST("DFS"))
Expand Down Expand Up @@ -3628,8 +3529,6 @@ int main(int argc, char* argv[])
testDfuStreamWrite(testParams.ordinality() ? testParams.item(0) : nullptr);
else if (TEST("DFUSTREAMCOPY"))
testDfuStreamCopy(testParams.ordinality() ? testParams.item(0) : nullptr);
else if (TEST("PARSEFILENAME"))
TestParseFileName();
// else if (TEST("DALILOG"))
// testDaliLog(testParams.ordinality()&&0!=atoi(testParams.item(0)));
else
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