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-32828 Add filename to fsync warnings #19210

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
20 changes: 10 additions & 10 deletions system/jlib/jfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2055,7 +2055,7 @@ void CFileIO::setSize(offset_t pos)

//-- Unix implementation ----------------------------------------------------

static void doSync(int fd, bool dataOnly)
static void doSync(const CFileIO &fileIO, int fd, bool dataOnly)
{
#ifdef F_FULLFSYNC
// No EIO type retry available
Expand All @@ -2066,25 +2066,25 @@ static void doSync(int fd, bool dataOnly)
if (ret == 0)
{
if (timer.elapsedMs() >= 10000)
IWARNLOG("doSync: slow success: took %u ms", timer.elapsedMs());
IWARNLOG("doSync(%s): slow success: took %u ms", fileIO.querySafeFilename(), timer.elapsedMs());
}
else
{
int err = errno;
printStackReport();
Owned<IException> e = makeErrnoExceptionV(err, "doSync: failed after %u ms", timer.elapsedMs());
Owned<IException> e = makeErrnoExceptionV(err, "doSync(%s): failed after %u ms", fileIO.querySafeFilename(), timer.elapsedMs());
OWARNLOG(e);
throw e.getClear();
}
#endif
}

static void syncFileData(int fd, bool notReadOnly, IFEflags extraFlags, bool wait_previous=false)
static void syncFileData(const CFileIO &fileIO, int fd, bool notReadOnly, IFEflags extraFlags, bool wait_previous=false)
{
if (notReadOnly)
{
if (extraFlags & IFEsync)
doSync(fd, true);
doSync(fileIO, fd, true);
#if defined(__linux__)
else if (extraFlags & IFEnocache)
{
Expand Down Expand Up @@ -2176,9 +2176,9 @@ void CFileIO::close()
DBGLOG("CFileIO::close(%d), extraFlags = %d", tmpHandle, extraFlags);
#endif
if (extraFlags & (IFEnocache | IFEsync))
syncFileData(tmpHandle, openmode!=IFOread, extraFlags, false);
syncFileData(*this, tmpHandle, openmode!=IFOread, extraFlags, false);
else if (extraFlags & IFEsyncAtClose)
doSync(tmpHandle, false);
doSync(*this, tmpHandle, false);

if (::close(tmpHandle) < 0)
throw makeErrnoExceptionV(errno, "CFileIO::close for file '%s'", querySafeFilename());
Expand All @@ -2192,7 +2192,7 @@ void CFileIO::flush()

CriticalBlock procedure(cs);

syncFileData(file, true, extraFlags, false);
syncFileData(*this, file, true, extraFlags, false);
}


Expand Down Expand Up @@ -2229,7 +2229,7 @@ size32_t CFileIO::read(offset_t pos, size32_t len, void * data)
if (unflushedReadBytes.add_fetch(ret) >= PGCFLUSH_BLKSIZE)
{
unflushedReadBytes.store(0);
syncFileData(file, false, extraFlags, false);
syncFileData(*this, file, false, extraFlags, false);
}
}
return ret;
Expand Down Expand Up @@ -2259,7 +2259,7 @@ size32_t CFileIO::write(offset_t pos, size32_t len, const void * data)
{
unflushedWriteBytes.store(0);
// request to write-out dirty pages
syncFileData(file, true, extraFlags, true);
syncFileData(*this, file, true, extraFlags, true);
}
}
return ret;
Expand Down
Loading