From d4c4918248345292a258cd66d37af99421fb1d38 Mon Sep 17 00:00:00 2001 From: Shamser Ahmed Date: Fri, 25 Oct 2024 11:36:47 +0100 Subject: [PATCH] HPCC-32879 Fix issue with FileAttrLock being used on superfiles For superfiles, use DXB_SuperFile for DfsXmlBranchKind argument in the CFileAttrLock::init() call. (If this is not done, superfile's attributes cannot be locked as dali attempt to lock a non-existant path). Signed-off-by: Shamser Ahmed --- dali/base/dadfs.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/dali/base/dadfs.cpp b/dali/base/dadfs.cpp index e22e5c7b487..7b008f187b4 100644 --- a/dali/base/dadfs.cpp +++ b/dali/base/dadfs.cpp @@ -2912,7 +2912,7 @@ class CDistributedFileBase : implements INTERFACE, public CInterface if (history) queryAttributes().removeTree(history); } - void lockFileAttrLock(CFileAttrLock & attrLock) + virtual void lockFileAttrLock(CFileAttrLock & attrLock) { if (!attrLock.init(logicalName, DXB_File, RTM_LOCK_WRITE, conn, defaultTimeout, "CDistributedFile::lockFileAttrLock")) { @@ -6482,6 +6482,19 @@ class CDistributedSuperFile: public CDistributedFileBase return new cSubFileIterator(subfiles,supersub); } + virtual void lockFileAttrLock(CFileAttrLock & attrLock) override + { + if (!attrLock.init(logicalName, DXB_SuperFile, RTM_LOCK_WRITE, conn, defaultTimeout, "CDistributedFile::lockFileAttrLock")) + { + // In unlikely event File/Attr doesn't exist, must ensure created, commited and root connection is reloaded. + verifyex(attrLock.init(logicalName, DXB_SuperFile, RTM_LOCK_WRITE|RTM_CREATE_QUERY, conn, defaultTimeout, "CDistributedFile::lockFileAttrLock")); + attrLock.commit(); + conn->commit(); + conn->reload(); + root.setown(conn->getRoot()); + } + } + void updateFileAttrs() { if (subfiles.ordinality()==0) {