diff options
Diffstat (limited to 'src/mongo/db/repl/repl_settings.h')
-rw-r--r-- | src/mongo/db/repl/repl_settings.h | 84 |
1 files changed, 25 insertions, 59 deletions
diff --git a/src/mongo/db/repl/repl_settings.h b/src/mongo/db/repl/repl_settings.h index 1ce5fa6b4dc..cd5a67d52e4 100644 --- a/src/mongo/db/repl/repl_settings.h +++ b/src/mongo/db/repl/repl_settings.h @@ -49,82 +49,48 @@ typedef enum { NotSlave = 0, SimpleSlave } SlaveTypes; class ReplSettings { public: - SlaveTypes slave; + std::string ourSetName() const { + std::string setname; + size_t sl = replSet.find('/'); + if (sl == std::string::npos) + return replSet; + return replSet.substr(0, sl); + } + bool usingReplSets() const { + return !replSet.empty(); + } + + SlaveTypes slave = NotSlave; /** * true means we are master and doing replication. if we are not writing to oplog, this won't * be true. */ - bool master; + bool master = false; + + bool fastsync = false; - bool fastsync; + bool autoresync = false; - bool autoresync; + int slavedelay = 0; - int slavedelay; + long long oplogSize = 0; // --oplogSize - long long oplogSize; // --oplogSize + /** + * True means that the majorityReadConcern feature is enabled, either explicitly by the user or + * implicitly by a requiring feature such as CSRS. It does not mean that the storage engine + * supports snapshots or that the snapshot thread is running. Those are tracked separately. + */ + bool majorityReadConcernEnabled = false; // for master/slave replication std::string source; // --source std::string only; // --only - int pretouch; // --pretouch for replication application (experimental) + int pretouch = 0; // --pretouch for replication application (experimental) std::string replSet; // --replSet[/<seedlist>] - std::string ourSetName() const { - std::string setname; - size_t sl = replSet.find('/'); - if (sl == std::string::npos) - return replSet; - return replSet.substr(0, sl); - } - bool usingReplSets() const { - return !replSet.empty(); - } std::string rsIndexPrefetch; // --indexPrefetch - - ReplSettings() - : slave(NotSlave), - master(false), - fastsync(), - autoresync(false), - slavedelay(), - oplogSize(0), - pretouch(0) {} - - // TODO(spencer): Remove explicit copy constructor after we no longer have mutable state - // in ReplSettings. - ReplSettings(const ReplSettings& other) - : slave(other.slave), - master(other.master), - fastsync(other.fastsync), - autoresync(other.autoresync), - slavedelay(other.slavedelay), - oplogSize(other.oplogSize), - source(other.source), - only(other.only), - pretouch(other.pretouch), - replSet(other.replSet), - rsIndexPrefetch(other.rsIndexPrefetch) {} - - ReplSettings& operator=(const ReplSettings& other) { - if (this == &other) - return *this; - - slave = other.slave; - master = other.master; - fastsync = other.fastsync; - autoresync = other.autoresync; - slavedelay = other.slavedelay; - oplogSize = other.oplogSize; - source = other.source; - only = other.only; - pretouch = other.pretouch; - replSet = other.replSet; - rsIndexPrefetch = other.rsIndexPrefetch; - return *this; - } }; } // namespace repl |