From 26543060c852aac22f26143a04bf7789ec8fec53 Mon Sep 17 00:00:00 2001 From: David Storch Date: Fri, 12 Aug 2016 15:58:56 -0400 Subject: SERVER-24508 BSONObj::ComparatorInterface BSONObj instances should now be compared via the comparator interface's evaluate() method. This preferred over using BSONObj::woCompare() directly. If the comparison doesn't require any database semantics (e.g. there is no collation), there is a global instance of the SimpleBSONObjComparator which should be used for BSONObj comparisons. If the comparison requires special semantics, then callers must instantiate their own comparator object. --- src/mongo/db/repl/data_replicator.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/mongo/db/repl/data_replicator.cpp') diff --git a/src/mongo/db/repl/data_replicator.cpp b/src/mongo/db/repl/data_replicator.cpp index 844f2ab8c82..3a101edf49c 100644 --- a/src/mongo/db/repl/data_replicator.cpp +++ b/src/mongo/db/repl/data_replicator.cpp @@ -36,6 +36,7 @@ #include "mongo/base/counter.h" #include "mongo/base/status.h" +#include "mongo/bson/simple_bsonobj_comparator.h" #include "mongo/client/fetcher.h" #include "mongo/client/remote_command_retry_scheduler.h" #include "mongo/db/commands/server_status_metric.h" @@ -1070,7 +1071,7 @@ StatusWith DataReplicator::_getNextApplierBatch_inlock() { // Apply commands one-at-a-time. ops.push_back(std::move(entry)); invariant(_oplogBuffer->tryPop(txn.get(), &op)); - dassert(ops.back().raw == op); + dassert(SimpleBSONObjComparator::kInstance.evaluate(ops.back().raw == op)); } // Otherwise, apply what we have so far and come back for the command. @@ -1113,7 +1114,7 @@ StatusWith DataReplicator::_getNextApplierBatch_inlock() { ops.push_back(std::move(entry)); totalBytes += ops.back().raw.objsize(); invariant(_oplogBuffer->tryPop(txn.get(), &op)); - dassert(ops.back().raw == op); + dassert(SimpleBSONObjComparator::kInstance.evaluate(ops.back().raw == op)); } return std::move(ops); } -- cgit v1.2.1