diff options
author | Scott Hernandez <scotthernandez@gmail.com> | 2013-12-20 12:44:40 -0500 |
---|---|---|
committer | Scott Hernandez <scotthernandez@gmail.com> | 2013-12-20 14:16:08 -0500 |
commit | 191e9e47d8c211acdf7bef6850c261c2a40e2a8c (patch) | |
tree | b5c4c627eb053ec283551ec8d2ad5f317dc25b8c /src/mongo/db/field_ref_set.cpp | |
parent | 3b5b35c15690769df2a11a75a3c6e6afd7c2169a (diff) | |
download | mongo-191e9e47d8c211acdf7bef6850c261c2a40e2a8c.tar.gz |
SERVER-12126: Improve update validation performance
Diffstat (limited to 'src/mongo/db/field_ref_set.cpp')
-rw-r--r-- | src/mongo/db/field_ref_set.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/mongo/db/field_ref_set.cpp b/src/mongo/db/field_ref_set.cpp index 64c5e178b7a..46b09e8dd4b 100644 --- a/src/mongo/db/field_ref_set.cpp +++ b/src/mongo/db/field_ref_set.cpp @@ -59,11 +59,12 @@ namespace mongo { FieldRefSet::FieldRefSet() { } - void FieldRefSet::getConflicts(const FieldRef* toCheck, FieldRefSet* conflicts) const { + bool FieldRefSet::findConflicts(const FieldRef* toCheck, FieldRefSet* conflicts) const { + bool foundConflict = false; // If the set is empty, there is no work to do. if (_fieldSet.empty()) - return; + return foundConflict; StringData prefixStr = safeFirstPart(toCheck); FieldRef prefixField; @@ -75,10 +76,16 @@ namespace mongo { while (it != _fieldSet.end() && safeFirstPart(*it) == prefixStr) { size_t common = (*it)->commonPrefixSize(*toCheck); if ((*it)->numParts() == common || toCheck->numParts() == common) { + if (!conflicts) + return true; + conflicts->_fieldSet.insert(*it); + foundConflict = true; } ++it; } + + return foundConflict; } void FieldRefSet::keepShortest(const FieldRef* toInsert) { |