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-31652 Guard against calculateSkew causing attach to fail #18564

Merged
Merged
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
38 changes: 24 additions & 14 deletions dali/base/dadfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3566,23 +3566,33 @@ class CDistributedFile: public CDistributedFileBase<IDistributedFile>

offset_t maxPartSz = 0, minPartSz = (offset_t)-1, totalPartSz = 0;

maxSkewPart = 0;
minSkewPart = 0;
for (unsigned p=0; p<np; p++)
try
{
IDistributedFilePart &part = queryPart(p);
offset_t size = part.getFileSize(true, false);
if (size > maxPartSz)
{
maxPartSz = size;
maxSkewPart = p;
}
if (size < minPartSz)
maxSkewPart = 0;
minSkewPart = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor, I might also set:
minSkew = maxSkew = 0;
here so they are set if an exception occurred, but I don't think these args are ever used if this routine returns false so it doesn't really matter.

for (unsigned p=0; p<np; p++)
{
minPartSz = size;
minSkewPart = p;
IDistributedFilePart &part = queryPart(p);
offset_t size = part.getFileSize(true, false);
if (size > maxPartSz)
{
maxPartSz = size;
maxSkewPart = p;
}
if (size < minPartSz)
{
minPartSz = size;
minSkewPart = p;
}
totalPartSz += size;
}
totalPartSz += size;
}
catch (IException *e)
{
// guard against getFileSize throwing an exception (if parts missing)
EXCLOG(e);
e->Release();
return false;
}
offset_t avgPartSz = totalPartSz / np;
if (0 == avgPartSz)
Expand Down
Loading