Skip to content

Commit

Permalink
Merge pull request #18049 from jakesmith/HPCC-30883-foreign-group-fixes
Browse files Browse the repository at this point in the history
HPCC-30883 Fix k8s foreign lookup meta change issues

Reviewed-by: Gavin Halliday <[email protected]>
Merged-by: Gavin Halliday <[email protected]>
  • Loading branch information
ghalliday authored Nov 21, 2023
2 parents d846fe9 + 0a97ab6 commit 8f6714c
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions dali/base/dadfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11168,6 +11168,7 @@ class CDaliDFSServer: public Thread, public CTransactionLogTracker, implements I
CScopeConnectLock sconnlock("getFileTree", *logicalname, false, false, false, defaultTimeout);
IPropertyTree* sroot = sconnlock.conn()?sconnlock.conn()->queryRoot():NULL;
logicalname->getTail(tail);
INamedGroupStore *groupResolver = &queryNamedGroupStore();
if (version >= 2)
{
Owned<IPropertyTree> tree = getNamedPropTree(sroot,queryDfsXmlBranchName(DXB_File),"@name",tail.str(),false);
Expand All @@ -11179,7 +11180,9 @@ class CDaliDFSServer: public Thread, public CTransactionLogTracker, implements I
// asking for the returned meta data to be remapped to point to the dafilesrv service.
if (hasMask(opts, GetFileTreeOpts::remapToService))
{
tree.setown(createPTreeFromIPT(tree)); // copy live Dali tree, because it is about to be altered by remapGroupsToDafilesrv
remapGroupsToDafilesrv(tree, &queryNamedGroupStore());
groupResolver = nullptr; // do not attempt to resolve remapped group (it will not exist and cause addUnique to create a new anon one)

const char *remotePlaneName = tree->queryProp("@group");
Owned<IPropertyTree> filePlane = getStoragePlane(remotePlaneName);
Expand All @@ -11189,7 +11192,7 @@ class CDaliDFSServer: public Thread, public CTransactionLogTracker, implements I
}
}

Owned<IFileDescriptor> fdesc = deserializeFileDescriptorTree(tree,&queryNamedGroupStore(),IFDSF_EXCLUDE_CLUSTERNAMES);
Owned<IFileDescriptor> fdesc = deserializeFileDescriptorTree(tree,groupResolver,IFDSF_EXCLUDE_CLUSTERNAMES);
mb.append((int)1); // 1 == standard file
fdesc->serialize(mb);

Expand Down Expand Up @@ -11220,15 +11223,20 @@ class CDaliDFSServer: public Thread, public CTransactionLogTracker, implements I
{
if (version == MDFS_GET_FILE_TREE_V2)
{
#ifdef _CONTAINERIZED
// NB: to be here, the client is by definition legacy, and should be foreign.
// foreignAccess must also have been configured in this environment

if (getComponentConfigSP()->getPropBool("@foreignAccess"))
remapGroupsToDafilesrv(tree, &queryNamedGroupStore());
#endif
if (isContainerized())
{
// NB: to be here, the client is by definition legacy, and should only be via ~foreign.
// NB: foreignAccess is a auto-generated template setting, that is set to true if Dali and directio,
// have been exposed in the helm chart for foreign access.
if (getComponentConfigSP()->getPropBool("@foreignAccess"))
{
tree.setown(createPTreeFromIPT(tree)); // copy live Dali tree, because it is about to be altered by remapGroupsToDafilesrv
remapGroupsToDafilesrv(tree, &queryNamedGroupStore());
groupResolver = nullptr; // do not attempt to resolve remapped group (it will not exist and cause addUnique to create a new anon one)
}
}

Owned<IFileDescriptor> fdesc = deserializeFileDescriptorTree(tree,&queryNamedGroupStore(),IFDSF_EXCLUDE_CLUSTERNAMES);
Owned<IFileDescriptor> fdesc = deserializeFileDescriptorTree(tree,groupResolver,IFDSF_EXCLUDE_CLUSTERNAMES);

mb.append((int)-2).append(version);

Expand Down

0 comments on commit 8f6714c

Please sign in to comment.