2
* Copyright (C) 2013 10gen Inc.
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU Affero General Public License, version 3,
6
* as published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Affero General Public License for more details.
13
* You should have received a copy of the GNU Affero General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* As a special exception, the copyright holders give permission to link the
17
* code of portions of this program with the OpenSSL library under certain
18
* conditions as described in each individual source file and distribute
19
* linked combinations including the program with the OpenSSL library. You
20
* must comply with the GNU Affero General Public License in all respects for
21
* all of the code used other than as permitted herein. If you modify file(s)
22
* with this exception, you may extend this exception to your version of the
23
* file(s), but you are not obligated to do so. If you do not wish to do so,
24
* delete this exception statement from your version. If you delete this
25
* exception statement from all source files in the program, then also delete
26
* it in the license file.
34
* This file defines the storage for options that come from the command line related to data file
35
* persistence. Many executables that can access data files directly such as mongod and certain
36
* tools use these variables, but each executable may have a different set of command line flags
37
* that allow the user to change a different subset of these options.
42
struct StorageGlobalParams {
44
StorageGlobalParams() :
46
dbpath("\\data\\db\\"),
50
directoryperdb(false),
51
lenForNewNsFiles(16 * 1024 * 1024),
53
journalCommitInterval(0), // 0 means use default
54
quota(false), quotaFiles(8),
60
#if defined(_DURABLEDEFAULTON)
63
if (sizeof(void*) == 8)
65
#if defined(_DURABLEDEFAULTOFF)
72
std::string repairpath;
73
unsigned lenForNewNsFiles;
75
bool preallocj; // --nopreallocj no preallocation of journal files
76
bool prealloc; // --noprealloc no preallocation of data files
77
bool smallfiles; // --smallfiles allocate smaller data files
78
bool noTableScan; // --notablescan no table scans allowed
80
bool dur; // --dur durability (now --journal)
81
unsigned journalCommitInterval; // group/batch commit interval ms
83
/** --durOptions 7 dump journal and terminate without doing anything further
84
--durOptions 4 recover and terminate without listening
86
enum { // bits to be ORed
87
DurDumpJournal = 1, // dump diagnostics on the journal during recovery
88
DurScanOnly = 2, // don't do any real work, just scan and dump if dump specified
89
DurRecoverOnly = 4, // terminate after recovery step
90
DurParanoid = 8, // paranoid mode enables extra checks
91
DurAlwaysCommit = 16, // do a group commit every time the writelock is released
92
DurAlwaysRemap = 32, // remap the private view after every group commit (may lag to the
93
// next write lock acquisition, but will do all files then)
94
DurNoCheckSpace = 64 // don't check that there is enough room for journal files before
95
// startup (for diskfull tests)
97
int durOptions; // --durOptions <n> for debugging
99
bool quota; // --quota
100
int quotaFiles; // --quotaFiles
102
double syncdelay; // seconds between fsyncs
104
bool useHints; // only off if --nohints
107
extern StorageGlobalParams storageGlobalParams;
109
bool isJournalingEnabled();
110
void setJournalCommitInterval(unsigned newValue);
111
unsigned getJournalCommitInterval();
113
// This is not really related to persistence, but mongos and the other executables share code
114
// and we use this function to determine at runtime which executable we are in.