diff --git a/src/mongo/db/query/client_cursor/cursor_manager.cpp b/src/mongo/db/query/client_cursor/cursor_manager.cpp index 39bb3213179..4a4af7661cc 100644 --- a/src/mongo/db/query/client_cursor/cursor_manager.cpp +++ b/src/mongo/db/query/client_cursor/cursor_manager.cpp @@ -388,7 +388,7 @@ ClientCursorPin CursorManager::registerCursor(OperationContext* opCtx, // Make sure the PlanExecutor isn't registered, since we will register the ClientCursor wrapping // it. - invariant(cursorParams.exec); + tassert(11177210, "cursorParams.exec must not be null", cursorParams.exec); cursorParams.exec.get_deleter().dismissDisposal(); // Note we must hold the registration lock from now until insertion into '_cursorMap' to ensure diff --git a/src/mongo/db/query/client_cursor/cursor_response.cpp b/src/mongo/db/query/client_cursor/cursor_response.cpp index e602aacf301..90a76b0a874 100644 --- a/src/mongo/db/query/client_cursor/cursor_response.cpp +++ b/src/mongo/db/query/client_cursor/cursor_response.cpp @@ -84,8 +84,7 @@ void CursorResponseBuilder::done(CursorId cursorId, const NamespaceString& cursorNamespace, boost::optional metrics, const SerializationContext& serializationContext) { - invariant(_active); - + tassert(11177212, "done() can only be called on an active CursorResponseBuilder", _active); _batch.reset(); if (!_postBatchResumeToken.isEmpty()) { _cursorObject->append(kPostBatchResumeTokenField, _postBatchResumeToken); diff --git a/src/mongo/db/query/client_cursor/cursor_response.h b/src/mongo/db/query/client_cursor/cursor_response.h index bca6c2a52b0..d771b35f2da 100644 --- a/src/mongo/db/query/client_cursor/cursor_response.h +++ b/src/mongo/db/query/client_cursor/cursor_response.h @@ -91,13 +91,14 @@ public: } size_t bytesUsed() const { - invariant(_active); + tassert( + 11177213, "bytesUsed() can only be called on an active CursorResponseBuilder", _active); return _batch->len(); } MONGO_COMPILER_ALWAYS_INLINE void append(const BSONObj& obj) { - invariant(_active); - + tassert( + 11177214, "append() can only be called on an active CursorResponseBuilder", _active); _batch->append(obj); _numDocs++; }