diff options
author | Scott Hernandez <scotthernandez@gmail.com> | 2015-08-06 15:41:38 -0400 |
---|---|---|
committer | Scott Hernandez <scotthernandez@gmail.com> | 2015-08-07 09:48:57 -0400 |
commit | 872c5220cef27d27a139b6d8612ac89be1ff16af (patch) | |
tree | 4599948e4d50077c0ed0ddc674a8121d5f55e42b /src/mongo/db/repl/member_config.cpp | |
parent | 8f1fb72cb7d67cb22b1345d945ce00eaefbad52c (diff) | |
download | mongo-872c5220cef27d27a139b6d8612ac89be1ff16af.tar.gz |
SERVER-17528: no vote members must have priority 0
Diffstat (limited to 'src/mongo/db/repl/member_config.cpp')
-rw-r--r-- | src/mongo/db/repl/member_config.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/mongo/db/repl/member_config.cpp b/src/mongo/db/repl/member_config.cpp index a6f8e311928..d8f3c1ed7bf 100644 --- a/src/mongo/db/repl/member_config.cpp +++ b/src/mongo/db/repl/member_config.cpp @@ -252,14 +252,20 @@ Status MemberConfig::validate() const { << durationCount<Seconds>(_slaveDelay) << " seconds is out of range"); } - if (_slaveDelay > Seconds(0) && _priority != 0) { - return Status(ErrorCodes::BadValue, "slaveDelay requires priority be zero"); - } - if (_hidden && _priority != 0) { - return Status(ErrorCodes::BadValue, "priority must be 0 when hidden=true"); - } - if (!_buildIndexes && _priority != 0) { - return Status(ErrorCodes::BadValue, "priority must be 0 when buildIndexes=false"); + // Check for additional electable requirements, when priority is non zero + if (_priority != 0) { + if (_votes == 0) { + return Status(ErrorCodes::BadValue, "priority must be 0 when non-voting (votes:0)"); + } + if (_slaveDelay > Seconds(0)) { + return Status(ErrorCodes::BadValue, "priority must be 0 when slaveDelay is used"); + } + if (_hidden) { + return Status(ErrorCodes::BadValue, "priority must be 0 when hidden=true"); + } + if (!_buildIndexes) { + return Status(ErrorCodes::BadValue, "priority must be 0 when buildIndexes=false"); + } } return Status::OK(); } |