summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2018-04-04 21:42:26 -0400
committerBenety Goh <benety@mongodb.com>2018-04-04 21:42:26 -0400
commit80f409d1311eb8d20251d17be474aff382538b84 (patch)
treea8134ca8928240b84414f8faf75c7af06119915b /src/mongo/db
parentc3badcbbcf069f428a765ba5937106d1da814076 (diff)
downloadmongo-80f409d1311eb8d20251d17be474aff382538b84.tar.gz
SERVER-34307 replace invariant(false) with MONGO_UNREACHABLE
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/catalog/capped_utils.cpp4
-rw-r--r--src/mongo/db/commands/generic_servers.cpp1
-rw-r--r--src/mongo/db/commands/mr_test.cpp2
-rw-r--r--src/mongo/db/concurrency/lock_manager.cpp2
-rw-r--r--src/mongo/db/concurrency/lock_state.cpp4
-rw-r--r--src/mongo/db/concurrency/locker_noop.h6
-rw-r--r--src/mongo/db/exec/distinct_scan.cpp2
-rw-r--r--src/mongo/db/exec/geo_near.cpp6
-rw-r--r--src/mongo/db/exec/text_or.cpp2
-rw-r--r--src/mongo/db/fts/fts_query_impl.cpp2
-rw-r--r--src/mongo/db/fts/fts_query_parser.cpp2
-rw-r--r--src/mongo/db/fts/stemmer.cpp2
-rw-r--r--src/mongo/db/fts/tokenizer.cpp2
-rw-r--r--src/mongo/db/geo/big_polygon.cpp6
-rw-r--r--src/mongo/db/geo/geometry_container.cpp6
-rw-r--r--src/mongo/db/geo/geoparser.cpp2
-rw-r--r--src/mongo/db/matcher/expression_leaf.cpp6
-rw-r--r--src/mongo/db/pipeline/value.cpp8
-rw-r--r--src/mongo/db/query/datetime/date_time_support.h2
-rw-r--r--src/mongo/db/query/find.cpp2
-rw-r--r--src/mongo/db/query/index_bounds_builder.cpp2
-rw-r--r--src/mongo/db/query/index_bounds_test.cpp2
-rw-r--r--src/mongo/db/query/plan_cache.cpp4
-rw-r--r--src/mongo/db/query/plan_enumerator.cpp2
-rw-r--r--src/mongo/db/query/planner_access.cpp2
-rw-r--r--src/mongo/db/query/planner_ixselect.cpp2
-rw-r--r--src/mongo/db/query/query_planner_common.cpp2
-rw-r--r--src/mongo/db/repl/check_quorum_for_config_change.cpp2
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl_elect_v1.cpp2
-rw-r--r--src/mongo/db/repl/replication_coordinator_mock.cpp6
-rw-r--r--src/mongo/db/repl/task_runner_test.cpp2
-rw-r--r--src/mongo/db/repl/topology_coordinator.cpp8
-rw-r--r--src/mongo/db/s/migration_destination_manager.cpp4
-rw-r--r--src/mongo/db/service_context_noop.cpp2
-rw-r--r--src/mongo/db/service_entry_point_common.cpp2
-rw-r--r--src/mongo/db/storage/devnull/devnull_kv_engine.cpp2
-rw-r--r--src/mongo/db/storage/key_string.cpp4
-rw-r--r--src/mongo/db/storage/kv/kv_database_catalog_entry.cpp2
-rw-r--r--src/mongo/db/storage/kv/kv_database_catalog_entry_mock.cpp2
-rw-r--r--src/mongo/db/storage/mmap_v1/btree/btree_logic.cpp17
-rw-r--r--src/mongo/db/storage/mmap_v1/catalog/namespace_details_collection_entry.cpp2
-rw-r--r--src/mongo/db/storage/mmap_v1/catalog/namespace_index.cpp5
-rw-r--r--src/mongo/db/storage/mmap_v1/dur.cpp43
-rw-r--r--src/mongo/db/storage/mmap_v1/dur_journal_writer.cpp10
-rw-r--r--src/mongo/db/storage/mmap_v1/heap_record_store_btree.h32
-rw-r--r--src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp12
-rw-r--r--src/mongo/db/storage/mmap_v1/record_store_v1_base.cpp4
-rw-r--r--src/mongo/db/storage/mmap_v1/record_store_v1_base.h2
-rw-r--r--src/mongo/db/storage/mmap_v1/record_store_v1_test_help.cpp7
-rw-r--r--src/mongo/db/storage/record_store.h6
50 files changed, 125 insertions, 138 deletions
diff --git a/src/mongo/db/catalog/capped_utils.cpp b/src/mongo/db/catalog/capped_utils.cpp
index 6355add953b..47a5b0a3dd2 100644
--- a/src/mongo/db/catalog/capped_utils.cpp
+++ b/src/mongo/db/catalog/capped_utils.cpp
@@ -210,7 +210,7 @@ mongo::Status mongo::cloneCollectionAsCapped(OperationContext* opCtx,
// 2) PlanExecutor::FAILURE is only returned on PlanStage::FAILURE. The
// CollectionScan PlanStage does not have a FAILURE scenario.
// 3) All other PlanExecutor states are handled above
- invariant(false);
+ MONGO_UNREACHABLE;
}
try {
@@ -246,7 +246,7 @@ mongo::Status mongo::cloneCollectionAsCapped(OperationContext* opCtx,
}
}
- invariant(false); // unreachable
+ MONGO_UNREACHABLE;
}
mongo::Status mongo::convertToCapped(OperationContext* opCtx,
diff --git a/src/mongo/db/commands/generic_servers.cpp b/src/mongo/db/commands/generic_servers.cpp
index 261562894a2..152b9437966 100644
--- a/src/mongo/db/commands/generic_servers.cpp
+++ b/src/mongo/db/commands/generic_servers.cpp
@@ -364,7 +364,6 @@ void CmdShutdown::shutdownHelper(const BSONObj& cmdObj) {
#endif
{
exitCleanly(EXIT_CLEAN); // this never returns
- invariant(false);
}
}
diff --git a/src/mongo/db/commands/mr_test.cpp b/src/mongo/db/commands/mr_test.cpp
index 8541e5f3f74..9a640137ece 100644
--- a/src/mongo/db/commands/mr_test.cpp
+++ b/src/mongo/db/commands/mr_test.cpp
@@ -92,7 +92,7 @@ std::string _getOutTypeString(mr::Config::OutputType outType) {
case mr::Config::INMEMORY:
return "INMEMORY";
}
- invariant(0);
+ MONGO_UNREACHABLE;
}
/**
diff --git a/src/mongo/db/concurrency/lock_manager.cpp b/src/mongo/db/concurrency/lock_manager.cpp
index aaffd7129df..82731ddc722 100644
--- a/src/mongo/db/concurrency/lock_manager.cpp
+++ b/src/mongo/db/concurrency/lock_manager.cpp
@@ -630,7 +630,7 @@ bool LockManager::unlock(LockRequest* request) {
_onLockModeChanged(lock, lock->grantedCounts[request->convertMode] == 0);
} else {
// Invalid request status
- invariant(false);
+ MONGO_UNREACHABLE;
}
return (request->recursiveCount == 0);
diff --git a/src/mongo/db/concurrency/lock_state.cpp b/src/mongo/db/concurrency/lock_state.cpp
index 79c40f1e0e5..25d3edc9657 100644
--- a/src/mongo/db/concurrency/lock_state.cpp
+++ b/src/mongo/db/concurrency/lock_state.cpp
@@ -553,7 +553,7 @@ bool LockerImpl<IsForMMAPV1>::isCollectionLockedForMode(StringData ns, LockMode
break;
}
- invariant(false);
+ MONGO_UNREACHABLE;
return false;
}
@@ -908,7 +908,7 @@ LockMode LockerImpl<IsForMMAPV1>::_getModeForMMAPV1FlushLock() const {
case MODE_IS:
return MODE_IS;
default:
- invariant(false);
+ MONGO_UNREACHABLE;
return MODE_NONE;
}
}
diff --git a/src/mongo/db/concurrency/locker_noop.h b/src/mongo/db/concurrency/locker_noop.h
index 7a66fa84687..5392411e858 100644
--- a/src/mongo/db/concurrency/locker_noop.h
+++ b/src/mongo/db/concurrency/locker_noop.h
@@ -58,7 +58,7 @@ public:
}
void setSharedLocksShouldTwoPhaseLock(bool sharedLocksShouldTwoPhaseLock) override {
- invariant(false);
+ MONGO_UNREACHABLE;
}
virtual LockResult lockGlobal(OperationContext* opCtx, LockMode mode) {
@@ -165,11 +165,11 @@ public:
}
virtual void releaseTicket() {
- invariant(false);
+ MONGO_UNREACHABLE;
}
virtual void reacquireTicket(OperationContext* opCtx) {
- invariant(false);
+ MONGO_UNREACHABLE;
}
virtual void dump() const {
diff --git a/src/mongo/db/exec/distinct_scan.cpp b/src/mongo/db/exec/distinct_scan.cpp
index 3804668fb73..5b1d5ccc545 100644
--- a/src/mongo/db/exec/distinct_scan.cpp
+++ b/src/mongo/db/exec/distinct_scan.cpp
@@ -125,7 +125,7 @@ PlanStage::StageState DistinctScan::doWork(WorkingSetID* out) {
*out = id;
return PlanStage::ADVANCED;
}
- invariant(false);
+ MONGO_UNREACHABLE;
}
bool DistinctScan::isEOF() {
diff --git a/src/mongo/db/exec/geo_near.cpp b/src/mongo/db/exec/geo_near.cpp
index d906efebc76..ef5ba9083d2 100644
--- a/src/mongo/db/exec/geo_near.cpp
+++ b/src/mongo/db/exec/geo_near.cpp
@@ -527,16 +527,16 @@ public:
//
void debugString(StringBuilder& debug, int level = 0) const final {
- invariant(false);
+ MONGO_UNREACHABLE;
}
bool equivalent(const MatchExpression* other) const final {
- invariant(false);
+ MONGO_UNREACHABLE;
return false;
}
unique_ptr<MatchExpression> shallowClone() const final {
- invariant(false);
+ MONGO_UNREACHABLE;
return NULL;
}
diff --git a/src/mongo/db/exec/text_or.cpp b/src/mongo/db/exec/text_or.cpp
index d7152e6e48c..19873825342 100644
--- a/src/mongo/db/exec/text_or.cpp
+++ b/src/mongo/db/exec/text_or.cpp
@@ -157,7 +157,7 @@ PlanStage::StageState TextOrStage::doWork(WorkingSetID* out) {
break;
case State::kDone:
// Should have been handled above.
- invariant(false);
+ MONGO_UNREACHABLE;
break;
}
diff --git a/src/mongo/db/fts/fts_query_impl.cpp b/src/mongo/db/fts/fts_query_impl.cpp
index 040333de5c7..a259759a2f3 100644
--- a/src/mongo/db/fts/fts_query_impl.cpp
+++ b/src/mongo/db/fts/fts_query_impl.cpp
@@ -127,7 +127,7 @@ Status FTSQueryImpl::parse(TextIndexVersion textIndexVersion) {
}
}
} else {
- invariant(false);
+ MONGO_UNREACHABLE;
}
}
diff --git a/src/mongo/db/fts/fts_query_parser.cpp b/src/mongo/db/fts/fts_query_parser.cpp
index 6b2381c3366..1a8bcae4025 100644
--- a/src/mongo/db/fts/fts_query_parser.cpp
+++ b/src/mongo/db/fts/fts_query_parser.cpp
@@ -54,7 +54,7 @@ QueryToken FTSQueryParser::next() {
// Query Parser should never land on whitespace
if (type == QueryToken::WHITESPACE) {
- invariant(false);
+ MONGO_UNREACHABLE;
}
if (type == QueryToken::TEXT) {
diff --git a/src/mongo/db/fts/stemmer.cpp b/src/mongo/db/fts/stemmer.cpp
index 19995baae4e..703e805d47f 100644
--- a/src/mongo/db/fts/stemmer.cpp
+++ b/src/mongo/db/fts/stemmer.cpp
@@ -59,7 +59,7 @@ StringData Stemmer::stem(StringData word) const {
if (sb_sym == NULL) {
// out of memory
- invariant(false);
+ MONGO_UNREACHABLE;
}
return StringData((const char*)(sb_sym), sb_stemmer_length(_stemmer));
diff --git a/src/mongo/db/fts/tokenizer.cpp b/src/mongo/db/fts/tokenizer.cpp
index e1f595b9a4a..a77dc6b0136 100644
--- a/src/mongo/db/fts/tokenizer.cpp
+++ b/src/mongo/db/fts/tokenizer.cpp
@@ -54,7 +54,7 @@ Token Tokenizer::next() {
unsigned start = _pos++;
Token::Type type = _type(_raw[start]);
if (type == Token::WHITESPACE)
- invariant(false);
+ MONGO_UNREACHABLE;
if (type == Token::TEXT)
while (_pos < _raw.size() && _type(_raw[_pos]) == type)
diff --git a/src/mongo/db/geo/big_polygon.cpp b/src/mongo/db/geo/big_polygon.cpp
index a83a59dd41c..c6eeb23ea4f 100644
--- a/src/mongo/db/geo/big_polygon.cpp
+++ b/src/mongo/db/geo/big_polygon.cpp
@@ -217,14 +217,14 @@ bool BigSimplePolygon::VirtualContainsPoint(const S2Point& p) const {
}
void BigSimplePolygon::Encode(Encoder* const encoder) const {
- invariant(false);
+ MONGO_UNREACHABLE;
}
bool BigSimplePolygon::Decode(Decoder* const decoder) {
- invariant(false);
+ MONGO_UNREACHABLE;
}
bool BigSimplePolygon::DecodeWithinScope(Decoder* const decoder) {
- invariant(false);
+ MONGO_UNREACHABLE;
}
}
diff --git a/src/mongo/db/geo/geometry_container.cpp b/src/mongo/db/geo/geometry_container.cpp
index c9b4b2f3f48..17b566c2f24 100644
--- a/src/mongo/db/geo/geometry_container.cpp
+++ b/src/mongo/db/geo/geometry_container.cpp
@@ -958,7 +958,7 @@ Status GeometryContainer::parseFromGeoJSON(const BSONObj& obj, bool skipValidati
}
} else {
// Should not reach here.
- invariant(false);
+ MONGO_UNREACHABLE;
}
// Check parsing result.
@@ -1089,7 +1089,7 @@ string GeometryContainer::getDebugType() const {
} else if (NULL != _geometryCollection) {
return "gc";
} else {
- invariant(false);
+ MONGO_UNREACHABLE;
return "";
}
}
@@ -1116,7 +1116,7 @@ CRS GeometryContainer::getNativeCRS() const {
} else if (NULL != _geometryCollection) {
return SPHERE;
} else {
- invariant(false);
+ MONGO_UNREACHABLE;
return FLAT;
}
}
diff --git a/src/mongo/db/geo/geoparser.cpp b/src/mongo/db/geo/geoparser.cpp
index e5b09077bd5..5511f620c42 100644
--- a/src/mongo/db/geo/geoparser.cpp
+++ b/src/mongo/db/geo/geoparser.cpp
@@ -723,7 +723,7 @@ Status GeoParser::parseGeometryCollection(const BSONObj& obj,
geoObj, skipValidation, out->multiPolygons.mutableVector().back());
} else {
// Should not reach here.
- invariant(false);
+ MONGO_UNREACHABLE;
}
// Check parsing result.
diff --git a/src/mongo/db/matcher/expression_leaf.cpp b/src/mongo/db/matcher/expression_leaf.cpp
index f9b82a7939f..c2485fa128a 100644
--- a/src/mongo/db/matcher/expression_leaf.cpp
+++ b/src/mongo/db/matcher/expression_leaf.cpp
@@ -617,7 +617,7 @@ bool BitTestMatchExpression::performBitTest(long long eValue) const {
case BITS_ANY_CLEAR:
return ~eValue & _bitMask;
default:
- invariant(false);
+ MONGO_UNREACHABLE;
}
}
@@ -713,7 +713,7 @@ void BitTestMatchExpression::debugString(StringBuilder& debug, int level) const
debug << "$bitsAnyClear:";
break;
default:
- invariant(false);
+ MONGO_UNREACHABLE;
}
debug << " [";
@@ -749,7 +749,7 @@ void BitTestMatchExpression::serialize(BSONObjBuilder* out) const {
opString = "$bitsAnyClear";
break;
default:
- invariant(false);
+ MONGO_UNREACHABLE;
}
BSONArrayBuilder arrBob;
diff --git a/src/mongo/db/pipeline/value.cpp b/src/mongo/db/pipeline/value.cpp
index 5adbfaff580..e5532e6fb49 100644
--- a/src/mongo/db/pipeline/value.cpp
+++ b/src/mongo/db/pipeline/value.cpp
@@ -693,7 +693,7 @@ int Value::compare(const Value& rL,
return compareDecimalToDouble(rL._storage.getDecimal(),
rR._storage.doubleValue);
default:
- invariant(false);
+ MONGO_UNREACHABLE;
}
}
@@ -710,7 +710,7 @@ int Value::compare(const Value& rL,
case NumberDecimal:
return compareIntToDecimal(rL._storage.intValue, rR._storage.getDecimal());
default:
- invariant(false);
+ MONGO_UNREACHABLE;
}
}
@@ -725,7 +725,7 @@ int Value::compare(const Value& rL,
case NumberDecimal:
return compareLongToDecimal(rL._storage.longValue, rR._storage.getDecimal());
default:
- invariant(false);
+ MONGO_UNREACHABLE;
}
}
@@ -741,7 +741,7 @@ int Value::compare(const Value& rL,
return compareDoubleToDecimal(rL._storage.doubleValue,
rR._storage.getDecimal());
default:
- invariant(false);
+ MONGO_UNREACHABLE;
}
}
diff --git a/src/mongo/db/query/datetime/date_time_support.h b/src/mongo/db/query/datetime/date_time_support.h
index c2246fd74b6..51e299336f9 100644
--- a/src/mongo/db/query/datetime/date_time_support.h
+++ b/src/mongo/db/query/datetime/date_time_support.h
@@ -269,7 +269,7 @@ public:
break;
default:
// Should never happen as format is pre-validated
- invariant(false);
+ MONGO_UNREACHABLE;
}
}
}
diff --git a/src/mongo/db/query/find.cpp b/src/mongo/db/query/find.cpp
index ebe4c2937c3..ba2df28842a 100644
--- a/src/mongo/db/query/find.cpp
+++ b/src/mongo/db/query/find.cpp
@@ -228,7 +228,7 @@ Message getMore(OperationContext* opCtx,
// For testing, we may want to fail if we receive a getmore.
if (MONGO_FAIL_POINT(failReceivedGetmore)) {
- invariant(0);
+ MONGO_UNREACHABLE;
}
*exhaust = false;
diff --git a/src/mongo/db/query/index_bounds_builder.cpp b/src/mongo/db/query/index_bounds_builder.cpp
index aa91b2c35a2..fb9425b5fdb 100644
--- a/src/mongo/db/query/index_bounds_builder.cpp
+++ b/src/mongo/db/query/index_bounds_builder.cpp
@@ -958,7 +958,7 @@ void IndexBoundsBuilder::alignBounds(IndexBounds* bounds, const BSONObj& kp, int
log() << "INVALID BOUNDS: " << redact(bounds->toString()) << endl
<< "kp = " << redact(kp) << endl
<< "scanDir = " << scanDir;
- invariant(0);
+ MONGO_UNREACHABLE;
}
}
diff --git a/src/mongo/db/query/index_bounds_test.cpp b/src/mongo/db/query/index_bounds_test.cpp
index 1fca089e584..72343489928 100644
--- a/src/mongo/db/query/index_bounds_test.cpp
+++ b/src/mongo/db/query/index_bounds_test.cpp
@@ -856,7 +856,7 @@ std::string toString(IndexBoundsChecker::Location location) {
case IndexBoundsChecker::AHEAD:
return "AHEAD";
}
- invariant(0);
+ MONGO_UNREACHABLE;
}
/**
diff --git a/src/mongo/db/query/plan_cache.cpp b/src/mongo/db/query/plan_cache.cpp
index 0d501a8212d..e530f18af59 100644
--- a/src/mongo/db/query/plan_cache.cpp
+++ b/src/mongo/db/query/plan_cache.cpp
@@ -273,7 +273,7 @@ void encodeGeoMatchExpression(const GeoMatchExpression* tree, StringBuilder* key
} else {
error() << "unknown CRS type " << (int)geoQuery.getGeometry().getNativeCRS()
<< " in geometry of type " << geoQuery.getGeometry().getDebugType();
- invariant(false);
+ MONGO_UNREACHABLE;
}
}
@@ -303,7 +303,7 @@ void encodeGeoNearMatchExpression(const GeoNearMatchExpression* tree, StringBuil
case UNSET:
error() << "unknown CRS type " << (int)nearQuery.centroid->crs
<< " in point geometry for near query";
- invariant(false);
+ MONGO_UNREACHABLE;
break;
}
}
diff --git a/src/mongo/db/query/plan_enumerator.cpp b/src/mongo/db/query/plan_enumerator.cpp
index 3b6f4a0f164..11d241426ab 100644
--- a/src/mongo/db/query/plan_enumerator.cpp
+++ b/src/mongo/db/query/plan_enumerator.cpp
@@ -341,7 +341,7 @@ PlanEnumerator::MemoID PlanEnumerator::memoIDForNode(MatchExpression* node) {
if (_nodeToId.end() == it) {
error() << "Trying to look up memo entry for node, none found.";
- invariant(0);
+ MONGO_UNREACHABLE;
}
return it->second;
diff --git a/src/mongo/db/query/planner_access.cpp b/src/mongo/db/query/planner_access.cpp
index ac1ecae8127..82d40993aea 100644
--- a/src/mongo/db/query/planner_access.cpp
+++ b/src/mongo/db/query/planner_access.cpp
@@ -1336,7 +1336,7 @@ void QueryPlannerAccess::handleFilter(ScanBuildingState* scanState) {
handleFilterAnd(scanState);
} else {
// We must be building leaves for either and AND or an OR.
- invariant(0);
+ MONGO_UNREACHABLE;
}
}
diff --git a/src/mongo/db/query/planner_ixselect.cpp b/src/mongo/db/query/planner_ixselect.cpp
index c63f41747a9..5f92f12b88c 100644
--- a/src/mongo/db/query/planner_ixselect.cpp
+++ b/src/mongo/db/query/planner_ixselect.cpp
@@ -323,7 +323,7 @@ bool QueryPlannerIXSelect::compatible(const BSONElement& elt,
// NOTE: This shouldn't be reached. Text index implies there is a separator implies we
// will always hit the 'return true' above.
- invariant(0);
+ MONGO_UNREACHABLE;
return true;
} else if (IndexNames::HASHED == indexedFieldType) {
if (ComparisonMatchExpressionBase::isEquality(exprtype)) {
diff --git a/src/mongo/db/query/query_planner_common.cpp b/src/mongo/db/query/query_planner_common.cpp
index 33eb72100cc..e9eb4a6c094 100644
--- a/src/mongo/db/query/query_planner_common.cpp
+++ b/src/mongo/db/query/query_planner_common.cpp
@@ -72,7 +72,7 @@ void QueryPlannerCommon::reverseScans(QuerySolutionNode* node) {
if (!isn->bounds.isValidFor(isn->index.keyPattern, isn->direction)) {
LOG(5) << "Invalid bounds: " << redact(isn->bounds.toString());
- invariant(0);
+ MONGO_UNREACHABLE;
}
// TODO: we can just negate every value in the already computed properties.
diff --git a/src/mongo/db/repl/check_quorum_for_config_change.cpp b/src/mongo/db/repl/check_quorum_for_config_change.cpp
index 52f7d3ce361..3d59066ca7b 100644
--- a/src/mongo/db/repl/check_quorum_for_config_change.cpp
+++ b/src/mongo/db/repl/check_quorum_for_config_change.cpp
@@ -273,7 +273,7 @@ void QuorumChecker::_tabulateHeartbeatResponse(const RemoteCommandRequest& reque
}
return;
}
- invariant(false);
+ MONGO_UNREACHABLE;
}
bool QuorumChecker::hasReceivedSufficientResponses() const {
diff --git a/src/mongo/db/repl/replication_coordinator_impl_elect_v1.cpp b/src/mongo/db/repl/replication_coordinator_impl_elect_v1.cpp
index f6a8ab8cec6..6d9bfb86b9d 100644
--- a/src/mongo/db/repl/replication_coordinator_impl_elect_v1.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl_elect_v1.cpp
@@ -300,7 +300,7 @@ void ReplicationCoordinatorImpl::_onVoteRequestComplete(long long newTerm) {
case VoteRequester::Result::kPrimaryRespondedNo:
// This is impossible because we would only require the primary's
// vote during a dry run.
- invariant(false);
+ MONGO_UNREACHABLE;
}
// Mark all nodes that responded to our vote request as up to avoid immediately
diff --git a/src/mongo/db/repl/replication_coordinator_mock.cpp b/src/mongo/db/repl/replication_coordinator_mock.cpp
index 4ff1360d17a..d1a55ebe047 100644
--- a/src/mongo/db/repl/replication_coordinator_mock.cpp
+++ b/src/mongo/db/repl/replication_coordinator_mock.cpp
@@ -94,7 +94,7 @@ MemberState ReplicationCoordinatorMock::getMemberState() const {
Status ReplicationCoordinatorMock::waitForMemberState(MemberState expectedState,
Milliseconds timeout) {
- invariant(false);
+ MONGO_UNREACHABLE;
return Status::OK();
}
@@ -248,7 +248,7 @@ ReplicationCoordinator::ApplierState ReplicationCoordinatorMock::getApplierState
void ReplicationCoordinatorMock::signalDrainComplete(OperationContext*, long long) {}
Status ReplicationCoordinatorMock::waitForDrainFinish(Milliseconds timeout) {
- invariant(false);
+ MONGO_UNREACHABLE;
return Status::OK();
}
@@ -401,7 +401,7 @@ bool ReplicationCoordinatorMock::shouldChangeSyncSource(
const HostAndPort& currentSource,
const rpc::ReplSetMetadata& replMetadata,
boost::optional<rpc::OplogQueryMetadata> oqMetadata) {
- invariant(false);
+ MONGO_UNREACHABLE;
}
OpTime ReplicationCoordinatorMock::getLastCommittedOpTime() const {
diff --git a/src/mongo/db/repl/task_runner_test.cpp b/src/mongo/db/repl/task_runner_test.cpp
index 0be2eebb0cd..65370743667 100644
--- a/src/mongo/db/repl/task_runner_test.cpp
+++ b/src/mongo/db/repl/task_runner_test.cpp
@@ -215,7 +215,7 @@ TEST_F(TaskRunnerTest, FirstTaskThrowsException) {
uassert(ErrorCodes::OperationFailed, "task failure", false);
// not reached.
- invariant(false);
+ MONGO_UNREACHABLE;
return TaskRunner::NextAction::kKeepOperationContext;
};
getTaskRunner().schedule(task);
diff --git a/src/mongo/db/repl/topology_coordinator.cpp b/src/mongo/db/repl/topology_coordinator.cpp
index 720944db1ff..f6236ebb384 100644
--- a/src/mongo/db/repl/topology_coordinator.cpp
+++ b/src/mongo/db/repl/topology_coordinator.cpp
@@ -85,7 +85,7 @@ std::string TopologyCoordinator::roleToString(TopologyCoordinator::Role role) {
case TopologyCoordinator::Role::kCandidate:
return "candidate";
}
- invariant(false);
+ MONGO_UNREACHABLE;
}
TopologyCoordinator::~TopologyCoordinator() {}
@@ -1900,12 +1900,12 @@ void TopologyCoordinator::changeMemberState_forTest(const MemberState& newMember
break;
default:
severe() << "Cannot switch to state " << newMemberState;
- invariant(false);
+ MONGO_UNREACHABLE;
}
if (getMemberState() != newMemberState.s) {
severe() << "Expected to enter state " << newMemberState << " but am now in "
<< getMemberState();
- invariant(false);
+ MONGO_UNREACHABLE;
}
log() << newMemberState;
}
@@ -2880,7 +2880,7 @@ void TopologyCoordinator::setFollowerMode(MemberState::MS newMode) {
_followerMode = newMode;
break;
default:
- invariant(false);
+ MONGO_UNREACHABLE;
}
if (_followerMode != MemberState::RS_SECONDARY) {
diff --git a/src/mongo/db/s/migration_destination_manager.cpp b/src/mongo/db/s/migration_destination_manager.cpp
index 099a829b414..81541e3daaf 100644
--- a/src/mongo/db/s/migration_destination_manager.cpp
+++ b/src/mongo/db/s/migration_destination_manager.cpp
@@ -1024,7 +1024,7 @@ bool MigrationDestinationManager::_applyMigrateOp(OperationContext* opCtx,
if (Helpers::findById(opCtx, ctx.db(), nss.ns(), id, fullObj)) {
if (!isInRange(fullObj, min, max, shardKeyPattern)) {
if (MONGO_FAIL_POINT(failMigrationReceivedOutOfRangeOperation)) {
- invariant(0);
+ MONGO_UNREACHABLE;
}
continue;
}
@@ -1057,7 +1057,7 @@ bool MigrationDestinationManager::_applyMigrateOp(OperationContext* opCtx,
// do not apply insert/update if doc does not belong to the chunk being migrated
if (!isInRange(updatedDoc, min, max, shardKeyPattern)) {
if (MONGO_FAIL_POINT(failMigrationReceivedOutOfRangeOperation)) {
- invariant(0);
+ MONGO_UNREACHABLE;
}
continue;
}
diff --git a/src/mongo/db/service_context_noop.cpp b/src/mongo/db/service_context_noop.cpp
index 2ad4d1f2c3c..59f40dfa710 100644
--- a/src/mongo/db/service_context_noop.cpp
+++ b/src/mongo/db/service_context_noop.cpp
@@ -60,7 +60,7 @@ StorageFactoriesIterator* ServiceContextNoop::makeStorageFactoriesIterator() {
return false;
}
virtual const StorageEngine::Factory* next() {
- invariant(false);
+ MONGO_UNREACHABLE;
}
};
return new EmptySFI();
diff --git a/src/mongo/db/service_entry_point_common.cpp b/src/mongo/db/service_entry_point_common.cpp
index ad2d1faa7f9..d1b46dccb16 100644
--- a/src/mongo/db/service_entry_point_common.cpp
+++ b/src/mongo/db/service_entry_point_common.cpp
@@ -1206,7 +1206,7 @@ DbResponse ServiceEntryPointCommon::handleRequest(OperationContext* opCtx,
} else if (op == dbDelete) {
receivedDelete(opCtx, nsString, m);
} else {
- invariant(false);
+ MONGO_UNREACHABLE;
}
}
} catch (const AssertionException& ue) {
diff --git a/src/mongo/db/storage/devnull/devnull_kv_engine.cpp b/src/mongo/db/storage/devnull/devnull_kv_engine.cpp
index fcd36355cb3..8e158dbc3ea 100644
--- a/src/mongo/db/storage/devnull/devnull_kv_engine.cpp
+++ b/src/mongo/db/storage/devnull/devnull_kv_engine.cpp
@@ -134,7 +134,7 @@ public:
const RecordData& oldRec,
const char* damageSource,
const mutablebson::DamageVector& damages) {
- invariant(false);
+ MONGO_UNREACHABLE;
}
diff --git a/src/mongo/db/storage/key_string.cpp b/src/mongo/db/storage/key_string.cpp
index eec019a7002..fb47b7d3189 100644
--- a/src/mongo/db/storage/key_string.cpp
+++ b/src/mongo/db/storage/key_string.cpp
@@ -1637,7 +1637,7 @@ void toBsonValue(uint8_t ctype,
break;
}
default:
- invariant(false);
+ MONGO_UNREACHABLE;
}
}
@@ -1920,7 +1920,7 @@ void filterKeyFromKeyString(uint8_t ctype,
break;
}
default:
- invariant(false);
+ MONGO_UNREACHABLE;
}
}
diff --git a/src/mongo/db/storage/kv/kv_database_catalog_entry.cpp b/src/mongo/db/storage/kv/kv_database_catalog_entry.cpp
index 276d23422a3..3721798d3cf 100644
--- a/src/mongo/db/storage/kv/kv_database_catalog_entry.cpp
+++ b/src/mongo/db/storage/kv/kv_database_catalog_entry.cpp
@@ -85,6 +85,6 @@ IndexAccessMethod* KVDatabaseCatalogEntry::getIndex(OperationContext* opCtx,
return new TwoDAccessMethod(index, sdi);
log() << "Can't find index for keyPattern " << desc->keyPattern();
- invariant(false);
+ MONGO_UNREACHABLE;
}
} // namespace mongo
diff --git a/src/mongo/db/storage/kv/kv_database_catalog_entry_mock.cpp b/src/mongo/db/storage/kv/kv_database_catalog_entry_mock.cpp
index dc9da47492b..d2b05312c86 100644
--- a/src/mongo/db/storage/kv/kv_database_catalog_entry_mock.cpp
+++ b/src/mongo/db/storage/kv/kv_database_catalog_entry_mock.cpp
@@ -43,5 +43,5 @@ std::unique_ptr<mongo::KVDatabaseCatalogEntryMock> mongo::kvDatabaseCatalogEntry
// Used to satisfy link dependencies in unit test - not invoked.
mongo::IndexAccessMethod* mongo::KVDatabaseCatalogEntryMock::getIndex(
OperationContext* opCtx, const CollectionCatalogEntry* collection, IndexCatalogEntry* index) {
- invariant(false);
+ MONGO_UNREACHABLE;
}
diff --git a/src/mongo/db/storage/mmap_v1/btree/btree_logic.cpp b/src/mongo/db/storage/mmap_v1/btree/btree_logic.cpp
index 4e77412b24a..57aba093807 100644
--- a/src/mongo/db/storage/mmap_v1/btree/btree_logic.cpp
+++ b/src/mongo/db/storage/mmap_v1/btree/btree_logic.cpp
@@ -405,7 +405,7 @@ bool BtreeLogic<BtreeLayout>::pushBack(BucketType* bucket,
<< endl;
log() << " klast: " << klast.data.toString() << endl;
log() << " key: " << key.toString() << endl;
- invariant(false);
+ MONGO_UNREACHABLE;
}
}
@@ -1113,7 +1113,7 @@ Status BtreeLogic<BtreeLayout>::_find(OperationContext* opCtx,
log() << key.toString() << endl;
log() << getFullKey(bucket, low - 1).data.toString() << endl;
}
- invariant(false);
+ MONGO_UNREACHABLE;
}
}
}
@@ -1456,8 +1456,7 @@ int BtreeLogic<BtreeLayout>::indexInParent(OperationContext* opCtx,
// dump();
log() << "Parent: " << bucket->parent << "\n";
// p->dump();
- invariant(false);
- return -1; // just to compile
+ MONGO_UNREACHABLE;
}
template <class BtreeLayout>
@@ -1737,7 +1736,7 @@ void BtreeLogic<BtreeLayout>::insertHere(OperationContext* opCtx,
// It's the last key.
if (bucket->nextChild != leftChildLoc) {
// XXX log more
- invariant(false);
+ MONGO_UNREACHABLE;
}
kn->prevChildBucket = bucket->nextChild;
invariant(kn->prevChildBucket == leftChildLoc);
@@ -1749,7 +1748,7 @@ void BtreeLogic<BtreeLayout>::insertHere(OperationContext* opCtx,
kn->prevChildBucket = leftChildLoc;
if (getKeyHeader(bucket, pos + 1).prevChildBucket != leftChildLoc) {
// XXX: log more
- invariant(false);
+ MONGO_UNREACHABLE;
}
const LocType* pc = &getKeyHeader(bucket, pos + 1).prevChildBucket;
// Intent declared in basicInsert()
@@ -2119,7 +2118,7 @@ void BtreeLogic<BtreeLayout>::assertValid(const std::string& ns,
}
dumpBucket(bucket);
}
- invariant(false);
+ MONGO_UNREACHABLE;
break;
} else if (z == 0) {
if (!(firstKey.header.recordLoc < secondKey.header.recordLoc)) {
@@ -2142,7 +2141,7 @@ void BtreeLogic<BtreeLayout>::assertValid(const std::string& ns,
if (z > 0) {
log() << "Btree keys out of order in collection " << ns;
std::call_once(assertValidFlag, [&bucket]() { dumpBucket(bucket); });
- invariant(false);
+ MONGO_UNREACHABLE;
}
}
}
@@ -2237,7 +2236,7 @@ DiskLoc BtreeLogic<BtreeLayout>::advance(OperationContext* opCtx,
log() << " keyOfs: " << *posInOut << " n:" << bucket->n << " direction: " << direction
<< endl;
// log() << bucketSummary() << endl;
- invariant(false);
+ MONGO_UNREACHABLE;
}
// XXX document
diff --git a/src/mongo/db/storage/mmap_v1/catalog/namespace_details_collection_entry.cpp b/src/mongo/db/storage/mmap_v1/catalog/namespace_details_collection_entry.cpp
index 33e3e3ca78a..865d5fff00f 100644
--- a/src/mongo/db/storage/mmap_v1/catalog/namespace_details_collection_entry.cpp
+++ b/src/mongo/db/storage/mmap_v1/catalog/namespace_details_collection_entry.cpp
@@ -504,6 +504,6 @@ void NamespaceDetailsCollectionCatalogEntry::setNamespacesRecordId(OperationCont
void NamespaceDetailsCollectionCatalogEntry::updateCappedSize(OperationContext* opCtx,
long long size) {
- invariant(false);
+ MONGO_UNREACHABLE;
}
}
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 a6530e391ba..90fce6f33f5 100644
--- a/src/mongo/db/storage/mmap_v1/catalog/namespace_index.cpp
+++ b/src/mongo/db/storage/mmap_v1/catalog/namespace_index.cpp
@@ -241,10 +241,7 @@ void NamespaceIndex::init(OperationContext* opCtx) {
<< "took " << static_cast<double>(timer.millis()) / 1000.0 << " seconds";
}
- if (p == 0) {
- severe() << "error couldn't open file " << pathString << " terminating" << endl;
- invariant(false);
- }
+ invariant(p, str::stream() << "error couldn't open file " << pathString << " terminating");
invariant(len <= 0x7fffffff);
_ht.reset(new NamespaceHashTable(p, (int)len, "namespace index"));
diff --git a/src/mongo/db/storage/mmap_v1/dur.cpp b/src/mongo/db/storage/mmap_v1/dur.cpp
index 599e397f944..c8077f637d9 100644
--- a/src/mongo/db/storage/mmap_v1/dur.cpp
+++ b/src/mongo/db/storage/mmap_v1/dur.cpp
@@ -302,17 +302,17 @@ void debugValidateFileMapsMatch(const DurableMappedFile* mmf) {
}
}
- if (low != 0xffffffff) {
- std::stringstream ss;
- ss << "journal error warning views mismatch " << mmf->filename() << ' ' << hex << low
- << ".." << high << " len:" << high - low + 1;
-
- log() << ss.str() << endl;
- log() << "priv loc: " << (void*)(p + low) << ' ' << endl;
-
- severe() << "Written data does not match in-memory view. Missing WriteIntent?";
- invariant(false);
- }
+ invariant(
+ low == 0xffffffff,
+ str::stream() << "journal error warning views mismatch " << mmf->filename() << ' ' << hex
+ << low
+ << ".."
+ << high
+ << " len:"
+ << high - low + 1
+ << ". priv loc: "
+ << (void*)(p + low)
+ << ". Written data does not match in-memory view. Missing WriteIntent?");
}
@@ -581,12 +581,9 @@ void DurableImpl::syncDataAndTruncateJournal(OperationContext* opCtx) {
}
void DurableImpl::closingFileNotification() {
- if (commitJob.hasWritten()) {
- severe() << "journal warning files are closing outside locks with writes pending";
-
- // File is closing while there are unwritten changes
- invariant(false);
- }
+ // File is closing while there are unwritten changes
+ invariant(!commitJob.hasWritten(),
+ "journal warning files are closing outside locks with writes pending");
}
void DurableImpl::commitAndStopDurThread(OperationContext* opCtx) {
@@ -658,7 +655,7 @@ static void remapPrivateView(OperationContext* opCtx, double fraction) {
severe() << "unknown exception in remapPrivateView causing immediate shutdown: ";
}
- invariant(false);
+ MONGO_UNREACHABLE;
}
@@ -848,21 +845,21 @@ static void durThread(ClockSource* cs, int64_t serverStartMs) {
LOG(4) << "groupCommit end";
} catch (DBException& e) {
severe() << "dbexception in durThread causing immediate shutdown: " << redact(e);
- invariant(false);
+ MONGO_UNREACHABLE;
} catch (std::ios_base::failure& e) {
severe() << "ios_base exception in durThread causing immediate shutdown: "
<< redact(e.what());
- invariant(false);
+ MONGO_UNREACHABLE;
} catch (std::bad_alloc& e) {
severe() << "bad_alloc exception in durThread causing immediate shutdown: "
<< redact(e.what());
- invariant(false);
+ MONGO_UNREACHABLE;
} catch (std::exception& e) {
severe() << "exception in durThread causing immediate shutdown: " << redact(e.what());
- invariant(false);
+ MONGO_UNREACHABLE;
} catch (...) {
severe() << "unhandled exception in durThread causing immediate shutdown";
- invariant(false);
+ MONGO_UNREACHABLE;
}
}
diff --git a/src/mongo/db/storage/mmap_v1/dur_journal_writer.cpp b/src/mongo/db/storage/mmap_v1/dur_journal_writer.cpp
index 4df45b463ce..3b244c25006 100644
--- a/src/mongo/db/storage/mmap_v1/dur_journal_writer.cpp
+++ b/src/mongo/db/storage/mmap_v1/dur_journal_writer.cpp
@@ -259,22 +259,22 @@ void JournalWriter::_journalWriterThread() {
}
} catch (const DBException& e) {
severe() << "dbexception in journalWriterThread causing immediate shutdown: " << redact(e);
- invariant(false);
+ MONGO_UNREACHABLE;
} catch (const std::ios_base::failure& e) {
severe() << "ios_base exception in journalWriterThread causing immediate shutdown: "
<< e.what();
- invariant(false);
+ MONGO_UNREACHABLE;
} catch (const std::bad_alloc& e) {
severe() << "bad_alloc exception in journalWriterThread causing immediate shutdown: "
<< e.what();
- invariant(false);
+ MONGO_UNREACHABLE;
} catch (const std::exception& e) {
severe() << "exception in journalWriterThread causing immediate shutdown: "
<< redact(e.what());
- invariant(false);
+ MONGO_UNREACHABLE;
} catch (...) {
severe() << "unhandled exception in journalWriterThread causing immediate shutdown";
- invariant(false);
+ MONGO_UNREACHABLE;
}
log() << "Journal writer thread stopped";
diff --git a/src/mongo/db/storage/mmap_v1/heap_record_store_btree.h b/src/mongo/db/storage/mmap_v1/heap_record_store_btree.h
index 507f16c8ec0..1575a721f2d 100644
--- a/src/mongo/db/storage/mmap_v1/heap_record_store_btree.h
+++ b/src/mongo/db/storage/mmap_v1/heap_record_store_btree.h
@@ -80,7 +80,7 @@ public:
int len,
bool enforceQuota,
UpdateNotifier* notifier) {
- invariant(false);
+ MONGO_UNREACHABLE;
}
virtual bool updateWithDamagesSupported() const {
@@ -92,25 +92,25 @@ public:
const RecordData& oldRec,
const char* damageSource,
const mutablebson::DamageVector& damages) {
- invariant(false);
+ MONGO_UNREACHABLE;
}
std::unique_ptr<SeekableRecordCursor> getCursor(OperationContext* opCtx,
bool forward) const final {
- invariant(false);
+ MONGO_UNREACHABLE;
}
virtual Status truncate(OperationContext* opCtx) {
- invariant(false);
+ MONGO_UNREACHABLE;
}
virtual void cappedTruncateAfter(OperationContext* opCtx, RecordId end, bool inclusive) {
- invariant(false);
+ MONGO_UNREACHABLE;
}
virtual bool compactSupported() const {
- invariant(false);
+ MONGO_UNREACHABLE;
}
virtual Status validate(OperationContext* opCtx,
@@ -118,49 +118,49 @@ public:
ValidateAdaptor* adaptor,
ValidateResults* results,
BSONObjBuilder* output) {
- invariant(false);
+ MONGO_UNREACHABLE;
}
virtual void appendCustomStats(OperationContext* opCtx,
BSONObjBuilder* result,
double scale) const {
- invariant(false);
+ MONGO_UNREACHABLE;
}
virtual void increaseStorageSize(OperationContext* opCtx, int size, bool enforceQuota) {
- invariant(false);
+ MONGO_UNREACHABLE;
}
virtual int64_t storageSize(OperationContext* opCtx,
BSONObjBuilder* extraInfo = NULL,
int infoLevel = 0) const {
- invariant(false);
+ MONGO_UNREACHABLE;
}
virtual long long dataSize(OperationContext* opCtx) const {
- invariant(false);
+ MONGO_UNREACHABLE;
}
virtual MmapV1RecordHeader* recordFor(const RecordId& loc) const {
- invariant(false);
+ MONGO_UNREACHABLE;
}
virtual bool isCapped() const {
- invariant(false);
+ MONGO_UNREACHABLE;
}
virtual const char* name() const {
- invariant(false);
+ MONGO_UNREACHABLE;
}
void waitForAllEarlierOplogWritesToBeVisible(OperationContext* opCtx) const override {
- invariant(false);
+ MONGO_UNREACHABLE;
}
virtual void updateStatsAfterRepair(OperationContext* opCtx,
long long numRecords,
long long dataSize) {
- invariant(false);
+ MONGO_UNREACHABLE;
}
// more things that we actually care about below
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 7fc0c855dcc..5ecca6b9c9b 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
@@ -205,19 +205,15 @@ Status MmapV1ExtentManager::init(OperationContext* opCtx) {
}
const DataFile* MmapV1ExtentManager::_getOpenFile(int fileId) const {
- if (fileId < 0 || fileId >= _files.size()) {
- log() << "_getOpenFile() invalid file index requested " << fileId;
- invariant(false);
- }
+ invariant(fileId >= 0 && fileId < _files.size(),
+ str::stream() << "_getOpenFile() invalid file index requested " << fileId);
return _files[fileId];
}
DataFile* MmapV1ExtentManager::_getOpenFile(int fileId) {
- if (fileId < 0 || fileId >= _files.size()) {
- log() << "_getOpenFile() invalid file index requested " << fileId;
- invariant(false);
- }
+ invariant(fileId >= 0 && fileId < _files.size(),
+ str::stream() << "_getOpenFile() invalid file index requested " << fileId);
return _files[fileId];
}
diff --git a/src/mongo/db/storage/mmap_v1/record_store_v1_base.cpp b/src/mongo/db/storage/mmap_v1/record_store_v1_base.cpp
index a82ec878315..6bfcaefcdde 100644
--- a/src/mongo/db/storage/mmap_v1/record_store_v1_base.cpp
+++ b/src/mongo/db/storage/mmap_v1/record_store_v1_base.cpp
@@ -935,7 +935,7 @@ int RecordStoreV1Base::quantizeAllocationSpace(int allocSize) {
return bucketSizes[i];
}
}
- invariant(false); // prior invariant means we should find something.
+ MONGO_UNREACHABLE; // prior invariant means we should find something.
}
bool RecordStoreV1Base::isQuantized(int recordSize) {
@@ -957,6 +957,6 @@ int RecordStoreV1Base::bucket(int size) {
// Technically, this is reachable if size == INT_MAX, but it would be an error to pass that
// in anyway since it would be impossible to have a record that large given the file and
// extent headers.
- invariant(false);
+ MONGO_UNREACHABLE;
}
}
diff --git a/src/mongo/db/storage/mmap_v1/record_store_v1_base.h b/src/mongo/db/storage/mmap_v1/record_store_v1_base.h
index af3e51a4661..410136ee312 100644
--- a/src/mongo/db/storage/mmap_v1/record_store_v1_base.h
+++ b/src/mongo/db/storage/mmap_v1/record_store_v1_base.h
@@ -258,7 +258,7 @@ public:
virtual void updateStatsAfterRepair(OperationContext* opCtx,
long long numRecords,
long long dataSize) {
- invariant(false); // MMAPv1 has its own repair which doesn't call this.
+ MONGO_UNREACHABLE; // MMAPv1 has its own repair which doesn't call this.
}
protected:
diff --git a/src/mongo/db/storage/mmap_v1/record_store_v1_test_help.cpp b/src/mongo/db/storage/mmap_v1/record_store_v1_test_help.cpp
index 3872e4bccd0..8c55c72301b 100644
--- a/src/mongo/db/storage/mmap_v1/record_store_v1_test_help.cpp
+++ b/src/mongo/db/storage/mmap_v1/record_store_v1_test_help.cpp
@@ -215,8 +215,7 @@ int DummyExtentManager::numFiles() const {
}
long long DummyExtentManager::fileSize() const {
- invariant(false);
- return -1;
+ MONGO_UNREACHABLE;
}
DiskLoc DummyExtentManager::allocateExtent(OperationContext* opCtx,
@@ -254,7 +253,7 @@ void DummyExtentManager::freeExtent(OperationContext* opCtx, DiskLoc extent) {
void DummyExtentManager::freeListStats(OperationContext* opCtx,
int* numExtents,
int64_t* totalFreeSizeBytes) const {
- invariant(false);
+ MONGO_UNREACHABLE;
}
std::unique_ptr<RecordFetcher> DummyExtentManager::recordNeedsFetch(const DiskLoc& loc) const {
@@ -271,7 +270,7 @@ MmapV1RecordHeader* DummyExtentManager::recordForV1(const DiskLoc& loc) const {
}
Extent* DummyExtentManager::extentForV1(const DiskLoc& loc) const {
- invariant(false);
+ MONGO_UNREACHABLE;
}
DiskLoc DummyExtentManager::extentLocForV1(const DiskLoc& loc) const {
diff --git a/src/mongo/db/storage/record_store.h b/src/mongo/db/storage/record_store.h
index e48297d530b..febd09d8c5a 100644
--- a/src/mongo/db/storage/record_store.h
+++ b/src/mongo/db/storage/record_store.h
@@ -315,7 +315,7 @@ public:
virtual bool isCapped() const = 0;
virtual void setCappedCallback(CappedCallback*) {
- invariant(false);
+ MONGO_UNREACHABLE;
}
/**
@@ -543,7 +543,7 @@ public:
* Only called if compactSupported() returns true.
*/
virtual bool compactsInPlace() const {
- invariant(false);
+ MONGO_UNREACHABLE;
}
/**
@@ -556,7 +556,7 @@ public:
RecordStoreCompactAdaptor* adaptor,
const CompactOptions* options,
CompactStats* stats) {
- invariant(false);
+ MONGO_UNREACHABLE;
}
/**