Skip to content

Commit

Permalink
Merge pull request #19160 from jakesmith/HPCC-32730-fix-close-fsync
Browse files Browse the repository at this point in the history
HPCC-32730 Fix fileSyncMaxRetrySecs and add tracing

Reviewed-by: Gavin Halliday <[email protected]>
Merged-by: Gavin Halliday <[email protected]>
  • Loading branch information
ghalliday authored Sep 27, 2024
2 parents 50ed84f + 80c2ca3 commit db6d4ce
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions system/jlib/jfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2066,9 +2066,14 @@ static void retrySync(int fd, int retrySecs, bool dataOnly)
unsigned retryAttempts = 0;
while (true)
{
CCycleTimer timer;
int ret = dataOnly ? fdatasync(fd) : fsync(fd);
if (ret == 0)
{
if (timer.elapsedMs() >= 10000)
IWARNLOG("retrySync slow fsync success: took %u ms", timer.elapsedMs());
break;
}
if (fileSyncRetryDisabled == retrySecs) // error, but unchecked! Temporary, to allow to be disabled JIC causes unexpected side-effects
break;
if (EIO != errno)
Expand All @@ -2081,7 +2086,7 @@ static void retrySync(int fd, int retrySecs, bool dataOnly)
throw e.getClear();
}
// In the event, not sure I care about burst of logging on retries (there won't be that many and this is fatal last throw of dice)
IWARNLOG("retrySync: failed with EIO, retry: %u", ++retryAttempts);
IWARNLOG("retrySync: failed after %u ms with EIO, retry: %u", timer.elapsedMs(), ++retryAttempts);
if (delayMs >= 60000) // cap max delay to 1 minute
MilliSleep(60000);
else
Expand Down Expand Up @@ -7975,8 +7980,9 @@ MODULE_INIT(INIT_PRIORITY_STANDARD)
value = plane.getPropInt64(("@" + std::string(planeAttributeTypeStrings[BlockedSequentialIO])).c_str(), unsetPlaneAttrValue);
values[BlockedSequentialIO] = (unsetPlaneAttrValue != value) ? value * 1024 : value;
value = plane.getPropInt64(("@" + std::string(planeAttributeTypeStrings[BlockedRandomIO])).c_str(), unsetPlaneAttrValue);
// plane expert settings
values[BlockedRandomIO] = (unsetPlaneAttrValue != value) ? value * 1024 : value;
values[FileSyncMaxRetrySecs] = plane.getPropInt64(("@" + std::string(planeAttributeTypeStrings[FileSyncMaxRetrySecs])).c_str(), unsetPlaneAttrValue);
values[FileSyncMaxRetrySecs] = plane.getPropInt64(("expert/@" + std::string(planeAttributeTypeStrings[FileSyncMaxRetrySecs])).c_str(), unsetPlaneAttrValue);
}

// reset defaults
Expand Down

0 comments on commit db6d4ce

Please sign in to comment.