summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage/storage_engine_lock_file_posix.cpp
diff options
context:
space:
mode:
authorMaria van Keulen <maria@mongodb.com>2017-02-24 16:51:13 -0500
committerMaria van Keulen <maria@mongodb.com>2017-03-01 13:46:33 -0500
commit2e975bcf036ed7ff2760a213827c0a02e0cded66 (patch)
tree0f4f59137cb20b2b82639a4f1250d815c7aa882a /src/mongo/db/storage/storage_engine_lock_file_posix.cpp
parent1ccab79c7716b88126384600efcd577d59c040d1 (diff)
downloadmongo-2e975bcf036ed7ff2760a213827c0a02e0cded66.tar.gz
SERVER-27886 Move paths.* into mmap_v1
Diffstat (limited to 'src/mongo/db/storage/storage_engine_lock_file_posix.cpp')
-rw-r--r--src/mongo/db/storage/storage_engine_lock_file_posix.cpp44
1 files changed, 43 insertions, 1 deletions
diff --git a/src/mongo/db/storage/storage_engine_lock_file_posix.cpp b/src/mongo/db/storage/storage_engine_lock_file_posix.cpp
index ab5f12484ca..a52480e20bf 100644
--- a/src/mongo/db/storage/storage_engine_lock_file_posix.cpp
+++ b/src/mongo/db/storage/storage_engine_lock_file_posix.cpp
@@ -41,7 +41,6 @@
#include <sys/types.h>
#include <unistd.h>
-#include "mongo/db/storage/paths.h"
#include "mongo/platform/process_id.h"
#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
@@ -51,7 +50,50 @@ namespace mongo {
namespace {
const std::string kLockFileBasename = "mongod.lock";
+void flushMyDirectory(const boost::filesystem::path& file) {
+#ifdef __linux__ // this isn't needed elsewhere
+ static bool _warnedAboutFilesystem = false;
+ // if called without a fully qualified path it asserts; that makes mongoperf fail.
+ // so make a warning. need a better solution longer term.
+ // massert(40386, str::stream() << "Couldn't find parent dir for file: " << file.string(),);
+ if (!file.has_branch_path()) {
+ log() << "warning flushMyDirectory couldn't find parent dir for file: " << file.string();
+ return;
+ }
+
+
+ boost::filesystem::path dir = file.branch_path(); // parent_path in new boosts
+ LOG(1) << "flushing directory " << dir.string();
+
+ int fd = ::open(dir.string().c_str(), O_RDONLY); // DO NOT THROW OR ASSERT BEFORE CLOSING
+ massert(40384,
+ str::stream() << "Couldn't open directory '" << dir.string() << "' for flushing: "
+ << errnoWithDescription(),
+ fd >= 0);
+ if (fsync(fd) != 0) {
+ int e = errno;
+ if (e == EINVAL) { // indicates filesystem does not support synchronization
+ if (!_warnedAboutFilesystem) {
+ log() << "\tWARNING: This file system is not supported. For further information"
+ << " see:" << startupWarningsLog;
+ log() << "\t\t\thttp://dochub.mongodb.org/core/unsupported-filesystems"
+ << startupWarningsLog;
+ log() << "\t\tPlease notify MongoDB, Inc. if an unlisted filesystem generated "
+ << "this warning." << startupWarningsLog;
+ _warnedAboutFilesystem = true;
+ }
+ } else {
+ close(fd);
+ massert(40385,
+ str::stream() << "Couldn't fsync directory '" << dir.string() << "': "
+ << errnoWithDescription(e),
+ false);
+ }
+ }
+ close(fd);
+#endif
+}
} // namespace
class StorageEngineLockFile::LockFileHandle {