summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2014-10-30 09:59:57 -0400
committerBenety Goh <benety@mongodb.com>2014-11-03 15:07:06 -0500
commitda18489108f7c94f67533bb52b600ed1efbf6dc9 (patch)
tree1197c3939c144d5bcb68f6248c4e6c5083063dd9
parent1c8267751f86ff74e350dad67cec018f4f9a7851 (diff)
downloadmongo-da18489108f7c94f67533bb52b600ed1efbf6dc9.tar.gz
SERVER-15557 extracted mmapv1 startup options from StorageGlobalParams into MMAPV1Options
-rw-r--r--src/mongo/db/catalog/collection.cpp3
-rw-r--r--src/mongo/db/db.cpp3
-rw-r--r--src/mongo/db/dbeval.cpp2
-rw-r--r--src/mongo/db/mongod_options.cpp31
-rw-r--r--src/mongo/db/storage/mmap_v1/SConscript1
-rw-r--r--src/mongo/db/storage/mmap_v1/catalog/namespace_index.cpp16
-rw-r--r--src/mongo/db/storage/mmap_v1/data_file.cpp13
-rw-r--r--src/mongo/db/storage/mmap_v1/data_file_sync.cpp14
-rw-r--r--src/mongo/db/storage/mmap_v1/dur.cpp11
-rw-r--r--src/mongo/db/storage/mmap_v1/dur_commitjob.cpp1
-rw-r--r--src/mongo/db/storage/mmap_v1/dur_journal.cpp7
-rw-r--r--src/mongo/db/storage/mmap_v1/dur_preplogbuffer.cpp1
-rw-r--r--src/mongo/db/storage/mmap_v1/dur_recover.cpp25
-rw-r--r--src/mongo/db/storage/mmap_v1/durable_mapped_file.cpp1
-rw-r--r--src/mongo/db/storage/mmap_v1/mmap_v1_engine.cpp5
-rw-r--r--src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp3
-rw-r--r--src/mongo/db/storage/mmap_v1/mmap_v1_options.cpp112
-rw-r--r--src/mongo/db/storage/mmap_v1/mmap_v1_options.h110
-rw-r--r--src/mongo/db/storage/mmap_v1/repair_database.cpp11
-rw-r--r--src/mongo/db/storage_options.cpp72
-rw-r--r--src/mongo/db/storage_options.h68
-rw-r--r--src/mongo/dbtests/framework_options.cpp13
-rw-r--r--src/mongo/dbtests/mmaptests.cpp8
-rw-r--r--src/mongo/dbtests/perftests.cpp1
24 files changed, 356 insertions, 176 deletions
diff --git a/src/mongo/db/catalog/collection.cpp b/src/mongo/db/catalog/collection.cpp
index dcb7697dc02..ea883bea70d 100644
--- a/src/mongo/db/catalog/collection.cpp
+++ b/src/mongo/db/catalog/collection.cpp
@@ -45,6 +45,7 @@
#include "mongo/db/index/index_access_method.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/storage/mmap_v1/record_store_v1_capped.h" // XXX-HK/ERH
+#include "mongo/db/storage/mmap_v1/mmap_v1_options.h"
#include "mongo/db/repl/repl_coordinator_global.h"
#include "mongo/db/auth/user_document_parser.h" // XXX-ANDY
@@ -415,7 +416,7 @@ namespace mongo {
if ( !userEnforeQuota )
return false;
- if ( !storageGlobalParams.quota )
+ if ( !mmapv1GlobalOptions.quota )
return false;
if ( _ns.db() == "local" )
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp
index caf5a3e5b18..62de440dc86 100644
--- a/src/mongo/db/db.cpp
+++ b/src/mongo/db/db.cpp
@@ -74,6 +74,7 @@
#include "mongo/db/startup_warnings_mongod.h"
#include "mongo/db/stats/counters.h"
#include "mongo/db/stats/snapshots.h"
+#include "mongo/db/storage/mmap_v1/mmap_v1_options.h"
#include "mongo/db/storage/storage_engine.h"
#include "mongo/db/storage_options.h"
#include "mongo/db/ttl.h"
@@ -472,7 +473,7 @@ namespace mongo {
boost::filesystem::remove_all(storageGlobalParams.dbpath + "/_tmp/");
- if (storageGlobalParams.durOptions & StorageGlobalParams::DurRecoverOnly)
+ if (mmapv1GlobalOptions.journalOptions & MMAPV1Options::JournalRecoverOnly)
return;
if (mongodGlobalParams.scriptingEnabled) {
diff --git a/src/mongo/db/dbeval.cpp b/src/mongo/db/dbeval.cpp
index 40968770412..8047e5ce6a5 100644
--- a/src/mongo/db/dbeval.cpp
+++ b/src/mongo/db/dbeval.cpp
@@ -105,7 +105,7 @@ namespace mongo {
int res;
{
Timer t;
- res = s->invoke(f, &args, 0, storageGlobalParams.quota ? 10 * 60 * 1000 : 0);
+ res = s->invoke(f, &args, 0, 0);
int m = t.millis();
if (m > serverGlobalParams.slowMS) {
log() << "dbeval slow, time: " << dec << m << "ms " << dbName << endl;
diff --git a/src/mongo/db/mongod_options.cpp b/src/mongo/db/mongod_options.cpp
index d3cd8c991a1..26e00fa47ce 100644
--- a/src/mongo/db/mongod_options.cpp
+++ b/src/mongo/db/mongod_options.cpp
@@ -43,6 +43,7 @@
#include "mongo/db/repl/repl_settings.h"
#include "mongo/db/server_options.h"
#include "mongo/db/server_options_helpers.h"
+#include "mongo/db/storage/mmap_v1/mmap_v1_options.h"
#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
#include "mongo/util/net/ssl_options.h"
@@ -912,11 +913,11 @@ namespace mongo {
}
if ( params.count("storage.syncPeriodSecs")) {
- storageGlobalParams.syncdelay = params["storage.syncPeriodSecs"].as<double>();
+ mmapv1GlobalOptions.syncdelay = params["storage.syncPeriodSecs"].as<double>();
}
if (params.count("storage.directoryPerDB")) {
- storageGlobalParams.directoryperdb = params["storage.directoryPerDB"].as<bool>();
+ mmapv1GlobalOptions.directoryperdb = params["storage.directoryPerDB"].as<bool>();
}
if (params.count("cpu")) {
serverGlobalParams.cpu = params["cpu"].as<bool>();
@@ -930,11 +931,11 @@ namespace mongo {
getGlobalAuthorizationManager()->setAuthEnabled(true);
}
if (params.count("storage.quota.enforced")) {
- storageGlobalParams.quota = params["storage.quota.enforced"].as<bool>();
+ mmapv1GlobalOptions.quota = params["storage.quota.enforced"].as<bool>();
}
if (params.count("storage.quota.maxFilesPerDB")) {
- storageGlobalParams.quota = true;
- storageGlobalParams.quotaFiles = params["storage.quota.maxFilesPerDB"].as<int>() - 1;
+ mmapv1GlobalOptions.quota = true;
+ mmapv1GlobalOptions.quotaFiles = params["storage.quota.maxFilesPerDB"].as<int>() - 1;
}
if (params.count("storage.journal.enabled")) {
@@ -945,19 +946,19 @@ namespace mongo {
// don't check if dur is false here as many will just use the default, and will default
// to off on win32. ie no point making life a little more complex by giving an error on
// a dev environment.
- storageGlobalParams.journalCommitInterval =
+ mmapv1GlobalOptions.journalCommitInterval =
params["storage.journal.commitIntervalMs"].as<unsigned>();
- if (storageGlobalParams.journalCommitInterval <= 1 ||
- storageGlobalParams.journalCommitInterval > 300) {
+ if (mmapv1GlobalOptions.journalCommitInterval <= 1 ||
+ mmapv1GlobalOptions.journalCommitInterval > 300) {
return Status(ErrorCodes::BadValue,
"--journalCommitInterval out of allowed range (0-300ms)");
}
}
if (params.count("storage.journal.debugFlags")) {
- storageGlobalParams.durOptions = params["storage.journal.debugFlags"].as<int>();
+ mmapv1GlobalOptions.journalOptions = params["storage.journal.debugFlags"].as<int>();
}
if (params.count("nopreallocj")) {
- storageGlobalParams.preallocj = !params["nopreallocj"].as<bool>();
+ mmapv1GlobalOptions.preallocj = !params["nopreallocj"].as<bool>();
}
if (params.count("net.http.RESTInterfaceEnabled")) {
@@ -970,11 +971,11 @@ namespace mongo {
mongodGlobalParams.scriptingEnabled = params["security.javascriptEnabled"].as<bool>();
}
if (params.count("storage.preallocDataFiles")) {
- storageGlobalParams.prealloc = params["storage.preallocDataFiles"].as<bool>();
+ mmapv1GlobalOptions.prealloc = params["storage.preallocDataFiles"].as<bool>();
cout << "note: noprealloc may hurt performance in many applications" << endl;
}
if (params.count("storage.smallFiles")) {
- storageGlobalParams.smallfiles = params["storage.smallFiles"].as<bool>();
+ mmapv1GlobalOptions.smallfiles = params["storage.smallFiles"].as<bool>();
}
if (params.count("diaglog")) {
warning() << "--diaglog is deprecated and will be removed in a future release"
@@ -1051,8 +1052,8 @@ namespace mongo {
if (x <= 0 || x > (0x7fffffff/1024/1024)) {
return Status(ErrorCodes::BadValue, "bad --nssize arg");
}
- storageGlobalParams.lenForNewNsFiles = x * 1024 * 1024;
- verify(storageGlobalParams.lenForNewNsFiles > 0);
+ mmapv1GlobalOptions.lenForNewNsFiles = x * 1024 * 1024;
+ verify(mmapv1GlobalOptions.lenForNewNsFiles > 0);
}
if (params.count("replication.oplogSizeMB")) {
long long x = params["replication.oplogSizeMB"].as<int>();
@@ -1103,7 +1104,7 @@ namespace mongo {
if (params.count("sharding.clusterRole") &&
params["sharding.clusterRole"].as<std::string>() == "configsvr") {
serverGlobalParams.configsvr = true;
- storageGlobalParams.smallfiles = true; // config server implies small files
+ mmapv1GlobalOptions.smallfiles = true; // config server implies small files
if (replSettings.usingReplSets()
|| replSettings.master
|| replSettings.slave) {
diff --git a/src/mongo/db/storage/mmap_v1/SConscript b/src/mongo/db/storage/mmap_v1/SConscript
index a14c15e01af..01e12836e51 100644
--- a/src/mongo/db/storage/mmap_v1/SConscript
+++ b/src/mongo/db/storage/mmap_v1/SConscript
@@ -24,6 +24,7 @@ env.Library(
"mmap_v1_engine.cpp",
"mmap_v1_extent_manager.cpp",
"mmap_v1_init.cpp",
+ "mmap_v1_options.cpp",
"repair_database.cpp",
],
LIBDEPS = [
diff --git a/src/mongo/db/storage/mmap_v1/catalog/namespace_index.cpp b/src/mongo/db/storage/mmap_v1/catalog/namespace_index.cpp
index f4f0b5fd9fb..14b236c34ac 100644
--- a/src/mongo/db/storage/mmap_v1/catalog/namespace_index.cpp
+++ b/src/mongo/db/storage/mmap_v1/catalog/namespace_index.cpp
@@ -31,12 +31,14 @@
#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kIndexing
#include "mongo/platform/basic.h"
+
#include "mongo/db/storage/mmap_v1/catalog/namespace_index.h"
#include <boost/filesystem/operations.hpp>
#include "mongo/db/operation_context.h"
#include "mongo/db/storage/mmap_v1/catalog/namespace_details.h"
+#include "mongo/db/storage/mmap_v1/mmap_v1_options.h"
#include "mongo/util/exit.h"
#include "mongo/util/file.h"
#include "mongo/util/log.h"
@@ -104,7 +106,7 @@ namespace mongo {
boost::filesystem::path NamespaceIndex::path() const {
boost::filesystem::path ret( _dir );
- if (storageGlobalParams.directoryperdb)
+ if (mmapv1GlobalOptions.directoryperdb)
ret /= _database;
ret /= ( _database + ".ns" );
return ret;
@@ -125,7 +127,7 @@ namespace mongo {
}
void NamespaceIndex::maybeMkdir() const {
- if (!storageGlobalParams.directoryperdb)
+ if (!mmapv1GlobalOptions.directoryperdb)
return;
boost::filesystem::path dir( _dir );
dir /= _database;
@@ -151,11 +153,11 @@ namespace mongo {
}
}
else {
- // use storageGlobalParams.lenForNewNsFiles, we are making a new database
- massert(10343, "bad storageGlobalParams.lenForNewNsFiles",
- storageGlobalParams.lenForNewNsFiles >= 1024*1024);
+ // use mmapv1GlobalOptions.lenForNewNsFiles, we are making a new database
+ massert(10343, "bad mmapv1GlobalOptions.lenForNewNsFiles",
+ mmapv1GlobalOptions.lenForNewNsFiles >= 1024*1024);
maybeMkdir();
- unsigned long long l = storageGlobalParams.lenForNewNsFiles;
+ unsigned long long l = mmapv1GlobalOptions.lenForNewNsFiles;
log() << "allocating new ns file " << pathString << ", filling with zeroes..." << endl;
{
@@ -193,7 +195,7 @@ namespace mongo {
// OperationContext.
getDur().createdFile(pathString, l); // always a new file
len = l;
- verify(len == storageGlobalParams.lenForNewNsFiles);
+ verify(len == mmapv1GlobalOptions.lenForNewNsFiles);
p = _f.getView();
if ( p ) {
diff --git a/src/mongo/db/storage/mmap_v1/data_file.cpp b/src/mongo/db/storage/mmap_v1/data_file.cpp
index d8941c341fe..020bd7a58f1 100644
--- a/src/mongo/db/storage/mmap_v1/data_file.cpp
+++ b/src/mongo/db/storage/mmap_v1/data_file.cpp
@@ -37,6 +37,7 @@
#include <boost/filesystem/operations.hpp>
#include "mongo/db/storage/mmap_v1/dur.h"
+#include "mongo/db/storage/mmap_v1/mmap_v1_options.h"
#include "mongo/db/operation_context.h"
#include "mongo/util/file_allocator.h"
#include "mongo/util/log.h"
@@ -57,7 +58,7 @@ namespace mongo {
if ( sizeof( int* ) == 4 ) {
return 512 * 1024 * 1024;
}
- else if (storageGlobalParams.smallfiles) {
+ else if (mmapv1GlobalOptions.smallfiles) {
return 0x7ff00000 >> 2;
}
else {
@@ -77,7 +78,7 @@ namespace mongo {
size = (64*1024*1024) << fileNo;
else
size = 0x7ff00000;
- if (storageGlobalParams.smallfiles) {
+ if (mmapv1GlobalOptions.smallfiles) {
size = size >> 2;
}
return size;
@@ -96,10 +97,10 @@ namespace mongo {
unsigned long long sz = mmf.length();
verify( sz <= 0x7fffffff );
verify( sz % 4096 == 0 );
- if (sz < 64*1024*1024 && !storageGlobalParams.smallfiles) {
+ if (sz < 64*1024*1024 && !mmapv1GlobalOptions.smallfiles) {
if( sz >= 16*1024*1024 && sz % (1024*1024) == 0 ) {
log() << "info openExisting file size " << sz
- << " but storageGlobalParams.smallfiles=false: "
+ << " but mmapv1GlobalOptions.smallfiles=false: "
<< filename << endl;
}
else {
@@ -128,11 +129,11 @@ namespace mongo {
if ( size > maxSize() )
size = maxSize();
- verify(size >= 64*1024*1024 || storageGlobalParams.smallfiles);
+ verify(size >= 64*1024*1024 || mmapv1GlobalOptions.smallfiles);
verify( size % 4096 == 0 );
if ( preallocateOnly ) {
- if (storageGlobalParams.prealloc) {
+ if (mmapv1GlobalOptions.prealloc) {
FileAllocator::get()->requestAllocation( filename, size );
}
return;
diff --git a/src/mongo/db/storage/mmap_v1/data_file_sync.cpp b/src/mongo/db/storage/mmap_v1/data_file_sync.cpp
index 509ef19fe2f..653c01bfa3a 100644
--- a/src/mongo/db/storage/mmap_v1/data_file_sync.cpp
+++ b/src/mongo/db/storage/mmap_v1/data_file_sync.cpp
@@ -35,6 +35,8 @@
#include "mongo/db/commands/server_status_metric.h"
#include "mongo/db/global_environment_experiment.h"
#include "mongo/db/instance.h"
+#include "mongo/db/storage/mmap_v1/mmap_v1_options.h"
+#include "mongo/db/storage_options.h"
#include "mongo/util/log.h"
#include "mongo/util/mmap.h"
@@ -53,25 +55,25 @@ namespace mongo {
void DataFileSync::run() {
Client::initThread( name().c_str() );
- if (storageGlobalParams.syncdelay == 0) {
+ if (mmapv1GlobalOptions.syncdelay == 0) {
log() << "warning: --syncdelay 0 is not recommended and can have strange performance" << endl;
}
- else if (storageGlobalParams.syncdelay == 1) {
+ else if (mmapv1GlobalOptions.syncdelay == 1) {
log() << "--syncdelay 1" << endl;
}
- else if (storageGlobalParams.syncdelay != 60) {
- LOG(1) << "--syncdelay " << storageGlobalParams.syncdelay << endl;
+ else if (mmapv1GlobalOptions.syncdelay != 60) {
+ LOG(1) << "--syncdelay " << mmapv1GlobalOptions.syncdelay << endl;
}
int time_flushing = 0;
while ( ! inShutdown() ) {
_diaglog.flush();
- if (storageGlobalParams.syncdelay == 0) {
+ if (mmapv1GlobalOptions.syncdelay == 0) {
// in case at some point we add an option to change at runtime
sleepsecs(5);
continue;
}
- sleepmillis((long long) std::max(0.0, (storageGlobalParams.syncdelay * 1000) - time_flushing));
+ sleepmillis((long long) std::max(0.0, (mmapv1GlobalOptions.syncdelay * 1000) - time_flushing));
if ( inShutdown() ) {
// occasional issue trying to flush during shutdown when sleep interrupted
diff --git a/src/mongo/db/storage/mmap_v1/dur.cpp b/src/mongo/db/storage/mmap_v1/dur.cpp
index 835b44d2651..188a001149b 100644
--- a/src/mongo/db/storage/mmap_v1/dur.cpp
+++ b/src/mongo/db/storage/mmap_v1/dur.cpp
@@ -89,6 +89,7 @@
#include "mongo/db/storage/mmap_v1/dur_journal.h"
#include "mongo/db/storage/mmap_v1/dur_recover.h"
#include "mongo/db/storage/mmap_v1/dur_stats.h"
+#include "mongo/db/storage/mmap_v1/mmap_v1_options.h"
#include "mongo/db/storage_options.h"
#include "mongo/server.h"
#include "mongo/util/log.h"
@@ -175,8 +176,8 @@ namespace mongo {
"writeToDataFiles" << (unsigned) (_writeToDataFilesMicros/1000) <<
"remapPrivateView" << (unsigned) (_remapPrivateViewMicros/1000)
);
- if (storageGlobalParams.journalCommitInterval != 0)
- b << "journalCommitIntervalMs" << storageGlobalParams.journalCommitInterval;
+ if (mmapv1GlobalOptions.journalCommitInterval != 0)
+ b << "journalCommitIntervalMs" << mmapv1GlobalOptions.journalCommitInterval;
return b.obj();
}
@@ -372,7 +373,7 @@ namespace mongo {
/** (SLOW) diagnostic to check that the private view and the non-private view are in sync.
*/
void debugValidateAllMapsMatch() {
- if (!(storageGlobalParams.durOptions & StorageGlobalParams::DurParanoid))
+ if (!(mmapv1GlobalOptions.journalOptions & MMAPV1Options::JournalParanoid))
return;
unsigned long long bytes = 0;
@@ -400,7 +401,7 @@ namespace mongo {
// remapping.
unsigned long long now = curTimeMicros64();
double fraction = (now-lastRemap)/2000000.0;
- if (storageGlobalParams.durOptions & StorageGlobalParams::DurAlwaysRemap)
+ if (mmapv1GlobalOptions.journalOptions & MMAPV1Options::JournalAlwaysRemap)
fraction = 1;
lastRemap = now;
@@ -624,7 +625,7 @@ namespace mongo {
}
while (shutdownRequested.loadRelaxed() == 0) {
- unsigned ms = storageGlobalParams.journalCommitInterval;
+ unsigned ms = mmapv1GlobalOptions.journalCommitInterval;
if( ms == 0 ) {
ms = samePartition ? 100 : 30;
}
diff --git a/src/mongo/db/storage/mmap_v1/dur_commitjob.cpp b/src/mongo/db/storage/mmap_v1/dur_commitjob.cpp
index 5a858ff4b21..67caf5bc4f6 100644
--- a/src/mongo/db/storage/mmap_v1/dur_commitjob.cpp
+++ b/src/mongo/db/storage/mmap_v1/dur_commitjob.cpp
@@ -36,6 +36,7 @@
#include "mongo/db/client.h"
#include "mongo/db/storage/mmap_v1/dur_stats.h"
+#include "mongo/db/storage_options.h"
#include "mongo/util/concurrency/threadlocal.h"
#include "mongo/util/log.h"
#include "mongo/util/stacktrace.h"
diff --git a/src/mongo/db/storage/mmap_v1/dur_journal.cpp b/src/mongo/db/storage/mmap_v1/dur_journal.cpp
index 720e8c6c757..4819d2fc1f6 100644
--- a/src/mongo/db/storage/mmap_v1/dur_journal.cpp
+++ b/src/mongo/db/storage/mmap_v1/dur_journal.cpp
@@ -43,6 +43,7 @@
#include "mongo/db/storage/mmap_v1/dur_journalformat.h"
#include "mongo/db/storage/mmap_v1/dur_journalimpl.h"
#include "mongo/db/storage/mmap_v1/dur_stats.h"
+#include "mongo/db/storage/mmap_v1/mmap_v1_options.h"
#include "mongo/db/storage_options.h"
#include "mongo/platform/random.h"
#include "mongo/server.h"
@@ -83,7 +84,7 @@ namespace mongo {
#endif
MONGO_INITIALIZER(InitializeJournalingParams)(InitializerContext* context) {
- if (storageGlobalParams.smallfiles == true) {
+ if (mmapv1GlobalOptions.smallfiles == true) {
verify(dur::DataLimitPerJournalFile >= 128 * 1024 * 1024);
dur::DataLimitPerJournalFile = 128 * 1024 * 1024;
}
@@ -418,12 +419,12 @@ namespace mongo {
}
void preallocateFiles() {
- if (!(storageGlobalParams.durOptions & StorageGlobalParams::DurNoCheckSpace))
+ if (!(mmapv1GlobalOptions.journalOptions & MMAPV1Options::JournalNoCheckSpace))
checkFreeSpace();
if( exists(preallocPath(0)) || // if enabled previously, keep using
exists(preallocPath(1)) ||
- (storageGlobalParams.preallocj && preallocateIsFaster()) ) {
+ (mmapv1GlobalOptions.preallocj && preallocateIsFaster()) ) {
usingPreallocate = true;
try {
_preallocateFiles();
diff --git a/src/mongo/db/storage/mmap_v1/dur_preplogbuffer.cpp b/src/mongo/db/storage/mmap_v1/dur_preplogbuffer.cpp
index 71f9595424d..9323cb601ca 100644
--- a/src/mongo/db/storage/mmap_v1/dur_preplogbuffer.cpp
+++ b/src/mongo/db/storage/mmap_v1/dur_preplogbuffer.cpp
@@ -45,6 +45,7 @@
#include "mongo/db/storage/mmap_v1/dur_journal.h"
#include "mongo/db/storage/mmap_v1/dur_journalimpl.h"
#include "mongo/db/storage/mmap_v1/dur_stats.h"
+#include "mongo/db/storage_options.h"
#include "mongo/server.h"
#include "mongo/util/alignedbuilder.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/storage/mmap_v1/dur_recover.cpp b/src/mongo/db/storage/mmap_v1/dur_recover.cpp
index 30d95e5f070..344335c5a79 100644
--- a/src/mongo/db/storage/mmap_v1/dur_recover.cpp
+++ b/src/mongo/db/storage/mmap_v1/dur_recover.cpp
@@ -52,6 +52,7 @@
#include "mongo/db/storage/mmap_v1/dur_stats.h"
#include "mongo/db/storage/mmap_v1/durop.h"
#include "mongo/db/storage/mmap_v1/durable_mapped_file.h"
+#include "mongo/db/storage/mmap_v1/mmap_v1_options.h"
#include "mongo/db/storage_options.h"
#include "mongo/util/bufreader.h"
#include "mongo/util/checksum.h"
@@ -368,10 +369,10 @@ namespace mongo {
}
void RecoveryJob::applyEntries(const vector<ParsedJournalEntry> &entries) {
- bool apply = (storageGlobalParams.durOptions &
- StorageGlobalParams::DurScanOnly) == 0;
- bool dump = storageGlobalParams.durOptions &
- StorageGlobalParams::DurDumpJournal;
+ bool apply = (mmapv1GlobalOptions.journalOptions &
+ MMAPV1Options::JournalScanOnly) == 0;
+ bool dump = mmapv1GlobalOptions.journalOptions &
+ MMAPV1Options::JournalDumpJournal;
if( dump )
log() << "BEGIN section" << endl;
@@ -474,8 +475,8 @@ namespace mongo {
uasserted(13536, str::stream() << "journal version number mismatch " << h._version);
}
fileId = h.fileId;
- if (storageGlobalParams.durOptions &
- StorageGlobalParams::DurDumpJournal) {
+ if (mmapv1GlobalOptions.journalOptions &
+ MMAPV1Options::JournalDumpJournal) {
log() << "JHeader::fileId=" << fileId << endl;
}
}
@@ -485,8 +486,8 @@ namespace mongo {
JSectHeader h;
br.peek(h);
if( h.fileId != fileId ) {
- if (debug || (storageGlobalParams.durOptions &
- StorageGlobalParams::DurDumpJournal)) {
+ if (debug || (mmapv1GlobalOptions.journalOptions &
+ MMAPV1Options::JournalDumpJournal)) {
log() << "Ending processFileBuffer at differing fileId want:" << fileId << " got:" << h.fileId << endl;
log() << " sect len:" << h.sectionLen() << " seqnum:" << h.seqNumber << endl;
}
@@ -504,12 +505,12 @@ namespace mongo {
}
}
catch (const BufReader::eof&) {
- if (storageGlobalParams.durOptions & StorageGlobalParams::DurDumpJournal)
+ if (mmapv1GlobalOptions.journalOptions & MMAPV1Options::JournalDumpJournal)
log() << "ABRUPT END" << endl;
return true; // abrupt end
}
catch (const JournalSectionCorruptException&) {
- if (storageGlobalParams.durOptions & StorageGlobalParams::DurDumpJournal)
+ if (mmapv1GlobalOptions.journalOptions & MMAPV1Options::JournalDumpJournal)
log() << "ABRUPT END" << endl;
return true; // abrupt end
}
@@ -558,9 +559,9 @@ namespace mongo {
close();
- if (storageGlobalParams.durOptions & StorageGlobalParams::DurScanOnly) {
+ if (mmapv1GlobalOptions.journalOptions & MMAPV1Options::JournalScanOnly) {
uasserted(13545, str::stream() << "--durOptions "
- << (int) StorageGlobalParams::DurScanOnly
+ << (int) MMAPV1Options::JournalScanOnly
<< " (scan only) specified");
}
diff --git a/src/mongo/db/storage/mmap_v1/durable_mapped_file.cpp b/src/mongo/db/storage/mmap_v1/durable_mapped_file.cpp
index 3f23be7188d..b71bf5ab780 100644
--- a/src/mongo/db/storage/mmap_v1/durable_mapped_file.cpp
+++ b/src/mongo/db/storage/mmap_v1/durable_mapped_file.cpp
@@ -43,6 +43,7 @@
#include "mongo/db/storage_options.h"
#include "mongo/db/storage/mmap_v1/dur.h"
#include "mongo/db/storage/mmap_v1/dur_journalformat.h"
+#include "mongo/db/storage_options.h"
#include "mongo/util/mongoutils/str.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/storage/mmap_v1/mmap_v1_engine.cpp b/src/mongo/db/storage/mmap_v1/mmap_v1_engine.cpp
index c4a85dbc46b..863eded12c3 100644
--- a/src/mongo/db/storage/mmap_v1/mmap_v1_engine.cpp
+++ b/src/mongo/db/storage/mmap_v1/mmap_v1_engine.cpp
@@ -50,6 +50,7 @@
#include "mongo/db/storage/mmap_v1/dur_recover.h"
#include "mongo/db/storage/mmap_v1/dur_recovery_unit.h"
#include "mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.h"
+#include "mongo/db/storage/mmap_v1/mmap_v1_options.h"
#include "mongo/db/storage_options.h"
#include "mongo/platform/process_id.h"
#include "mongo/util/file_allocator.h"
@@ -329,7 +330,7 @@ namespace {
entry = new MMAPV1DatabaseCatalogEntry( opCtx,
db,
storageGlobalParams.dbpath,
- storageGlobalParams.directoryperdb,
+ mmapv1GlobalOptions.directoryperdb,
false );
}
return entry;
@@ -364,7 +365,7 @@ namespace {
for ( boost::filesystem::directory_iterator i( path );
i != boost::filesystem::directory_iterator();
++i ) {
- if (storageGlobalParams.directoryperdb) {
+ if (mmapv1GlobalOptions.directoryperdb) {
boost::filesystem::path p = *i;
string dbName = p.leaf().string();
p /= ( dbName + ".ns" );
diff --git a/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp b/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp
index 8e7954696be..3ab402f8ec4 100644
--- a/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp
+++ b/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp
@@ -41,6 +41,7 @@
#include "mongo/db/storage/mmap_v1/record.h"
#include "mongo/db/storage/mmap_v1/extent.h"
#include "mongo/db/storage/mmap_v1/extent_manager.h"
+#include "mongo/db/storage/mmap_v1/mmap_v1_options.h"
#include "mongo/db/operation_context.h"
#include "mongo/util/file.h"
#include "mongo/util/log.h"
@@ -244,7 +245,7 @@ namespace mongo {
if ( !enforceQuota )
return;
- if ( fileNo < storageGlobalParams.quotaFiles )
+ if ( fileNo < mmapv1GlobalOptions.quotaFiles )
return;
// exceeded!
diff --git a/src/mongo/db/storage/mmap_v1/mmap_v1_options.cpp b/src/mongo/db/storage/mmap_v1/mmap_v1_options.cpp
new file mode 100644
index 00000000000..a1035dbc7ed
--- /dev/null
+++ b/src/mongo/db/storage/mmap_v1/mmap_v1_options.cpp
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2014 MongoDB Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the GNU Affero General Public License in all respects for
+ * all of the code used other than as permitted herein. If you modify file(s)
+ * with this exception, you may extend this exception to your version of the
+ * file(s), but you are not obligated to do so. If you do not wish to do so,
+ * delete this exception statement from your version. If you delete this
+ * exception statement from all source files in the program, then also delete
+ * it in the license file.
+ */
+
+#include "mongo/platform/basic.h"
+
+#include "mongo/db/storage/mmap_v1/mmap_v1_options.h"
+
+#include "mongo/bson/util/builder.h"
+#include "mongo/db/server_parameters.h"
+
+namespace mongo {
+
+ MMAPV1Options mmapv1GlobalOptions;
+
+ /**
+ * Specify an integer between 1 and 500 signifying the number of milliseconds (ms)
+ * between journal commits.
+ */
+ class JournalCommitIntervalSetting : public ServerParameter {
+ public:
+ JournalCommitIntervalSetting() :
+ ServerParameter(ServerParameterSet::getGlobal(), "journalCommitInterval",
+ false, // allowedToChangeAtStartup
+ true // allowedToChangeAtRuntime
+ ) {}
+
+ virtual void append(OperationContext* txn, BSONObjBuilder& b, const std::string& name) {
+ b << name << mmapv1GlobalOptions.journalCommitInterval;
+ }
+
+ virtual Status set(const BSONElement& newValueElement) {
+ long long newValue;
+ if (!newValueElement.isNumber()) {
+ StringBuilder sb;
+ sb << "Expected number type for journalCommitInterval via setParameter command: "
+ << newValueElement;
+ return Status(ErrorCodes::BadValue, sb.str());
+ }
+ if (newValueElement.type() == NumberDouble &&
+ (newValueElement.numberDouble() - newValueElement.numberLong()) > 0) {
+ StringBuilder sb;
+ sb << "journalCommitInterval must be a whole number: "
+ << newValueElement;
+ return Status(ErrorCodes::BadValue, sb.str());
+ }
+ newValue = newValueElement.numberLong();
+ if (newValue <= 1 || newValue >= 500) {
+ StringBuilder sb;
+ sb << "journalCommitInterval must be between 1 and 500, but attempted to set to: "
+ << newValue;
+ return Status(ErrorCodes::BadValue, sb.str());
+ }
+ mmapv1GlobalOptions.journalCommitInterval = static_cast<unsigned>(newValue);
+ return Status::OK();
+ }
+
+ virtual Status setFromString(const std::string& str) {
+ unsigned newValue;
+ Status status = parseNumberFromString(str, &newValue);
+ if (!status.isOK()) {
+ return status;
+ }
+ if (newValue <= 1 || newValue >= 500) {
+ StringBuilder sb;
+ sb << "journalCommitInterval must be between 1 and 500, but attempted to set to: "
+ << newValue;
+ return Status(ErrorCodes::BadValue, sb.str());
+ }
+ mmapv1GlobalOptions.journalCommitInterval = newValue;
+ return Status::OK();
+ }
+ } journalCommitIntervalSetting;
+
+
+
+ /**
+ * Specify the interval in seconds between fsync operations where mongod flushes its
+ * working memory to disk. By default, mongod flushes memory to disk every 60 seconds.
+ * In almost every situation you should not set this value and use the default setting.
+ */
+ ExportedServerParameter<double> SyncdelaySetting(ServerParameterSet::getGlobal(),
+ "syncdelay",
+ &mmapv1GlobalOptions.syncdelay,
+ true,
+ true);
+
+} // namespace mongo
diff --git a/src/mongo/db/storage/mmap_v1/mmap_v1_options.h b/src/mongo/db/storage/mmap_v1/mmap_v1_options.h
new file mode 100644
index 00000000000..1cf88b9122e
--- /dev/null
+++ b/src/mongo/db/storage/mmap_v1/mmap_v1_options.h
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2014 MongoDB Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the GNU Affero General Public License in all respects for
+ * all of the code used other than as permitted herein. If you modify file(s)
+ * with this exception, you may extend this exception to your version of the
+ * file(s), but you are not obligated to do so. If you do not wish to do so,
+ * delete this exception statement from your version. If you delete this
+ * exception statement from all source files in the program, then also delete
+ * it in the license file.
+ */
+
+#pragma once
+
+#include <string>
+
+/*
+ * This file defines the storage for options that come from the command line related to the
+ * mmap v1 storage engine.
+ */
+
+namespace mongo {
+
+ struct MMAPV1Options {
+
+ MMAPV1Options() :
+ directoryperdb(false),
+ lenForNewNsFiles(16 * 1024 * 1024),
+ preallocj(true),
+ prealloc(false),
+ journalCommitInterval(0), // 0 means use default
+ quota(false), quotaFiles(8),
+ syncdelay(60) { }
+
+ // --directoryperdb
+ // Stores each database’s files in its own folder in the data directory.
+ // When applied to an existing system, the directoryPerDB option alters
+ // the storage pattern of the data directory.
+ bool directoryperdb;
+
+ // --nssize
+ // Specifies the default size for namespace files, which are files that end in .ns.
+ // Each collection and index counts as a namespace.
+ unsigned lenForNewNsFiles;
+
+ bool preallocj; // --nopreallocj no preallocation of journal files
+ bool prealloc; // --noprealloc no preallocation of data files
+ bool smallfiles; // --smallfiles allocate smaller data files
+
+ // --journalCommitInterval
+ // The maximum amount of time the mongod process allows between journal operations.
+ // Values can range from 2 to 300 milliseconds. Lower values increase the durability
+ // of the journal, at the expense of disk performance.
+ unsigned journalCommitInterval; // group/batch commit interval ms
+
+ // --journalOptions 7 dump journal and terminate without doing anything further
+ // --journalOptions 4 recover and terminate without listening
+ enum { // bits to be ORed
+ JournalDumpJournal = 1, // dump diagnostics on the journal during recovery
+ JournalScanOnly = 2, // don't do any real work, just scan and dump if dump
+ // specified
+ JournalRecoverOnly = 4, // terminate after recovery step
+ JournalParanoid = 8, // paranoid mode enables extra checks
+ JournalAlwaysCommit = 16, // do a group commit every time the writelock is released
+ JournalAlwaysRemap = 32, // remap the private view after every group commit
+ // (may lag to the next write lock acquisition,
+ // but will do all files then)
+ JournalNoCheckSpace = 64 // don't check that there is enough room for journal files
+ // before startup (for diskfull tests)
+ };
+ int journalOptions; // --journalOptions <n> for debugging
+
+ // --quota
+ // Enables a maximum limit for the number data files each database can have.
+ // When running with the --quota option, MongoDB has a maximum of 8 data files
+ // per database. Adjust the quota with --quotaFiles.
+ bool quota;
+
+ // --quotaFiles
+ // Modifies the limit on the number of data files per database.
+ // --quotaFiles option requires that you set --quota.
+ int quotaFiles; // --quotaFiles
+
+ // --syncdelay
+ // Controls how much time can pass before MongoDB flushes data to the data files
+ // via an fsync operation.
+ // Do not set this value on production systems.
+ // In almost every situation, you should use the default setting.
+ double syncdelay; // seconds between fsyncs
+ };
+
+ extern MMAPV1Options mmapv1GlobalOptions;
+
+} // namespace mongo
diff --git a/src/mongo/db/storage/mmap_v1/repair_database.cpp b/src/mongo/db/storage/mmap_v1/repair_database.cpp
index 7779744ff53..5d0bcd41d8f 100644
--- a/src/mongo/db/storage/mmap_v1/repair_database.cpp
+++ b/src/mongo/db/storage/mmap_v1/repair_database.cpp
@@ -45,6 +45,7 @@
#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.h"
#include "mongo/db/storage/mmap_v1/dur.h"
+#include "mongo/db/storage/mmap_v1/mmap_v1_options.h"
#include "mongo/util/file.h"
#include "mongo/util/file_allocator.h"
#include "mongo/util/log.h"
@@ -69,7 +70,7 @@ namespace mongo {
const string& path = storageGlobalParams.dbpath);
void _deleteDataFiles(const std::string& database) {
- if (storageGlobalParams.directoryperdb) {
+ if (mmapv1GlobalOptions.directoryperdb) {
FileAllocator::get()->waitUntilFinished();
MONGO_ASSERT_ON_EXCEPTION_WITH_MSG(
boost::filesystem::remove_all(
@@ -102,7 +103,7 @@ namespace mongo {
// back up original database files to 'temp' dir
void _renameForBackup( const std::string& database, const Path &reservedPath ) {
Path newPath( reservedPath );
- if (storageGlobalParams.directoryperdb)
+ if (mmapv1GlobalOptions.directoryperdb)
newPath /= database;
class Renamer : public FileOp {
public:
@@ -149,7 +150,7 @@ namespace mongo {
// move temp files to standard data dir
void _replaceWithRecovered( const string& database, const char *reservedPathString ) {
Path newPath(storageGlobalParams.dbpath);
- if (storageGlobalParams.directoryperdb)
+ if (mmapv1GlobalOptions.directoryperdb)
newPath /= database;
class Replacer : public FileOp {
public:
@@ -191,7 +192,7 @@ namespace mongo {
string c = database;
c += '.';
boost::filesystem::path p(path);
- if (storageGlobalParams.directoryperdb)
+ if (mmapv1GlobalOptions.directoryperdb)
p /= database;
boost::filesystem::path q;
q = p / (c+"ns");
@@ -324,7 +325,7 @@ namespace mongo {
dbEntry.reset(new MMAPV1DatabaseCatalogEntry(txn,
dbName,
reservedPathString,
- storageGlobalParams.directoryperdb,
+ mmapv1GlobalOptions.directoryperdb,
true));
invariant(!dbEntry->exists());
tempDatabase.reset( new Database(dbName, dbEntry.get()));
diff --git a/src/mongo/db/storage_options.cpp b/src/mongo/db/storage_options.cpp
index 216fadbf2e8..0b9f0f72d77 100644
--- a/src/mongo/db/storage_options.cpp
+++ b/src/mongo/db/storage_options.cpp
@@ -26,15 +26,19 @@
* it in the license file.
*/
+#include "mongo/platform/basic.h"
+
#include "mongo/db/storage_options.h"
-#include "mongo/bson/util/builder.h"
#include "mongo/db/server_parameters.h"
namespace mongo {
StorageGlobalParams storageGlobalParams;
+ /**
+ * The directory where the mongod instance stores its data.
+ */
#ifdef _WIN32
const char* StorageGlobalParams::kDefaultDbPath = "\\data\\db\\";
const char* StorageGlobalParams::kDefaultConfigDbPath = "\\data\\configdb\\";
@@ -43,71 +47,15 @@ namespace mongo {
const char* StorageGlobalParams::kDefaultConfigDbPath = "/data/configdb";
#endif
- class JournalCommitIntervalSetting : public ServerParameter {
- public:
- JournalCommitIntervalSetting() :
- ServerParameter(ServerParameterSet::getGlobal(), "journalCommitInterval",
- false, // allowedToChangeAtStartup
- true // allowedToChangeAtRuntime
- ) {}
-
- virtual void append(OperationContext* txn, BSONObjBuilder& b, const std::string& name) {
- b << name << storageGlobalParams.journalCommitInterval;
- }
-
- virtual Status set(const BSONElement& newValueElement) {
- long long newValue;
- if (!newValueElement.isNumber()) {
- StringBuilder sb;
- sb << "Expected number type for journalCommitInterval via setParameter command: "
- << newValueElement;
- return Status(ErrorCodes::BadValue, sb.str());
- }
- if (newValueElement.type() == NumberDouble &&
- (newValueElement.numberDouble() - newValueElement.numberLong()) > 0) {
- StringBuilder sb;
- sb << "journalCommitInterval must be a whole number: "
- << newValueElement;
- return Status(ErrorCodes::BadValue, sb.str());
- }
- newValue = newValueElement.numberLong();
- if (newValue <= 1 || newValue >= 500) {
- StringBuilder sb;
- sb << "journalCommitInterval must be between 1 and 500, but attempted to set to: "
- << newValue;
- return Status(ErrorCodes::BadValue, sb.str());
- }
- storageGlobalParams.journalCommitInterval = static_cast<unsigned>(newValue);
- return Status::OK();
- }
-
- virtual Status setFromString(const std::string& str) {
- unsigned newValue;
- Status status = parseNumberFromString(str, &newValue);
- if (!status.isOK()) {
- return status;
- }
- if (newValue <= 1 || newValue >= 500) {
- StringBuilder sb;
- sb << "journalCommitInterval must be between 1 and 500, but attempted to set to: "
- << newValue;
- return Status(ErrorCodes::BadValue, sb.str());
- }
- storageGlobalParams.journalCommitInterval = newValue;
- return Status::OK();
- }
- } journalCommitIntervalSetting;
-
+ /**
+ * Specify whether all queries must use indexes.
+ * If 1, MongoDB will not execute queries that require a table scan and will return an error.
+ * NOT recommended for production use.
+ */
ExportedServerParameter<bool> NoTableScanSetting(ServerParameterSet::getGlobal(),
"notablescan",
&storageGlobalParams.noTableScan,
true,
true);
- ExportedServerParameter<double> SyncdelaySetting(ServerParameterSet::getGlobal(),
- "syncdelay",
- &storageGlobalParams.syncdelay,
- true,
- true);
-
} // namespace mongo
diff --git a/src/mongo/db/storage_options.h b/src/mongo/db/storage_options.h
index 8fcdba412d4..4107eab34ee 100644
--- a/src/mongo/db/storage_options.h
+++ b/src/mongo/db/storage_options.h
@@ -41,19 +41,18 @@ namespace mongo {
struct StorageGlobalParams {
+ // Default data directory for mongod when running in non-config server mode.
+ static const char* kDefaultDbPath;
+
+ // Default data directory for mongod when running as the config database of
+ // a sharded cluster.
+ static const char* kDefaultConfigDbPath;
+
StorageGlobalParams() :
engine("mmapv1"),
dbpath(kDefaultDbPath),
- directoryperdb(false),
upgrade(false),
- repair(false),
- lenForNewNsFiles(16 * 1024 * 1024),
- preallocj(true),
- journalCommitInterval(0), // 0 means use default
- quota(false), quotaFiles(8),
- syncdelay(60)
- {
- repairpath = dbpath;
+ repair(false) {
dur = false;
#if defined(_DURABLEDEFAULTON)
dur = true;
@@ -65,45 +64,34 @@ namespace mongo {
#endif
}
+ // --storageEngine
+ // storage engine for this instance of mongod.
std::string engine;
+
+ // The directory where the mongod instance stores its data.
std::string dbpath;
- static const char* kDefaultDbPath;
- static const char* kDefaultConfigDbPath;
- bool directoryperdb;
+ // --upgrade
+ // Upgrades the on-disk data format of the files specified by the --dbpath to the
+ // latest version, if needed.
bool upgrade;
+
+ // --repair
+ // Runs a repair routine on all databases. This is equivalent to shutting down and
+ // running the repairDatabase database command on all databases.
bool repair;
- std::string repairpath;
- unsigned lenForNewNsFiles;
- bool preallocj; // --nopreallocj no preallocation of journal files
- bool prealloc; // --noprealloc no preallocation of data files
- bool smallfiles; // --smallfiles allocate smaller data files
- bool noTableScan; // --notablescan no table scans allowed
+ // --repairpath
+ // Specifies the root directory containing MongoDB data files to use for the --repair
+ // operation.
+ // Default: A _tmp directory within the path specified by the dbPath option.
+ std::string repairpath;
bool dur; // --dur durability (now --journal)
- unsigned journalCommitInterval; // group/batch commit interval ms
-
- /** --durOptions 7 dump journal and terminate without doing anything further
- --durOptions 4 recover and terminate without listening
- */
- enum { // bits to be ORed
- DurDumpJournal = 1, // dump diagnostics on the journal during recovery
- DurScanOnly = 2, // don't do any real work, just scan and dump if dump specified
- DurRecoverOnly = 4, // terminate after recovery step
- DurParanoid = 8, // paranoid mode enables extra checks
- DurAlwaysCommit = 16, // do a group commit every time the writelock is released
- DurAlwaysRemap = 32, // remap the private view after every group commit (may lag to the
- // next write lock acquisition, but will do all files then)
- DurNoCheckSpace = 64 // don't check that there is enough room for journal files before
- // startup (for diskfull tests)
- };
- int durOptions; // --durOptions <n> for debugging
-
- bool quota; // --quota
- int quotaFiles; // --quotaFiles
-
- double syncdelay; // seconds between fsyncs
+
+ // --notablescan
+ // no table scans allowed
+ bool noTableScan;
};
extern StorageGlobalParams storageGlobalParams;
diff --git a/src/mongo/dbtests/framework_options.cpp b/src/mongo/dbtests/framework_options.cpp
index 5f2f2c46170..8e44ca87a47 100644
--- a/src/mongo/dbtests/framework_options.cpp
+++ b/src/mongo/dbtests/framework_options.cpp
@@ -35,6 +35,7 @@
#include "mongo/base/status.h"
#include "mongo/bson/util/builder.h"
#include "mongo/db/query/new_find.h"
+#include "mongo/db/storage/mmap_v1/mmap_v1_options.h"
#include "mongo/db/storage_options.h"
#include "mongo/dbtests/dbtests.h"
#include "mongo/unittest/unittest.h"
@@ -151,7 +152,7 @@ namespace mongo {
}
if( params.count("nopreallocj") ) {
- storageGlobalParams.preallocj = false;
+ mmapv1GlobalOptions.preallocj = false;
}
if (params.count("debug") || params.count("verbose") ) {
@@ -188,10 +189,10 @@ namespace mongo {
string dbpathString = p.string();
storageGlobalParams.dbpath = dbpathString.c_str();
- storageGlobalParams.prealloc = false;
+ mmapv1GlobalOptions.prealloc = false;
// dbtest defaults to smallfiles
- storageGlobalParams.smallfiles = true;
+ mmapv1GlobalOptions.smallfiles = true;
if( params.count("bigfiles") ) {
storageGlobalParams.dur = true;
}
@@ -223,10 +224,10 @@ namespace mongo {
}
if (debug && storageGlobalParams.dur) {
- log() << "_DEBUG: automatically enabling storageGlobalParams.durOptions=8 "
- << "(DurParanoid)" << endl;
+ log() << "_DEBUG: automatically enabling mmapv1GlobalOptions.journalOptions=8 "
+ << "(JournalParanoid)" << endl;
// this was commented out. why too slow or something?
- storageGlobalParams.durOptions |= 8;
+ mmapv1GlobalOptions.journalOptions |= MMAPV1Options::JournalParanoid;
}
return Status::OK();
diff --git a/src/mongo/dbtests/mmaptests.cpp b/src/mongo/dbtests/mmaptests.cpp
index 29cb81718fe..ad232c72340 100644
--- a/src/mongo/dbtests/mmaptests.cpp
+++ b/src/mongo/dbtests/mmaptests.cpp
@@ -39,6 +39,8 @@
#include "mongo/db/storage/mmap_v1/extent.h"
#include "mongo/db/storage/mmap_v1/extent_manager.h"
#include "mongo/db/storage/mmap_v1/mmap_v1_extent_manager.h"
+#include "mongo/db/storage/mmap_v1/mmap_v1_options.h"
+#include "mongo/db/storage_options.h"
#include "mongo/dbtests/dbtests.h"
#include "mongo/util/timer.h"
@@ -50,12 +52,12 @@ namespace MMapTests {
public:
LeakTest() :
fn((boost::filesystem::path(storageGlobalParams.dbpath) / "testfile.map").string()),
- optOld(storageGlobalParams.durOptions)
+ optOld(mmapv1GlobalOptions.journalOptions)
{
- storageGlobalParams.durOptions = 0; // DurParanoid doesn't make sense with this test
+ mmapv1GlobalOptions.journalOptions = 0; // DurParanoid doesn't make sense with this test
}
~LeakTest() {
- storageGlobalParams.durOptions = optOld;
+ mmapv1GlobalOptions.journalOptions = optOld;
try { boost::filesystem::remove(fn); }
catch(...) { }
}
diff --git a/src/mongo/dbtests/perftests.cpp b/src/mongo/dbtests/perftests.cpp
index a4ab1e20586..9f80f0ffc29 100644
--- a/src/mongo/dbtests/perftests.cpp
+++ b/src/mongo/dbtests/perftests.cpp
@@ -51,6 +51,7 @@
#include "mongo/db/storage/mmap_v1/durable_mapped_file.h"
#include "mongo/db/storage/mmap_v1/dur_stats.h"
#include "mongo/db/storage/mmap_v1/btree/key.h"
+#include "mongo/db/storage_options.h"
#include "mongo/dbtests/dbtests.h"
#include "mongo/dbtests/framework_options.h"
#include "mongo/util/allocator.h"