From 54a8ee112ada702549294ca1fee7d96d848326ea Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Wed, 12 May 2021 12:41:18 +0000 Subject: Sync is not a mandatory operation. Assuming the fs that fails sync are safe anyway. So let us just log a warning for now. --- vespalib/src/vespa/vespalib/io/fileutil.cpp | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) (limited to 'vespalib') diff --git a/vespalib/src/vespa/vespalib/io/fileutil.cpp b/vespalib/src/vespa/vespalib/io/fileutil.cpp index 17ca6d7e488..d1fbd965617 100644 --- a/vespalib/src/vespa/vespalib/io/fileutil.cpp +++ b/vespalib/src/vespa/vespalib/io/fileutil.cpp @@ -398,18 +398,13 @@ File::sync() { if (_fd != -1) { if (::fsync(_fd) == 0) { - LOG(debug, "sync(%s): File synchronized with disk.", - _filename.c_str()); + LOG(debug, "sync(%s): File synchronized with disk.",_filename.c_str()); } else { - asciistream ost; - ost << "sync(" << _filename << "): Failed, errno(" << errno << "): " - << safeStrerror(errno); - throw IoException(ost.str(), IoException::getErrorType(errno), - VESPA_STRLOC); + LOG(warning, "fsync(%s): Failed to sync file. errno(%d): %s", + _filename.c_str(), errno, safeStrerror(errno).c_str()); } } else { - LOG(debug, "sync(%s): Called on closed file.", - _filename.c_str()); + LOG(debug, "sync(%s): Called on closed file.", _filename.c_str()); } } @@ -427,8 +422,7 @@ File::close() { if (_fd != -1) { if (::close(_fd) == 0) { - LOG(debug, "close(%s): Closed file with descriptor %i.", - _filename.c_str(), _fd); + LOG(debug, "close(%s): Closed file with descriptor %i.", _filename.c_str(), _fd); _fd = -1; return true; } else { @@ -438,8 +432,7 @@ File::close() return false; } } else { - LOG(debug, "close(%s): Called on closed file.", - _filename.c_str()); + LOG(debug, "close(%s): Called on closed file.", _filename.c_str()); } return true; } @@ -459,10 +452,8 @@ getCurrentDirectory() return string(static_cast(ptr.get())); } asciistream ost; - ost << "getCurrentDirectory(): Failed, errno(" << errno - << "): " << safeStrerror(errno); - throw IoException(ost.str(), IoException::getErrorType(errno), - VESPA_STRLOC); + ost << "getCurrentDirectory(): Failed, errno(" << errno << "): " << safeStrerror(errno); + throw IoException(ost.str(), IoException::getErrorType(errno), VESPA_STRLOC); } bool -- cgit v1.2.3