Skip to content

Commit

Permalink
HPCC-31689 review changes
Browse files Browse the repository at this point in the history
Signed-off-by: Jake Smith <[email protected]>
  • Loading branch information
jakesmith committed Apr 26, 2024
1 parent 19a25f9 commit c3cf0e1
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions dali/daliadmin/daadmin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2273,8 +2273,8 @@ void checkFileSizeOne(IUserDescriptor *user, const char *lfn, bool fix)
Owned<IDistributedFile> dFile = queryDistributedFileDirectory().lookup(dlfn, user, AccessMode::tbdRead, false, false, nullptr, defaultPrivilegedUser, 30000); // 30 sec timeout
if (dFile)
{
bool locked = false;
COnScopeExit ensureUnlock([&]() { if (locked) dFile->unlockProperties(); });
bool fileLocked = false;
COnScopeExit ensureFileUnlock([&]() { if (fileLocked) dFile->unlockProperties(); });
if (dFile->querySuperFile())
WARNLOG("Skipping: file '%s' is a superfile", lfn);
else
Expand All @@ -2288,23 +2288,26 @@ void checkFileSizeOne(IUserDescriptor *user, const char *lfn, bool fix)
{
if (fix)
{
COnScopeExit ensurePartUnlock([&]() { part.unlockProperties(); });
offset_t partSize;
try
{
partSize = part.getFileSize(true, true);
if (!fileLocked)
{
// we lock the file once, so that the individual part lock/unlocks are effectively a NOP
dFile->lockProperties(30000);
fileLocked = true;
PROGLOG("File '%s' has missing @size attributes", lfn);
}
part.lockProperties(30000);
}
catch (IException *e)
{
EXCLOG(e);
e->Release();
continue;
}
if (!locked)
{
part.lockProperties(30000);
locked = true;
PROGLOG("File '%s' has missing @size attributes", lfn);
}
PROGLOG("Part %u: Setting @size to %" I64F "u", p+1, partSize);
attrs.setPropInt64("@size", partSize);
}
Expand Down

0 comments on commit c3cf0e1

Please sign in to comment.