diff options
author | Geert Bosch <geert@mongodb.com> | 2018-11-20 20:58:22 -0500 |
---|---|---|
committer | Geert Bosch <geert@mongodb.com> | 2018-12-03 16:50:16 -0500 |
commit | 2c124b76e1d51a9427efffd804e3ca1cff6a1a11 (patch) | |
tree | f30ca53f2b3da8bcea108e8bfad58bddcf1ce156 | |
parent | ce4649cbe2f15fcd40b7b292090c3ab185b4c59f (diff) | |
download | mongo-2c124b76e1d51a9427efffd804e3ca1cff6a1a11.tar.gz |
SERVER-38228 Fix bulk builder for unique indexes
-rw-r--r-- | src/mongo/db/storage/biggie/biggie_sorted_impl.cpp | 5 | ||||
-rw-r--r-- | src/mongo/db/storage/biggie/biggie_sorted_impl.h | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/mongo/db/storage/biggie/biggie_sorted_impl.cpp b/src/mongo/db/storage/biggie/biggie_sorted_impl.cpp index 6a634211b19..76b09aba93b 100644 --- a/src/mongo/db/storage/biggie/biggie_sorted_impl.cpp +++ b/src/mongo/db/storage/biggie/biggie_sorted_impl.cpp @@ -160,6 +160,7 @@ IndexKeyEntry keyStringToIndexKeyEntry(const std::string keyString, } // namespace SortedDataBuilderInterface::SortedDataBuilderInterface(OperationContext* opCtx, + bool unique, bool dupsAllowed, Ordering order, const std::string& prefix, @@ -168,6 +169,7 @@ SortedDataBuilderInterface::SortedDataBuilderInterface(OperationContext* opCtx, const std::string& indexName, const BSONObj& keyPattern) : _opCtx(opCtx), + _unique(unique), _dupsAllowed(dupsAllowed), _order(order), _prefix(prefix), @@ -222,7 +224,7 @@ StatusWith<SpecialFormatInserted> SortedDataBuilderInterface::addKey(const BSONO std::memcpy(&data[0] + sizeof(int64_t), internalTbString.data(), internalTbString.length()); std::string workingCopyInsertKey = - createKeyString(key, loc, _prefix, _order, /* isUnique */ false); + createKeyString(key, loc, _prefix, _order, /* isUnique */ _unique); workingCopy->insert(StringStore::value_type(workingCopyInsertKey, data)); _hasLast = true; @@ -236,6 +238,7 @@ StatusWith<SpecialFormatInserted> SortedDataBuilderInterface::addKey(const BSONO SortedDataBuilderInterface* SortedDataInterface::getBulkBuilder(OperationContext* opCtx, bool dupsAllowed) { return new SortedDataBuilderInterface(opCtx, + _isUnique, dupsAllowed, _order, _prefix, diff --git a/src/mongo/db/storage/biggie/biggie_sorted_impl.h b/src/mongo/db/storage/biggie/biggie_sorted_impl.h index 241c9d052ba..220110bb1a5 100644 --- a/src/mongo/db/storage/biggie/biggie_sorted_impl.h +++ b/src/mongo/db/storage/biggie/biggie_sorted_impl.h @@ -38,6 +38,7 @@ namespace biggie { class SortedDataBuilderInterface : public ::mongo::SortedDataBuilderInterface { public: SortedDataBuilderInterface(OperationContext* opCtx, + bool unique, bool dupsAllowed, Ordering order, const std::string& prefix, @@ -50,6 +51,7 @@ public: private: OperationContext* _opCtx; + bool _unique; bool _dupsAllowed; // Order of the keys. Ordering _order; |