summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Boros <ian.boros@mongodb.com>2020-10-16 15:50:11 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-11-12 19:54:59 +0000
commit00759b253d58a3cea5a316b9dbfce43d9eaebf20 (patch)
tree51d56413f943fc695c48f21414e304359ebacbb0
parent29d69c642424306b1122f1574d0dfd933ed09f3c (diff)
downloadmongo-00759b253d58a3cea5a316b9dbfce43d9eaebf20.tar.gz
SERVER-51711 Add stronger invariants about EOO bytes to DocumentDiffApplier
-rw-r--r--src/mongo/db/update/document_diff_applier.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/mongo/db/update/document_diff_applier.cpp b/src/mongo/db/update/document_diff_applier.cpp
index e38c0ad8050..47b254d4e29 100644
--- a/src/mongo/db/update/document_diff_applier.cpp
+++ b/src/mongo/db/update/document_diff_applier.cpp
@@ -121,6 +121,7 @@ public:
auto it = tables.fieldMap.find(elt.fieldNameStringData());
if (it == tables.fieldMap.end()) {
// Field is not modified, so we append it as is.
+ invariant(!elt.eoo());
builder->append(elt);
continue;
}
@@ -200,6 +201,7 @@ private:
stdx::visit(
visit_helper::Overloaded{
[this, &path, builder](const BSONElement& update) {
+ invariant(!update.eoo());
builder->append(update);
updateIndexesAffected(path);
},
@@ -260,6 +262,7 @@ private:
appendNewValueForArrayIndex(*preImageIt, path, nextMod->second, builder);
nextMod = reader->next();
} else {
+ invariant(!(*preImageIt).eoo());
// This index is not in the diff so we keep the value in the pre image.
builder->append(*preImageIt);
}