Skip to content

Commit

Permalink
HPCC-31341 Fix DFU key copy issue if copying to different sized cluster
Browse files Browse the repository at this point in the history
If copying a key, wrap will be used, and the target part size must
match the source. The target number of parts was being set into
numPartsOverride, which was then picked up by the dfu job to
ensure the target file was created with the same number of parts.
However, the same setting is used as a request via spray/copy
services and is not permitted to be used on a key copy.

If the DFU workunit was resubmitted, the persisted numPartsOverride
was detected and a 'DestinationNumPartOverride is provided but
getWrap is true' error was fired.

Avoid setting numPartsOverride, instead set numParts,
thus avoiding the error if the DFU workunit is resubmitted.
Also allow NumPartsOverride as long as it matches source # parts.
And improve the error message.

Signed-off-by: Jake Smith <[email protected]>
  • Loading branch information
jakesmith committed Feb 26, 2024
1 parent ec806ac commit 6bad60d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
12 changes: 8 additions & 4 deletions dali/dfu/dfurun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1427,15 +1427,19 @@ class CDFUengine: public CInterface, implements IDFUengine
// keys default wrap for copy
if (destination->getWrap()||(iskey&&(cmd==DFUcmd_copy)))
{
if (destination->getNumPartsOverride())
throw makeStringExceptionV(-1, "DestinationNumPartOverride is provided but %s", destination->getWrap()?"getWrap is true":"is copying a key");
dst->setNumPartsOverride(srcFile->numParts());
unsigned numOverrideParts = destination->getNumPartsOverride();
if (numOverrideParts)
{
if (srcFile->numParts() != numOverrideParts)
throw makeStringExceptionV(-1, "Destination NumPartsOverride is provided but %s", (iskey&&(cmd==DFUcmd_copy))?"not supported when copying a key":"getWrap is true");
}
dst->setNumParts(srcFile->numParts());
}
else if (plane)
{
// use destination defaultSprayParts if requestor doesn't provide num parts
if (plane->hasProp("@defaultSprayParts") && destination->getNumPartsOverride()==0)
dst->setNumPartsOverride(plane->getPropInt("@defaultSprayParts"));
dst->setNumParts(plane->getPropInt("@defaultSprayParts"));
}
}
break;
Expand Down
2 changes: 1 addition & 1 deletion dali/dfu/dfuwu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1376,7 +1376,7 @@ class CDFUfileSpec: public CLinkedDFUWUchild, implements IDFUfileSpec
{
queryRoot()->setProp("@partmask",val);
}
void setNumParts(unsigned val)
virtual void setNumParts(unsigned val) override
{
queryRoot()->setPropInt("@numparts",val);

Expand Down
1 change: 1 addition & 0 deletions dali/dfu/dfuwu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ interface IDFUfileSpec: extends IConstDFUfileSpec
virtual void setFromXML(const char *xml) = 0;
virtual void setCompressed(bool set) = 0;
virtual void setWrap(bool val) = 0;
virtual void setNumParts(unsigned val) = 0;
virtual void setNumPartsOverride(unsigned num) = 0;
virtual void setReplicateOffset(int val) = 0; // sets for all clusters
virtual void setDiffKey(const char *keyname) = 0;
Expand Down

0 comments on commit 6bad60d

Please sign in to comment.