diff options
author | David Storch <david.storch@10gen.com> | 2016-08-12 15:58:56 -0400 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2016-08-18 11:14:17 -0400 |
commit | 26543060c852aac22f26143a04bf7789ec8fec53 (patch) | |
tree | df3ae49e5c4745058be29b7ec8a8e4b528b50a9a /src/mongo/db/repl/data_replicator.cpp | |
parent | 13fa28982d008568f7620d73ddec0c61fad7cbc8 (diff) | |
download | mongo-26543060c852aac22f26143a04bf7789ec8fec53.tar.gz |
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.
Diffstat (limited to 'src/mongo/db/repl/data_replicator.cpp')
-rw-r--r-- | src/mongo/db/repl/data_replicator.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
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<Operations> 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<Operations> 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); } |