summaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-05-12 12:41:18 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2021-05-12 12:50:28 +0000
commit54a8ee112ada702549294ca1fee7d96d848326ea (patch)
treebc1026f4dcec237e2b5c7e6d1b02ce1bf26ccc05 /vespalib
parent3c1a966604bfeb5315c056c993a736797482aaca (diff)
Sync is not a mandatory operation. Assuming the fs that fails sync are safe anyway.
So let us just log a warning for now.
Diffstat (limited to 'vespalib')
-rw-r--r--vespalib/src/vespa/vespalib/io/fileutil.cpp25
1 files changed, 8 insertions, 17 deletions
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<char*>(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