summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage
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
parent1ccab79c7716b88126384600efcd577d59c040d1 (diff)
downloadmongo-2e975bcf036ed7ff2760a213827c0a02e0cded66.tar.gz
SERVER-27886 Move paths.* into mmap_v1
Diffstat (limited to 'src/mongo/db/storage')
-rw-r--r--src/mongo/db/storage/SConscript13
-rw-r--r--src/mongo/db/storage/mmap_v1/SConscript5
-rw-r--r--src/mongo/db/storage/mmap_v1/dur_journal.cpp2
-rw-r--r--src/mongo/db/storage/mmap_v1/durable_mapped_file.h2
-rw-r--r--src/mongo/db/storage/mmap_v1/durop.h2
-rw-r--r--src/mongo/db/storage/mmap_v1/file_allocator.cpp2
-rw-r--r--src/mongo/db/storage/mmap_v1/journal_latency_test_cmd.cpp2
-rw-r--r--src/mongo/db/storage/mmap_v1/logfile.cpp2
-rw-r--r--src/mongo/db/storage/mmap_v1/paths.cpp (renamed from src/mongo/db/storage/paths.cpp)2
-rw-r--r--src/mongo/db/storage/mmap_v1/paths.h (renamed from src/mongo/db/storage/paths.h)0
-rw-r--r--src/mongo/db/storage/storage_engine_lock_file_posix.cpp44
11 files changed, 51 insertions, 25 deletions
diff --git a/src/mongo/db/storage/SConscript b/src/mongo/db/storage/SConscript
index 0c23b901517..cb8c134d35d 100644
--- a/src/mongo/db/storage/SConscript
+++ b/src/mongo/db/storage/SConscript
@@ -70,16 +70,6 @@ env.Library(
)
env.Library(
- target='paths',
- source=[
- 'paths.cpp',
- ],
- LIBDEPS=[
- '$BUILD_DIR/mongo/base',
- ],
-)
-
-env.Library(
target='storage_options',
source=[
'storage_options.cpp',
@@ -166,9 +156,6 @@ env.Library(
source=[
'storage_engine_lock_file_${TARGET_OS_FAMILY}.cpp',
],
- LIBDEPS=[
- 'paths',
- ]
)
env.Library(
diff --git a/src/mongo/db/storage/mmap_v1/SConscript b/src/mongo/db/storage/mmap_v1/SConscript
index 4fa273fe408..fb427d12e46 100644
--- a/src/mongo/db/storage/mmap_v1/SConscript
+++ b/src/mongo/db/storage/mmap_v1/SConscript
@@ -32,6 +32,7 @@ env.Library(
"mmap_v1_engine.cpp",
"mmap_v1_extent_manager.cpp",
"mmap_v1_init.cpp" if mmapv1 else "mmap_v1_noinit.cpp",
+ "paths.cpp",
"repair_database.cpp",
],
LIBDEPS = [
@@ -49,7 +50,6 @@ env.Library(
'$BUILD_DIR/mongo/db/index_names',
'$BUILD_DIR/mongo/db/index/index_descriptor',
'$BUILD_DIR/mongo/db/storage/journal_listener',
- '$BUILD_DIR/mongo/db/storage/paths',
'$BUILD_DIR/mongo/db/storage/storage_engine_lock_file',
# '$BUILD_DIR/mongo/db/index/index_access_methods', # CYCLE
# '$BUILD_DIR/mongo/db/catalog/catalog', # CYCLE
@@ -69,7 +69,6 @@ compressEnv.Library(
'compress.cpp',
],
LIBDEPS=[
- '$BUILD_DIR/mongo/db/storage/paths',
'$BUILD_DIR/third_party/shim_snappy',
],
)
@@ -91,7 +90,6 @@ env.Library(
'file_allocator.cpp',
],
LIBDEPS=[
- '$BUILD_DIR/mongo/db/storage/paths',
'$BUILD_DIR/mongo/util/fail_point',
'$BUILD_DIR/mongo/util/processinfo',
],
@@ -103,7 +101,6 @@ env.Library(
'logfile.cpp',
],
LIBDEPS=[
- '$BUILD_DIR/mongo/db/storage/paths',
'mmap',
],
)
diff --git a/src/mongo/db/storage/mmap_v1/dur_journal.cpp b/src/mongo/db/storage/mmap_v1/dur_journal.cpp
index e7de8b5967f..73fe4b4a3b2 100644
--- a/src/mongo/db/storage/mmap_v1/dur_journal.cpp
+++ b/src/mongo/db/storage/mmap_v1/dur_journal.cpp
@@ -49,7 +49,7 @@
#include "mongo/db/storage/mmap_v1/logfile.h"
#include "mongo/db/storage/mmap_v1/mmap.h"
#include "mongo/db/storage/mmap_v1/mmap_v1_options.h"
-#include "mongo/db/storage/paths.h"
+#include "mongo/db/storage/mmap_v1/paths.h"
#include "mongo/db/storage/storage_options.h"
#include "mongo/platform/random.h"
#include "mongo/util/checksum.h"
diff --git a/src/mongo/db/storage/mmap_v1/durable_mapped_file.h b/src/mongo/db/storage/mmap_v1/durable_mapped_file.h
index 3175fa8fa73..fb76c5f60b3 100644
--- a/src/mongo/db/storage/mmap_v1/durable_mapped_file.h
+++ b/src/mongo/db/storage/mmap_v1/durable_mapped_file.h
@@ -33,7 +33,7 @@
#include "mongo/base/static_assert.h"
#include "mongo/db/storage/mmap_v1/mmap.h"
-#include "mongo/db/storage/paths.h"
+#include "mongo/db/storage/mmap_v1/paths.h"
#include "mongo/stdx/mutex.h"
namespace mongo {
diff --git a/src/mongo/db/storage/mmap_v1/durop.h b/src/mongo/db/storage/mmap_v1/durop.h
index 98aaf8406c3..17a78ff220d 100644
--- a/src/mongo/db/storage/mmap_v1/durop.h
+++ b/src/mongo/db/storage/mmap_v1/durop.h
@@ -32,7 +32,7 @@
#include "mongo/db/storage/mmap_v1/dur_journalformat.h"
-#include "mongo/db/storage/paths.h"
+#include "mongo/db/storage/mmap_v1/paths.h"
#include "mongo/util/bufreader.h"
namespace mongo {
diff --git a/src/mongo/db/storage/mmap_v1/file_allocator.cpp b/src/mongo/db/storage/mmap_v1/file_allocator.cpp
index 4423a963e72..be1378bd093 100644
--- a/src/mongo/db/storage/mmap_v1/file_allocator.cpp
+++ b/src/mongo/db/storage/mmap_v1/file_allocator.cpp
@@ -50,7 +50,7 @@
#include <io.h>
#endif
-#include "mongo/db/storage/paths.h"
+#include "mongo/db/storage/mmap_v1/paths.h"
#include "mongo/platform/posix_fadvise.h"
#include "mongo/stdx/functional.h"
#include "mongo/stdx/thread.h"
diff --git a/src/mongo/db/storage/mmap_v1/journal_latency_test_cmd.cpp b/src/mongo/db/storage/mmap_v1/journal_latency_test_cmd.cpp
index 94beefc55ae..279abae4a38 100644
--- a/src/mongo/db/storage/mmap_v1/journal_latency_test_cmd.cpp
+++ b/src/mongo/db/storage/mmap_v1/journal_latency_test_cmd.cpp
@@ -46,7 +46,7 @@
#include "mongo/db/query/internal_plans.h"
#include "mongo/db/storage/mmap_v1/aligned_builder.h"
#include "mongo/db/storage/mmap_v1/logfile.h"
-#include "mongo/db/storage/paths.h"
+#include "mongo/db/storage/mmap_v1/paths.h"
#include "mongo/db/storage/storage_options.h"
#include "mongo/scripting/engine.h"
#include "mongo/util/background.h"
diff --git a/src/mongo/db/storage/mmap_v1/logfile.cpp b/src/mongo/db/storage/mmap_v1/logfile.cpp
index acf2db64d74..98cfabc1f75 100644
--- a/src/mongo/db/storage/mmap_v1/logfile.cpp
+++ b/src/mongo/db/storage/mmap_v1/logfile.cpp
@@ -35,7 +35,7 @@
#include "mongo/db/storage/mmap_v1/logfile.h"
#include "mongo/db/storage/mmap_v1/mmap.h"
-#include "mongo/db/storage/paths.h"
+#include "mongo/db/storage/mmap_v1/paths.h"
#include "mongo/platform/posix_fadvise.h"
#include "mongo/util/allocator.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/storage/paths.cpp b/src/mongo/db/storage/mmap_v1/paths.cpp
index b9f05ad17d1..8e17c6cf716 100644
--- a/src/mongo/db/storage/paths.cpp
+++ b/src/mongo/db/storage/mmap_v1/paths.cpp
@@ -29,7 +29,7 @@
#include "mongo/platform/basic.h"
-#include "mongo/db/storage/paths.h"
+#include "mongo/db/storage/mmap_v1/paths.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/storage/paths.h b/src/mongo/db/storage/mmap_v1/paths.h
index 384b6459419..384b6459419 100644
--- a/src/mongo/db/storage/paths.h
+++ b/src/mongo/db/storage/mmap_v1/paths.h
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 {