~ubuntu-branches/ubuntu/utopic/mongodb/utopic

« back to all changes in this revision

Viewing changes to src/mongo/db/storage_options.h

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-07-03 09:23:46 UTC
  • mfrom: (1.3.10) (44.1.14 sid)
  • Revision ID: package-import@ubuntu.com-20140703092346-c5bvt46wnzougyly
Tags: 1:2.6.3-0ubuntu1
* New upstream stable release:
  - Dropped patches, included upstream:
    + 0003-All-platforms-but-Windows-find-hash-in-std-tr1.patch
    + 0008-Use-system-libstemmer.patch
    + 0011-Use-a-signed-char-to-store-BSONType-enumerations.patch
    + 0001-SERVER-12064-Atomic-operations-for-gcc-non-Intel-arc.patch
    + 0002-SERVER-12065-Support-ARM-and-AArch64-builds.patch
  - d/p/*: Refreshed/rebased remaining patches.
  - Use system provided libyaml-cpp:
    + d/control: Add libyaml-cpp-dev to BD's.
    + d/rules: Enable --with-system-yaml option.
    + d/p/fix-yaml-detection.patch: Fix detection of libyaml-cpp library.
  - d/mongodb-server.mongodb.upstart: Sync changes from upstream.
  - d/control,mongodb-dev.*: Drop mongodb-dev package; it has no reverse
    dependencies and upstream no longer install header files.
  - d/NEWS: Point users to upstream upgrade documentation for upgrades
    from 2.4 to 2.6.
* Merge from Debian unstable.
* d/control: BD on libv8-3.14-dev to ensure that transitioning to new v8
  versions is a explicit action due to changes in behaviour in >= 3.25
  (LP: #1295723).
* d/mongodb-server.prerm: Dropped debug echo call from maintainer script
  (LP: #1294455).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *    Copyright (C) 2013 10gen Inc.
 
3
 *
 
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.
 
7
 *
 
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.
 
12
 *
 
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/>.
 
15
 *
 
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.
 
27
 */
 
28
 
 
29
#pragma once
 
30
 
 
31
#include <string>
 
32
 
 
33
/*
 
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.
 
38
 */
 
39
 
 
40
namespace mongo {
 
41
 
 
42
    struct StorageGlobalParams {
 
43
 
 
44
        StorageGlobalParams() :
 
45
#ifdef _WIN32
 
46
            dbpath("\\data\\db\\"),
 
47
#else
 
48
            dbpath("/data/db/"),
 
49
#endif
 
50
            directoryperdb(false),
 
51
            lenForNewNsFiles(16 * 1024 * 1024),
 
52
            preallocj(true),
 
53
            journalCommitInterval(0), // 0 means use default
 
54
            quota(false), quotaFiles(8),
 
55
            syncdelay(60),
 
56
            useHints(true)
 
57
        {
 
58
            repairpath = dbpath;
 
59
            dur = false;
 
60
#if defined(_DURABLEDEFAULTON)
 
61
            dur = true;
 
62
#endif
 
63
            if (sizeof(void*) == 8)
 
64
                dur = true;
 
65
#if defined(_DURABLEDEFAULTOFF)
 
66
            dur = false;
 
67
#endif
 
68
        }
 
69
 
 
70
        std::string dbpath;
 
71
        bool directoryperdb;
 
72
        std::string repairpath;
 
73
        unsigned lenForNewNsFiles;
 
74
 
 
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
 
79
 
 
80
        bool dur;                       // --dur durability (now --journal)
 
81
        unsigned journalCommitInterval; // group/batch commit interval ms
 
82
 
 
83
        /** --durOptions 7      dump journal and terminate without doing anything further
 
84
            --durOptions 4      recover and terminate without listening
 
85
        */
 
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)
 
96
        };
 
97
        int durOptions;          // --durOptions <n> for debugging
 
98
 
 
99
        bool quota;            // --quota
 
100
        int quotaFiles;        // --quotaFiles
 
101
 
 
102
        double syncdelay;      // seconds between fsyncs
 
103
 
 
104
        bool useHints;         // only off if --nohints
 
105
    };
 
106
 
 
107
    extern StorageGlobalParams storageGlobalParams;
 
108
 
 
109
    bool isJournalingEnabled();
 
110
    void setJournalCommitInterval(unsigned newValue);
 
111
    unsigned getJournalCommitInterval();
 
112
 
 
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.
 
115
    bool isMongos();
 
116
 
 
117
} // namespace mongo