summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/index/index_access_method.cpp13
-rw-r--r--src/mongo/db/storage/biggie/biggie_sorted_impl.cpp6
-rw-r--r--src/mongo/db/storage/biggie/biggie_sorted_impl.h2
-rw-r--r--src/mongo/db/storage/devnull/devnull_kv_engine.cpp2
-rw-r--r--src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.cpp6
-rw-r--r--src/mongo/db/storage/kv/kv_engine_test_harness.cpp2
-rw-r--r--src/mongo/db/storage/mobile/mobile_index.cpp22
-rw-r--r--src/mongo/db/storage/mobile/mobile_index.h8
-rw-r--r--src/mongo/db/storage/sorted_data_interface.h8
-rw-r--r--src/mongo/db/storage/sorted_data_interface_test_cursor.cpp8
-rw-r--r--src/mongo/db/storage/sorted_data_interface_test_cursor_advanceto.cpp138
-rw-r--r--src/mongo/db/storage/sorted_data_interface_test_cursor_locate.cpp86
-rw-r--r--src/mongo/db/storage/sorted_data_interface_test_cursor_saverestore.cpp30
-rw-r--r--src/mongo/db/storage/sorted_data_interface_test_dupkeycheck.cpp31
-rw-r--r--src/mongo/db/storage/sorted_data_interface_test_fullvalidate.cpp3
-rw-r--r--src/mongo/db/storage/sorted_data_interface_test_harness.cpp160
-rw-r--r--src/mongo/db/storage/sorted_data_interface_test_insert.cpp92
-rw-r--r--src/mongo/db/storage/sorted_data_interface_test_isempty.cpp9
-rw-r--r--src/mongo/db/storage/sorted_data_interface_test_rollback.cpp24
-rw-r--r--src/mongo/db/storage/sorted_data_interface_test_spaceused.cpp3
-rw-r--r--src/mongo/db/storage/sorted_data_interface_test_touch.cpp9
-rw-r--r--src/mongo/db/storage/sorted_data_interface_test_unindex.cpp74
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp23
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_index.h10
-rw-r--r--src/mongo/dbtests/validate_tests.cpp6
25 files changed, 285 insertions, 490 deletions
diff --git a/src/mongo/db/index/index_access_method.cpp b/src/mongo/db/index/index_access_method.cpp
index 7a4d3998cbd..989ce31802e 100644
--- a/src/mongo/db/index/index_access_method.cpp
+++ b/src/mongo/db/index/index_access_method.cpp
@@ -153,17 +153,15 @@ Status AbstractIndexAccessMethod::insertKeys(OperationContext* opCtx,
// over the data keys, each of them should point to the doc's RecordId. When iterating over
// the multikey metadata keys, they should point to the reserved 'kMultikeyMetadataKeyId'.
for (const auto keyVec : {&keys, &multikeyMetadataKeys}) {
- const auto& recordId = (keyVec == &keys ? loc : kMultikeyMetadataKeyId);
for (const auto& keyString : *keyVec) {
bool unique = _descriptor->unique();
- Status status =
- _newInterface->insert(opCtx, keyString, recordId, !unique /* dupsAllowed */);
+ Status status = _newInterface->insert(opCtx, keyString, !unique /* dupsAllowed */);
// When duplicates are encountered and allowed, retry with dupsAllowed. Add the
// key to the output vector so callers know which duplicate keys were inserted.
if (ErrorCodes::DuplicateKey == status.code() && options.dupsAllowed) {
invariant(unique);
- status = _newInterface->insert(opCtx, keyString, recordId, true /* dupsAllowed */);
+ status = _newInterface->insert(opCtx, keyString, true /* dupsAllowed */);
if (status.isOK() && result) {
auto key =
@@ -193,7 +191,7 @@ void AbstractIndexAccessMethod::removeOneKey(OperationContext* opCtx,
bool dupsAllowed) {
try {
- _newInterface->unindex(opCtx, keyString, loc, dupsAllowed);
+ _newInterface->unindex(opCtx, keyString, dupsAllowed);
} catch (AssertionException& e) {
log() << "Assertion failure: _unindex failed on: " << _descriptor->parentNS()
<< " for index: " << _descriptor->indexName();
@@ -414,7 +412,7 @@ Status AbstractIndexAccessMethod::update(OperationContext* opCtx,
}
for (const auto& remKey : ticket.removed) {
- _newInterface->unindex(opCtx, remKey, ticket.loc, ticket.dupsAllowed);
+ _newInterface->unindex(opCtx, remKey, ticket.dupsAllowed);
}
// Add all new data keys, and all new multikey metadata keys, into the index. When iterating
@@ -422,9 +420,8 @@ Status AbstractIndexAccessMethod::update(OperationContext* opCtx,
// the multikey metadata keys, they should point to the reserved 'kMultikeyMetadataKeyId'.
const auto newMultikeyMetadataKeys = asVector(ticket.newMultikeyMetadataKeys);
for (const auto keySet : {&ticket.added, &newMultikeyMetadataKeys}) {
- const auto& recordId = (keySet == &ticket.added ? ticket.loc : kMultikeyMetadataKeyId);
for (const auto& keyString : *keySet) {
- Status status = _newInterface->insert(opCtx, keyString, recordId, ticket.dupsAllowed);
+ Status status = _newInterface->insert(opCtx, keyString, ticket.dupsAllowed);
if (isFatalError(opCtx, status, keyString)) {
return status;
}
diff --git a/src/mongo/db/storage/biggie/biggie_sorted_impl.cpp b/src/mongo/db/storage/biggie/biggie_sorted_impl.cpp
index 43208813a4c..ac627f6d5c0 100644
--- a/src/mongo/db/storage/biggie/biggie_sorted_impl.cpp
+++ b/src/mongo/db/storage/biggie/biggie_sorted_impl.cpp
@@ -320,9 +320,8 @@ SortedDataInterface::SortedDataInterface(const Ordering& ordering, bool isUnique
Status SortedDataInterface::insert(OperationContext* opCtx,
const KeyString::Value& keyString,
- const RecordId& loc,
bool dupsAllowed) {
- dassert(loc == KeyString::decodeRecordIdAtEnd(keyString.getBuffer(), keyString.getSize()));
+ RecordId loc = KeyString::decodeRecordIdAtEnd(keyString.getBuffer(), keyString.getSize());
StringStore* workingCopy(RecoveryUnit::get(opCtx)->getHead());
auto sizeWithoutRecordId =
@@ -387,9 +386,8 @@ Status SortedDataInterface::insert(OperationContext* opCtx,
void SortedDataInterface::unindex(OperationContext* opCtx,
const KeyString::Value& keyString,
- const RecordId& loc,
bool dupsAllowed) {
- dassert(loc == KeyString::decodeRecordIdAtEnd(keyString.getBuffer(), keyString.getSize()));
+ RecordId loc = KeyString::decodeRecordIdAtEnd(keyString.getBuffer(), keyString.getSize());
StringStore* workingCopy(RecoveryUnit::get(opCtx)->getHead());
std::string removeKeyString;
diff --git a/src/mongo/db/storage/biggie/biggie_sorted_impl.h b/src/mongo/db/storage/biggie/biggie_sorted_impl.h
index 36ac080ea04..eef51fdd53a 100644
--- a/src/mongo/db/storage/biggie/biggie_sorted_impl.h
+++ b/src/mongo/db/storage/biggie/biggie_sorted_impl.h
@@ -82,11 +82,9 @@ public:
bool dupsAllowed) override;
virtual Status insert(OperationContext* opCtx,
const KeyString::Value& keyString,
- const RecordId& loc,
bool dupsAllowed) override;
virtual void unindex(OperationContext* opCtx,
const KeyString::Value& keyString,
- const RecordId& loc,
bool dupsAllowed) override;
virtual Status dupKeyCheck(OperationContext* opCtx, const KeyString::Value& keyString) override;
virtual void fullValidate(OperationContext* opCtx,
diff --git a/src/mongo/db/storage/devnull/devnull_kv_engine.cpp b/src/mongo/db/storage/devnull/devnull_kv_engine.cpp
index 87be57f7250..dbc5a724d7c 100644
--- a/src/mongo/db/storage/devnull/devnull_kv_engine.cpp
+++ b/src/mongo/db/storage/devnull/devnull_kv_engine.cpp
@@ -187,14 +187,12 @@ public:
virtual Status insert(OperationContext* opCtx,
const KeyString::Value& keyString,
- const RecordId& loc,
bool dupsAllowed) {
return Status::OK();
}
virtual void unindex(OperationContext* opCtx,
const KeyString::Value& keyString,
- const RecordId& loc,
bool dupsAllowed) {}
virtual Status dupKeyCheck(OperationContext* opCtx, const KeyString::Value& keyString) {
diff --git a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.cpp b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.cpp
index b0888daa615..3bc907f6721 100644
--- a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.cpp
+++ b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.cpp
@@ -184,9 +184,8 @@ public:
virtual Status insert(OperationContext* opCtx,
const KeyString::Value& keyString,
- const RecordId& loc,
bool dupsAllowed) {
- dassert(loc == KeyString::decodeRecordIdAtEnd(keyString.getBuffer(), keyString.getSize()));
+ RecordId loc = KeyString::decodeRecordIdAtEnd(keyString.getBuffer(), keyString.getSize());
auto key = KeyString::toBson(keyString, _ordering);
@@ -211,9 +210,8 @@ public:
virtual void unindex(OperationContext* opCtx,
const KeyString::Value& keyString,
- const RecordId& loc,
bool dupsAllowed) {
- dassert(loc == KeyString::decodeRecordIdAtEnd(keyString.getBuffer(), keyString.getSize()));
+ RecordId loc = KeyString::decodeRecordIdAtEnd(keyString.getBuffer(), keyString.getSize());
auto key = KeyString::toBson(keyString, _ordering);
diff --git a/src/mongo/db/storage/kv/kv_engine_test_harness.cpp b/src/mongo/db/storage/kv/kv_engine_test_harness.cpp
index 14faebc450a..8cdd2610162 100644
--- a/src/mongo/db/storage/kv/kv_engine_test_harness.cpp
+++ b/src/mongo/db/storage/kv/kv_engine_test_harness.cpp
@@ -185,7 +185,7 @@ TEST(KVEngineTestHarness, SimpleSorted1) {
KeyString::HeapBuilder(
sorted->getKeyStringVersion(), BSON("" << 5), sorted->getOrdering(), recordId)
.release();
- ASSERT_OK(sorted->insert(&opCtx, keyString, recordId, true));
+ ASSERT_OK(sorted->insert(&opCtx, keyString, true));
uow.commit();
}
diff --git a/src/mongo/db/storage/mobile/mobile_index.cpp b/src/mongo/db/storage/mobile/mobile_index.cpp
index 19bb34ad77c..7a6281195a1 100644
--- a/src/mongo/db/storage/mobile/mobile_index.cpp
+++ b/src/mongo/db/storage/mobile/mobile_index.cpp
@@ -61,9 +61,8 @@ MobileIndex::MobileIndex(OperationContext* opCtx,
Status MobileIndex::insert(OperationContext* opCtx,
const KeyString::Value& keyString,
- const RecordId& recId,
bool dupsAllowed) {
- return _insert(opCtx, keyString, recId, dupsAllowed);
+ return _insert(opCtx, keyString, dupsAllowed);
}
template <typename ValueType>
@@ -107,10 +106,8 @@ Status MobileIndex::doInsert(OperationContext* opCtx,
void MobileIndex::unindex(OperationContext* opCtx,
const KeyString::Value& keyString,
- const RecordId& recId,
bool dupsAllowed) {
- invariant(recId.isValid());
- _unindex(opCtx, keyString, recId, dupsAllowed);
+ _unindex(opCtx, keyString, dupsAllowed);
}
void MobileIndex::_doDelete(OperationContext* opCtx,
@@ -326,9 +323,8 @@ public:
protected:
Status _addKey(const KeyString::Value& keyString) override {
- dassert(
- KeyString::decodeRecordIdAtEnd(keyString.getBuffer(), keyString.getSize()).isValid());
RecordId recId = KeyString::decodeRecordIdAtEnd(keyString.getBuffer(), keyString.getSize());
+ invariant(recId.isValid());
KeyString::Builder value(_index->getKeyStringVersion(), recId);
KeyString::TypeBits typeBits = keyString.getTypeBits();
@@ -703,10 +699,9 @@ std::unique_ptr<SortedDataInterface::Cursor> MobileIndexStandard::newCursor(Oper
Status MobileIndexStandard::_insert(OperationContext* opCtx,
const KeyString::Value& keyString,
- const RecordId& recId,
bool dupsAllowed) {
invariant(dupsAllowed);
- dassert(recId == KeyString::decodeRecordIdAtEnd(keyString.getBuffer(), keyString.getSize()));
+ dassert(KeyString::decodeRecordIdAtEnd(keyString.getBuffer(), keyString.getSize()).isValid());
const KeyString::TypeBits typeBits = keyString.getTypeBits();
return doInsert(opCtx, keyString.getBuffer(), keyString.getSize(), typeBits, typeBits);
@@ -714,9 +709,9 @@ Status MobileIndexStandard::_insert(OperationContext* opCtx,
void MobileIndexStandard::_unindex(OperationContext* opCtx,
const KeyString::Value& keyString,
- const RecordId&,
bool dupsAllowed) {
invariant(dupsAllowed);
+ dassert(KeyString::decodeRecordIdAtEnd(keyString.getBuffer(), keyString.getSize()).isValid());
_doDelete(opCtx, keyString.getBuffer(), keyString.getSize());
}
@@ -741,13 +736,12 @@ std::unique_ptr<SortedDataInterface::Cursor> MobileIndexUnique::newCursor(Operat
Status MobileIndexUnique::_insert(OperationContext* opCtx,
const KeyString::Value& keyString,
- const RecordId& recId,
bool dupsAllowed) {
// Replication is not supported so dups are not allowed.
invariant(!dupsAllowed);
+ RecordId recId = KeyString::decodeRecordIdAtEnd(keyString.getBuffer(), keyString.getSize());
invariant(recId.isValid());
- dassert(recId == KeyString::decodeRecordIdAtEnd(keyString.getBuffer(), keyString.getSize()));
KeyString::Builder value(_keyStringVersion, recId);
KeyString::TypeBits typeBits = keyString.getTypeBits();
@@ -763,7 +757,6 @@ Status MobileIndexUnique::_insert(OperationContext* opCtx,
void MobileIndexUnique::_unindex(OperationContext* opCtx,
const KeyString::Value& keyString,
- const RecordId& recId,
bool dupsAllowed) {
// Replication is not supported so dups are not allowed.
invariant(!dupsAllowed);
@@ -773,9 +766,8 @@ void MobileIndexUnique::_unindex(OperationContext* opCtx,
auto sizeWithoutRecordId =
KeyString::sizeWithoutRecordIdAtEnd(keyString.getBuffer(), keyString.getSize());
if (_isPartial) {
+ RecordId recId = KeyString::decodeRecordIdAtEnd(keyString.getBuffer(), keyString.getSize());
invariant(recId.isValid());
- dassert(recId ==
- KeyString::decodeRecordIdAtEnd(keyString.getBuffer(), keyString.getSize()));
KeyString::Builder value(_keyStringVersion, recId);
KeyString::TypeBits typeBits = keyString.getTypeBits();
diff --git a/src/mongo/db/storage/mobile/mobile_index.h b/src/mongo/db/storage/mobile/mobile_index.h
index 44e726cdfd7..cbea32d200d 100644
--- a/src/mongo/db/storage/mobile/mobile_index.h
+++ b/src/mongo/db/storage/mobile/mobile_index.h
@@ -54,12 +54,10 @@ public:
Status insert(OperationContext* opCtx,
const KeyString::Value& keyString,
- const RecordId& recId,
bool dupsAllowed) override;
void unindex(OperationContext* opCtx,
const KeyString::Value& keyString,
- const RecordId& recId,
bool dupsAllowed) override;
void fullValidate(OperationContext* opCtx,
@@ -119,12 +117,10 @@ protected:
virtual Status _insert(OperationContext* opCtx,
const KeyString::Value& keyString,
- const RecordId& recId,
bool dupsAllowed) = 0;
virtual void _unindex(OperationContext* opCtx,
const KeyString::Value& keyString,
- const RecordId& recId,
bool dupsAllowed) = 0;
class BulkBuilderBase;
@@ -153,12 +149,10 @@ public:
protected:
Status _insert(OperationContext* opCtx,
const KeyString::Value& keyString,
- const RecordId& recId,
bool dupsAllowed) override;
void _unindex(OperationContext* opCtx,
const KeyString::Value& keyString,
- const RecordId& recId,
bool dupsAllowed) override;
};
@@ -176,12 +170,10 @@ public:
protected:
Status _insert(OperationContext* opCtx,
const KeyString::Value& keyString,
- const RecordId& recId,
bool dupsAllowed) override;
void _unindex(OperationContext* opCtx,
const KeyString::Value& keyString,
- const RecordId& recId,
bool dupsAllowed) override;
const bool _isPartial = false;
diff --git a/src/mongo/db/storage/sorted_data_interface.h b/src/mongo/db/storage/sorted_data_interface.h
index 28326398ee1..024fef895c7 100644
--- a/src/mongo/db/storage/sorted_data_interface.h
+++ b/src/mongo/db/storage/sorted_data_interface.h
@@ -78,7 +78,8 @@ public:
bool dupsAllowed) = 0;
/**
- * Insert an entry into the index with the specified KeyString and RecordId.
+ * Insert an entry into the index with the specified KeyString, which must have a RecordId
+ * appended to the end.
*
* @param opCtx the transaction under which the insert takes place
* @param dupsAllowed true if duplicate keys are allowed, and false
@@ -91,11 +92,11 @@ public:
*/
virtual Status insert(OperationContext* opCtx,
const KeyString::Value& keyString,
- const RecordId& loc,
bool dupsAllowed) = 0;
/**
- * Remove the entry from the index with the specified KeyString and RecordId.
+ * Remove the entry from the index with the specified KeyString, which must have a RecordId
+ * appended to the end.
*
* @param opCtx the transaction under which the remove takes place
* @param dupsAllowed true if duplicate keys are allowed, and false
@@ -103,7 +104,6 @@ public:
*/
virtual void unindex(OperationContext* opCtx,
const KeyString::Value& keyString,
- const RecordId& loc,
bool dupsAllowed) = 0;
/**
diff --git a/src/mongo/db/storage/sorted_data_interface_test_cursor.cpp b/src/mongo/db/storage/sorted_data_interface_test_cursor.cpp
index 285ddc15a91..5bfc4467950 100644
--- a/src/mongo/db/storage/sorted_data_interface_test_cursor.cpp
+++ b/src/mongo/db/storage/sorted_data_interface_test_cursor.cpp
@@ -103,8 +103,7 @@ TEST(SortedDataInterface, ExhaustCursor) {
WriteUnitOfWork uow(opCtx.get());
BSONObj key = BSON("" << i);
RecordId loc(42, i * 2);
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key, loc), loc, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key, loc), true));
uow.commit();
}
}
@@ -149,8 +148,7 @@ TEST(SortedDataInterface, ExhaustCursorReversed) {
WriteUnitOfWork uow(opCtx.get());
BSONObj key = BSON("" << i);
RecordId loc(42, i * 2);
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key, loc), loc, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key, loc), true));
uow.commit();
}
}
@@ -190,7 +188,7 @@ void testBoundaries(bool unique, bool forward, bool inclusive) {
WriteUnitOfWork uow(opCtx.get());
BSONObj key = BSON("" << i);
RecordId loc(42 + i * 2);
- ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key, loc), loc, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key, loc), true));
uow.commit();
}
diff --git a/src/mongo/db/storage/sorted_data_interface_test_cursor_advanceto.cpp b/src/mongo/db/storage/sorted_data_interface_test_cursor_advanceto.cpp
index dedcd266c05..be6870c6c37 100644
--- a/src/mongo/db/storage/sorted_data_interface_test_cursor_advanceto.cpp
+++ b/src/mongo/db/storage/sorted_data_interface_test_cursor_advanceto.cpp
@@ -56,20 +56,13 @@ TEST(SortedDataInterface, AdvanceTo) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true));
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), key1, loc2),
- loc2,
- true /* allow duplicates */));
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), key1, loc3),
- loc3,
- true /* allow duplicates */));
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc4), loc4, true));
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc5), loc5, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), key1, loc2), true /* allow duplicates */));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), key1, loc3), true /* allow duplicates */));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc4), true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc5), true));
uow.commit();
}
}
@@ -130,20 +123,13 @@ TEST(SortedDataInterface, AdvanceToReversed) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true));
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc2), loc2, true));
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc3), loc3, true));
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), key3, loc4),
- loc4,
- true /* allow duplicates */));
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), key3, loc5),
- loc5,
- true /* allow duplicates */));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc2), true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc3), true));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), key3, loc4), true /* allow duplicates */));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), key3, loc5), true /* allow duplicates */));
uow.commit();
}
}
@@ -204,10 +190,8 @@ TEST(SortedDataInterface, AdvanceToKeyBeforeCursorPosition) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true));
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc2), loc2, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc2), true));
uow.commit();
}
}
@@ -256,10 +240,8 @@ TEST(SortedDataInterface, AdvanceToKeyAfterCursorPositionReversed) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true));
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc2), loc2, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc2), true));
uow.commit();
}
}
@@ -312,8 +294,7 @@ TEST(SortedDataInterface, AdvanceToKeyAtCursorPosition) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true));
uow.commit();
}
}
@@ -364,8 +345,7 @@ TEST(SortedDataInterface, AdvanceToKeyAtCursorPositionReversed) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true));
uow.commit();
}
}
@@ -417,20 +397,13 @@ TEST(SortedDataInterface, AdvanceToExclusive) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true));
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), key1, loc2),
- loc2,
- true /* allow duplicates */));
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), key1, loc3),
- loc3,
- true /* allow duplicates */));
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc4), loc4, true));
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc5), loc5, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), key1, loc2), true /* allow duplicates */));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), key1, loc3), true /* allow duplicates */));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc4), true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc5), true));
uow.commit();
}
}
@@ -490,20 +463,13 @@ TEST(SortedDataInterface, AdvanceToExclusiveReversed) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true));
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc2), loc2, true));
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc3), loc3, true));
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), key3, loc4),
- loc4,
- true /* allow duplicates */));
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), key3, loc5),
- loc5,
- true /* allow duplicates */));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc2), true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc3), true));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), key3, loc4), true /* allow duplicates */));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), key3, loc5), true /* allow duplicates */));
uow.commit();
}
}
@@ -566,12 +532,9 @@ TEST(SortedDataInterface, AdvanceToIndirect) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true));
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc2), loc2, true));
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key5, loc3), loc3, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc2), true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key5, loc3), true));
uow.commit();
}
}
@@ -625,12 +588,9 @@ TEST(SortedDataInterface, AdvanceToIndirectReversed) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true));
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc2), loc2, true));
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key5, loc3), loc3, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc2), true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key5, loc3), true));
uow.commit();
}
}
@@ -687,12 +647,9 @@ TEST(SortedDataInterface, AdvanceToIndirectExclusive) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true));
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc2), loc2, true));
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key5, loc3), loc3, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc2), true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key5, loc3), true));
uow.commit();
}
}
@@ -756,12 +713,9 @@ TEST(SortedDataInterface, AdvanceToIndirectExclusiveReversed) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true));
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc2), loc2, true));
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key5, loc3), loc3, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc2), true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key5, loc3), true));
uow.commit();
}
}
diff --git a/src/mongo/db/storage/sorted_data_interface_test_cursor_locate.cpp b/src/mongo/db/storage/sorted_data_interface_test_cursor_locate.cpp
index fe444b2e81a..04ea721fcdc 100644
--- a/src/mongo/db/storage/sorted_data_interface_test_cursor_locate.cpp
+++ b/src/mongo/db/storage/sorted_data_interface_test_cursor_locate.cpp
@@ -55,8 +55,7 @@ TEST(SortedDataInterface, Locate) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true));
uow.commit();
}
}
@@ -89,8 +88,7 @@ TEST(SortedDataInterface, LocateReversed) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true));
uow.commit();
}
}
@@ -124,7 +122,7 @@ TEST(SortedDataInterface, LocateCompoundKey) {
{
WriteUnitOfWork uow(opCtx.get());
ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), compoundKey1a, loc1), loc1, true));
+ opCtx.get(), makeKeyString(sorted.get(), compoundKey1a, loc1), true));
uow.commit();
}
}
@@ -158,7 +156,7 @@ TEST(SortedDataInterface, LocateCompoundKeyReversed) {
{
WriteUnitOfWork uow(opCtx.get());
ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), compoundKey1a, loc1), loc1, true));
+ opCtx.get(), makeKeyString(sorted.get(), compoundKey1a, loc1), true));
uow.commit();
}
}
@@ -191,10 +189,8 @@ TEST(SortedDataInterface, LocateMultiple) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true));
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc2), loc2, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc2), true));
uow.commit();
}
}
@@ -213,8 +209,7 @@ TEST(SortedDataInterface, LocateMultiple) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc3), loc3, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc3), true));
uow.commit();
}
}
@@ -254,10 +249,8 @@ TEST(SortedDataInterface, LocateMultipleReversed) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true));
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc2), loc2, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc2), true));
uow.commit();
}
}
@@ -277,8 +270,7 @@ TEST(SortedDataInterface, LocateMultipleReversed) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc3), loc3, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc3), true));
uow.commit();
}
}
@@ -319,11 +311,11 @@ TEST(SortedDataInterface, LocateMultipleCompoundKeys) {
{
WriteUnitOfWork uow(opCtx.get());
ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), compoundKey1a, loc1), loc1, true));
+ opCtx.get(), makeKeyString(sorted.get(), compoundKey1a, loc1), true));
ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), compoundKey1b, loc2), loc2, true));
+ opCtx.get(), makeKeyString(sorted.get(), compoundKey1b, loc2), true));
ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), compoundKey2b, loc3), loc3, true));
+ opCtx.get(), makeKeyString(sorted.get(), compoundKey2b, loc3), true));
uow.commit();
}
}
@@ -344,9 +336,9 @@ TEST(SortedDataInterface, LocateMultipleCompoundKeys) {
{
WriteUnitOfWork uow(opCtx.get());
ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), compoundKey1c, loc4), loc4, true));
+ opCtx.get(), makeKeyString(sorted.get(), compoundKey1c, loc4), true));
ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), compoundKey3a, loc5), loc5, true));
+ opCtx.get(), makeKeyString(sorted.get(), compoundKey3a, loc5), true));
uow.commit();
}
}
@@ -384,11 +376,11 @@ TEST(SortedDataInterface, LocateMultipleCompoundKeysReversed) {
{
WriteUnitOfWork uow(opCtx.get());
ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), compoundKey1a, loc1), loc1, true));
+ opCtx.get(), makeKeyString(sorted.get(), compoundKey1a, loc1), true));
ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), compoundKey1b, loc2), loc2, true));
+ opCtx.get(), makeKeyString(sorted.get(), compoundKey1b, loc2), true));
ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), compoundKey2b, loc3), loc3, true));
+ opCtx.get(), makeKeyString(sorted.get(), compoundKey2b, loc3), true));
uow.commit();
}
}
@@ -410,9 +402,9 @@ TEST(SortedDataInterface, LocateMultipleCompoundKeysReversed) {
{
WriteUnitOfWork uow(opCtx.get());
ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), compoundKey1c, loc4), loc4, true));
+ opCtx.get(), makeKeyString(sorted.get(), compoundKey1c, loc4), true));
ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), compoundKey3a, loc5), loc5, true));
+ opCtx.get(), makeKeyString(sorted.get(), compoundKey3a, loc5), true));
uow.commit();
}
}
@@ -449,10 +441,8 @@ TEST(SortedDataInterface, LocateIndirect) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true));
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc2), loc2, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc2), true));
uow.commit();
}
}
@@ -470,8 +460,7 @@ TEST(SortedDataInterface, LocateIndirect) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc3), loc3, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc3), true));
uow.commit();
}
}
@@ -506,10 +495,8 @@ TEST(SortedDataInterface, LocateIndirectReversed) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true));
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc2), loc2, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc2), true));
uow.commit();
}
}
@@ -528,8 +515,7 @@ TEST(SortedDataInterface, LocateIndirectReversed) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc3), loc3, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc3), true));
uow.commit();
}
}
@@ -565,11 +551,11 @@ TEST(SortedDataInterface, LocateIndirectCompoundKeys) {
{
WriteUnitOfWork uow(opCtx.get());
ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), compoundKey1a, loc1), loc1, true));
+ opCtx.get(), makeKeyString(sorted.get(), compoundKey1a, loc1), true));
ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), compoundKey1b, loc2), loc2, true));
+ opCtx.get(), makeKeyString(sorted.get(), compoundKey1b, loc2), true));
ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), compoundKey2b, loc3), loc3, true));
+ opCtx.get(), makeKeyString(sorted.get(), compoundKey2b, loc3), true));
uow.commit();
}
}
@@ -589,9 +575,9 @@ TEST(SortedDataInterface, LocateIndirectCompoundKeys) {
{
WriteUnitOfWork uow(opCtx.get());
ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), compoundKey1c, loc4), loc4, true));
+ opCtx.get(), makeKeyString(sorted.get(), compoundKey1c, loc4), true));
ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), compoundKey3a, loc5), loc5, true));
+ opCtx.get(), makeKeyString(sorted.get(), compoundKey3a, loc5), true));
uow.commit();
}
}
@@ -626,11 +612,11 @@ TEST(SortedDataInterface, LocateIndirectCompoundKeysReversed) {
{
WriteUnitOfWork uow(opCtx.get());
ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), compoundKey1a, loc1), loc1, true));
+ opCtx.get(), makeKeyString(sorted.get(), compoundKey1a, loc1), true));
ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), compoundKey1b, loc2), loc2, true));
+ opCtx.get(), makeKeyString(sorted.get(), compoundKey1b, loc2), true));
ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), compoundKey2b, loc3), loc3, true));
+ opCtx.get(), makeKeyString(sorted.get(), compoundKey2b, loc3), true));
uow.commit();
}
}
@@ -651,9 +637,9 @@ TEST(SortedDataInterface, LocateIndirectCompoundKeysReversed) {
{
WriteUnitOfWork uow(opCtx.get());
ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), compoundKey1c, loc4), loc4, true));
+ opCtx.get(), makeKeyString(sorted.get(), compoundKey1c, loc4), true));
ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), compoundKey3a, loc5), loc5, true));
+ opCtx.get(), makeKeyString(sorted.get(), compoundKey3a, loc5), true));
uow.commit();
}
}
diff --git a/src/mongo/db/storage/sorted_data_interface_test_cursor_saverestore.cpp b/src/mongo/db/storage/sorted_data_interface_test_cursor_saverestore.cpp
index 4f622306e1b..e0b78b2ff2f 100644
--- a/src/mongo/db/storage/sorted_data_interface_test_cursor_saverestore.cpp
+++ b/src/mongo/db/storage/sorted_data_interface_test_cursor_saverestore.cpp
@@ -59,8 +59,7 @@ TEST(SortedDataInterface, SaveAndRestorePositionWhileIterateCursor) {
WriteUnitOfWork uow(opCtx.get());
BSONObj key = BSON("" << i);
RecordId loc(42, i * 2);
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key, loc), loc, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key, loc), true));
uow.commit();
}
}
@@ -108,8 +107,7 @@ TEST(SortedDataInterface, SaveAndRestorePositionWhileIterateCursorReversed) {
WriteUnitOfWork uow(opCtx.get());
BSONObj key = BSON("" << i);
RecordId loc(42, i * 2);
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key, loc), loc, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key, loc), true));
uow.commit();
}
}
@@ -158,8 +156,7 @@ TEST(SortedDataInterface, SaveAndRestorePositionWhileIterateCursorOnIdIndex) {
WriteUnitOfWork uow(opCtx.get());
BSONObj key = BSON("" << i);
RecordId loc(42, i * 2);
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key, loc), loc, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key, loc), true));
uow.commit();
}
}
@@ -208,8 +205,7 @@ TEST(SortedDataInterface, SaveAndRestorePositionWhileIterateCursorReversedOnIdIn
WriteUnitOfWork uow(opCtx.get());
BSONObj key = BSON("" << i);
RecordId loc(42, i * 2);
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key, loc), loc, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key, loc), true));
uow.commit();
}
}
@@ -259,10 +255,8 @@ TEST(SortedDataInterface, SaveAndRestorePositionWhileIterateCursorWithDupKeys) {
{
WriteUnitOfWork uow(opCtx.get());
RecordId loc(42, i * 2);
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), key1, loc),
- loc,
- true /* allow duplicates */));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), key1, loc), true /* allow duplicates */));
uow.commit();
}
}
@@ -310,10 +304,8 @@ TEST(SortedDataInterface, SaveAndRestorePositionWhileIterateCursorWithDupKeysRev
{
WriteUnitOfWork uow(opCtx.get());
RecordId loc(42, i * 2);
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), key1, loc),
- loc,
- true /* allow duplicates */));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), key1, loc), true /* allow duplicates */));
uow.commit();
}
}
@@ -359,8 +351,7 @@ TEST(SortedDataInterface, SavePositionWithoutRestore) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, false));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), false));
uow.commit();
}
}
@@ -393,8 +384,7 @@ TEST(SortedDataInterface, SavePositionWithoutRestoreReversed) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true));
uow.commit();
}
}
diff --git a/src/mongo/db/storage/sorted_data_interface_test_dupkeycheck.cpp b/src/mongo/db/storage/sorted_data_interface_test_dupkeycheck.cpp
index 3e5634eabf4..c7d503b50d4 100644
--- a/src/mongo/db/storage/sorted_data_interface_test_dupkeycheck.cpp
+++ b/src/mongo/db/storage/sorted_data_interface_test_dupkeycheck.cpp
@@ -54,8 +54,7 @@ TEST(SortedDataInterface, DupKeyCheckAfterInsert) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, false));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), false));
uow.commit();
}
}
@@ -95,7 +94,7 @@ TEST(SortedDataInterface, DupKeyCheckAfterInsertKeyString) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(opCtx.get(), keyString1, loc1, false));
+ ASSERT_OK(sorted->insert(opCtx.get(), keyString1, false));
uow.commit();
}
}
@@ -165,8 +164,7 @@ TEST(SortedDataInterface, DupKeyCheckWhenDiskLocBefore) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true));
uow.commit();
}
}
@@ -202,8 +200,7 @@ TEST(SortedDataInterface, DupKeyCheckWhenDiskLocAfter) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true));
uow.commit();
}
}
@@ -233,8 +230,8 @@ TEST(SortedDataInterface, DupKeyCheckWithDuplicates) {
ASSERT(sorted->isEmpty(opCtx.get()));
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true));
- ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc2), loc2, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc2), true));
uow.commit();
}
@@ -259,8 +256,8 @@ TEST(SortedDataInterface, DupKeyCheckWithDuplicateKeyStrings) {
ASSERT(sorted->isEmpty(opCtx.get()));
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(opCtx.get(), keyString1, loc1, true));
- ASSERT_OK(sorted->insert(opCtx.get(), keyString2, loc2, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), keyString1, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), keyString2, true));
uow.commit();
}
@@ -281,15 +278,15 @@ TEST(SortedDataInterface, DupKeyCheckWithDeletedFirstEntry) {
ASSERT(sorted->isEmpty(opCtx.get()));
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true));
- ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc2), loc2, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc2), true));
uow.commit();
}
{
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
WriteUnitOfWork uow(opCtx.get());
- sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true);
+ sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true);
uow.commit();
}
@@ -310,15 +307,15 @@ TEST(SortedDataInterface, DupKeyCheckWithDeletedSecondEntry) {
ASSERT(sorted->isEmpty(opCtx.get()));
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true));
- ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc2), loc2, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc2), true));
uow.commit();
}
{
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
WriteUnitOfWork uow(opCtx.get());
- sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key1, loc2), loc2, true);
+ sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key1, loc2), true);
uow.commit();
}
{
diff --git a/src/mongo/db/storage/sorted_data_interface_test_fullvalidate.cpp b/src/mongo/db/storage/sorted_data_interface_test_fullvalidate.cpp
index ea8a161a3a7..5ff70409863 100644
--- a/src/mongo/db/storage/sorted_data_interface_test_fullvalidate.cpp
+++ b/src/mongo/db/storage/sorted_data_interface_test_fullvalidate.cpp
@@ -56,8 +56,7 @@ TEST(SortedDataInterface, FullValidate) {
WriteUnitOfWork uow(opCtx.get());
BSONObj key = BSON("" << i);
RecordId loc(42, i * 2);
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key, loc), loc, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key, loc), true));
uow.commit();
}
}
diff --git a/src/mongo/db/storage/sorted_data_interface_test_harness.cpp b/src/mongo/db/storage/sorted_data_interface_test_harness.cpp
index 38e2b77a0a7..c199a86f270 100644
--- a/src/mongo/db/storage/sorted_data_interface_test_harness.cpp
+++ b/src/mongo/db/storage/sorted_data_interface_test_harness.cpp
@@ -51,8 +51,7 @@ void mongo::insertToIndex(unowned_ptr<OperationContext> opCtx,
std::initializer_list<IndexKeyEntry> toInsert) {
WriteUnitOfWork wuow(opCtx);
for (auto&& entry : toInsert) {
- ASSERT_OK(index->insert(
- opCtx, makeKeyString(index.get(), entry.key, entry.loc), entry.loc, true));
+ ASSERT_OK(index->insert(opCtx, makeKeyString(index.get(), entry.key, entry.loc), true));
}
wuow.commit();
}
@@ -62,7 +61,7 @@ void mongo::removeFromIndex(unowned_ptr<OperationContext> opCtx,
std::initializer_list<IndexKeyEntry> toRemove) {
WriteUnitOfWork wuow(opCtx);
for (auto&& entry : toRemove) {
- index->unindex(opCtx, makeKeyString(index.get(), entry.key, entry.loc), entry.loc, true);
+ index->unindex(opCtx, makeKeyString(index.get(), entry.key, entry.loc), true);
}
wuow.commit();
}
@@ -102,10 +101,8 @@ TEST(SortedDataInterface, InsertWithDups1) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), BSON("" << 1), RecordId(5, 2)),
- RecordId(5, 2),
- true));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), BSON("" << 1), RecordId(5, 2)), true));
uow.commit();
}
}
@@ -114,10 +111,8 @@ TEST(SortedDataInterface, InsertWithDups1) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), BSON("" << 1), RecordId(6, 2)),
- RecordId(6, 2),
- true));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), BSON("" << 1), RecordId(6, 2)), true));
uow.commit();
}
}
@@ -141,10 +136,8 @@ TEST(SortedDataInterface, InsertWithDups2) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), BSON("" << 1), RecordId(5, 18)),
- RecordId(5, 18),
- true));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), BSON("" << 1), RecordId(5, 18)), true));
uow.commit();
}
}
@@ -153,10 +146,8 @@ TEST(SortedDataInterface, InsertWithDups2) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), BSON("" << 1), RecordId(5, 20)),
- RecordId(5, 20),
- true));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), BSON("" << 1), RecordId(5, 20)), true));
uow.commit();
}
}
@@ -176,10 +167,8 @@ TEST(SortedDataInterface, InsertWithDups3AndRollback) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), BSON("" << 1), RecordId(5, 18)),
- RecordId(5, 18),
- true));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), BSON("" << 1), RecordId(5, 18)), true));
uow.commit();
}
}
@@ -188,10 +177,8 @@ TEST(SortedDataInterface, InsertWithDups3AndRollback) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), BSON("" << 1), RecordId(5, 20)),
- RecordId(5, 20),
- true));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), BSON("" << 1), RecordId(5, 20)), true));
// no commit
}
}
@@ -211,10 +198,8 @@ TEST(SortedDataInterface, InsertNoDups1) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), BSON("" << 1), RecordId(5, 18)),
- RecordId(5, 18),
- false));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), BSON("" << 1), RecordId(5, 18)), false));
uow.commit();
}
}
@@ -223,10 +208,8 @@ TEST(SortedDataInterface, InsertNoDups1) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), BSON("" << 2), RecordId(5, 20)),
- RecordId(5, 20),
- false));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), BSON("" << 2), RecordId(5, 20)), false));
uow.commit();
}
}
@@ -246,10 +229,8 @@ TEST(SortedDataInterface, InsertNoDups2) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), BSON("" << 1), RecordId(5, 2)),
- RecordId(5, 2),
- false));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), BSON("" << 1), RecordId(5, 2)), false));
uow.commit();
}
}
@@ -258,10 +239,8 @@ TEST(SortedDataInterface, InsertNoDups2) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_NOT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), BSON("" << 1), RecordId(5, 4)),
- RecordId(5, 4),
- false));
+ ASSERT_NOT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), BSON("" << 1), RecordId(5, 4)), false));
uow.commit();
}
}
@@ -281,10 +260,8 @@ TEST(SortedDataInterface, Unindex1) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), BSON("" << 1), RecordId(5, 18)),
- RecordId(5, 18),
- true));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), BSON("" << 1), RecordId(5, 18)), true));
uow.commit();
}
}
@@ -298,10 +275,8 @@ TEST(SortedDataInterface, Unindex1) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- sorted->unindex(opCtx.get(),
- makeKeyString(sorted.get(), BSON("" << 1), RecordId(5, 20)),
- RecordId(5, 20),
- true);
+ sorted->unindex(
+ opCtx.get(), makeKeyString(sorted.get(), BSON("" << 1), RecordId(5, 20)), true);
ASSERT_EQUALS(1, sorted->numEntries(opCtx.get()));
uow.commit();
}
@@ -316,10 +291,8 @@ TEST(SortedDataInterface, Unindex1) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- sorted->unindex(opCtx.get(),
- makeKeyString(sorted.get(), BSON("" << 2), RecordId(5, 18)),
- RecordId(5, 18),
- true);
+ sorted->unindex(
+ opCtx.get(), makeKeyString(sorted.get(), BSON("" << 2), RecordId(5, 18)), true);
ASSERT_EQUALS(1, sorted->numEntries(opCtx.get()));
uow.commit();
}
@@ -335,10 +308,8 @@ TEST(SortedDataInterface, Unindex1) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- sorted->unindex(opCtx.get(),
- makeKeyString(sorted.get(), BSON("" << 1), RecordId(5, 18)),
- RecordId(5, 18),
- true);
+ sorted->unindex(
+ opCtx.get(), makeKeyString(sorted.get(), BSON("" << 1), RecordId(5, 18)), true);
ASSERT(sorted->isEmpty(opCtx.get()));
uow.commit();
}
@@ -359,10 +330,8 @@ TEST(SortedDataInterface, Unindex2Rollback) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), BSON("" << 1), RecordId(5, 18)),
- RecordId(5, 18),
- true));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), BSON("" << 1), RecordId(5, 18)), true));
uow.commit();
}
}
@@ -376,10 +345,8 @@ TEST(SortedDataInterface, Unindex2Rollback) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- sorted->unindex(opCtx.get(),
- makeKeyString(sorted.get(), BSON("" << 1), RecordId(5, 18)),
- RecordId(5, 18),
- true);
+ sorted->unindex(
+ opCtx.get(), makeKeyString(sorted.get(), BSON("" << 1), RecordId(5, 18)), true);
ASSERT(sorted->isEmpty(opCtx.get()));
// no commit
}
@@ -402,10 +369,8 @@ TEST(SortedDataInterface, CursorIterate1) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), BSON("" << i), RecordId(5, i * 2)),
- RecordId(5, i * 2),
- true));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), BSON("" << i), RecordId(5, i * 2)), true));
uow.commit();
}
}
@@ -434,10 +399,8 @@ TEST(SortedDataInterface, CursorIterate1WithSaveRestore) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), BSON("" << i), RecordId(5, i * 2)),
- RecordId(5, i * 2),
- true));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), BSON("" << i), RecordId(5, i * 2)), true));
uow.commit();
}
}
@@ -469,10 +432,8 @@ TEST(SortedDataInterface, CursorIterateAllDupKeysWithSaveRestore) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), BSON("" << 5), RecordId(5, i * 2)),
- RecordId(5, i * 2),
- true));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), BSON("" << 5), RecordId(5, i * 2)), true));
uow.commit();
}
}
@@ -512,8 +473,7 @@ TEST(SortedDataInterface, Locate1) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key, loc), loc, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key, loc), true));
uow.commit();
}
}
@@ -536,18 +496,12 @@ TEST(SortedDataInterface, Locate2) {
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), BSON("" << 1), RecordId(1, 2)),
- RecordId(1, 2),
- true));
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), BSON("" << 2), RecordId(1, 4)),
- RecordId(1, 4),
- true));
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), BSON("" << 3), RecordId(1, 6)),
- RecordId(1, 6),
- true));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), BSON("" << 1), RecordId(1, 2)), true));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), BSON("" << 2), RecordId(1, 4)), true));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), BSON("" << 3), RecordId(1, 6)), true));
uow.commit();
}
}
@@ -573,18 +527,12 @@ TEST(SortedDataInterface, Locate2Empty) {
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), BSON("" << 1), RecordId(1, 2)),
- RecordId(1, 2),
- true));
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), BSON("" << 2), RecordId(1, 4)),
- RecordId(1, 4),
- true));
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), BSON("" << 3), RecordId(1, 6)),
- RecordId(1, 6),
- true));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), BSON("" << 1), RecordId(1, 2)), true));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), BSON("" << 2), RecordId(1, 4)), true));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), BSON("" << 3), RecordId(1, 6)), true));
uow.commit();
}
}
@@ -621,7 +569,7 @@ TEST(SortedDataInterface, Locate3Descending) {
WriteUnitOfWork uow(opCtx.get());
auto entry = buildEntry(i);
ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), entry.key, entry.loc), entry.loc, true));
+ opCtx.get(), makeKeyString(sorted.get(), entry.key, entry.loc), true));
uow.commit();
}
}
diff --git a/src/mongo/db/storage/sorted_data_interface_test_insert.cpp b/src/mongo/db/storage/sorted_data_interface_test_insert.cpp
index 784ee673a03..8ee6f4732db 100644
--- a/src/mongo/db/storage/sorted_data_interface_test_insert.cpp
+++ b/src/mongo/db/storage/sorted_data_interface_test_insert.cpp
@@ -53,8 +53,7 @@ TEST(SortedDataInterface, Insert) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true));
uow.commit();
}
}
@@ -86,7 +85,7 @@ TEST(SortedDataInterface, InsertKeyString) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(opCtx.get(), keyString1, loc1, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), keyString1, true));
uow.commit();
}
}
@@ -117,7 +116,7 @@ TEST(SortedDataInterface, InsertCompoundKey) {
{
WriteUnitOfWork uow(opCtx.get());
ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), compoundKey1a, loc1), loc1, true));
+ opCtx.get(), makeKeyString(sorted.get(), compoundKey1a, loc1), true));
uow.commit();
}
}
@@ -145,10 +144,8 @@ TEST(SortedDataInterface, InsertSameDiskLoc) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true));
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc1), loc1, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc1), true));
uow.commit();
}
}
@@ -162,8 +159,7 @@ TEST(SortedDataInterface, InsertSameDiskLoc) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc1), loc1, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc1), true));
uow.commit();
}
}
@@ -191,12 +187,9 @@ TEST(SortedDataInterface, InsertSameDiskLocWithDupsAllowed) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, false));
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), key2, loc1),
- loc1,
- true /* allow duplicates */));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), false));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), key2, loc1), true /* allow duplicates */));
uow.commit();
}
}
@@ -210,10 +203,8 @@ TEST(SortedDataInterface, InsertSameDiskLocWithDupsAllowed) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), key3, loc1),
- loc1,
- true /* allow duplicates */));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), key3, loc1), true /* allow duplicates */));
uow.commit();
}
}
@@ -240,10 +231,9 @@ TEST(SortedDataInterface, InsertSameKey) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, false));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), false));
ASSERT_NOT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc2), loc2, false));
+ sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc2), false));
uow.commit();
}
}
@@ -262,7 +252,7 @@ TEST(SortedDataInterface, InsertSameKey) {
{
WriteUnitOfWork uow(opCtx.get());
ASSERT_NOT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc2), loc2, false));
+ sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc2), false));
uow.commit();
}
}
@@ -300,8 +290,8 @@ TEST(SortedDataInterface, InsertSameKeyString) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(opCtx.get(), keyStringLoc1.getValueCopy(), loc1, false));
- ASSERT_NOT_OK(sorted->insert(opCtx.get(), keyStringLoc2.getValueCopy(), loc2, false));
+ ASSERT_OK(sorted->insert(opCtx.get(), keyStringLoc1.getValueCopy(), false));
+ ASSERT_NOT_OK(sorted->insert(opCtx.get(), keyStringLoc2.getValueCopy(), false));
uow.commit();
}
}
@@ -319,7 +309,7 @@ TEST(SortedDataInterface, InsertSameKeyString) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_NOT_OK(sorted->insert(opCtx.get(), keyStringLoc2.getValueCopy(), loc2, false));
+ ASSERT_NOT_OK(sorted->insert(opCtx.get(), keyStringLoc2.getValueCopy(), false));
uow.commit();
}
}
@@ -357,12 +347,12 @@ void _testInsertSameKeyWithDupsAllowed(const RecordId locs[3]) {
harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), key1, locs[0]), locs[0], false));
- ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), key1, locs[1]), locs[1], true));
- ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), key1, locs[2]), locs[2], true));
+ ASSERT_OK(
+ sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, locs[0]), false));
+ ASSERT_OK(
+ sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, locs[1]), true));
+ ASSERT_OK(
+ sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, locs[2]), true));
uow.commit();
}
}
@@ -375,7 +365,7 @@ void _testInsertSameKeyWithDupsAllowed(const RecordId locs[3]) {
for (int i = 0; i < 3; i++) {
if (i != keeper) {
sorted->unindex(
- opCtx.get(), makeKeyString(sorted.get(), key1, locs[i]), locs[i], true);
+ opCtx.get(), makeKeyString(sorted.get(), key1, locs[i]), true);
}
}
uow.commit();
@@ -423,10 +413,8 @@ TEST(SortedDataInterface, InsertMultiple) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, false));
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc2), loc2, false));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), false));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc2), false));
uow.commit();
}
}
@@ -446,8 +434,7 @@ TEST(SortedDataInterface, InsertMultiple) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc3), loc3, false));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc3), false));
uow.commit();
}
}
@@ -488,8 +475,8 @@ TEST(SortedDataInterface, InsertMultipleKeyStrings) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(opCtx.get(), keyString1, loc1, false));
- ASSERT_OK(sorted->insert(opCtx.get(), keyString2, loc2, false));
+ ASSERT_OK(sorted->insert(opCtx.get(), keyString1, false));
+ ASSERT_OK(sorted->insert(opCtx.get(), keyString2, false));
uow.commit();
}
}
@@ -509,7 +496,7 @@ TEST(SortedDataInterface, InsertMultipleKeyStrings) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(opCtx.get(), keyString3, loc3, false));
+ ASSERT_OK(sorted->insert(opCtx.get(), keyString3, false));
uow.commit();
}
}
@@ -551,8 +538,8 @@ TEST(SortedDataInterface, InsertAndSeekKeyString) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(opCtx.get(), keyString1, loc1, false));
- ASSERT_OK(sorted->insert(opCtx.get(), keyString2, loc2, false));
+ ASSERT_OK(sorted->insert(opCtx.get(), keyString1, false));
+ ASSERT_OK(sorted->insert(opCtx.get(), keyString2, false));
uow.commit();
}
}
@@ -596,8 +583,8 @@ TEST(SortedDataInterface, InsertAndSeekExactKeyString) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(opCtx.get(), keyString1, loc1, false));
- ASSERT_OK(sorted->insert(opCtx.get(), keyString2, loc2, false));
+ ASSERT_OK(sorted->insert(opCtx.get(), keyString1, false));
+ ASSERT_OK(sorted->insert(opCtx.get(), keyString2, false));
uow.commit();
}
}
@@ -635,11 +622,11 @@ TEST(SortedDataInterface, InsertMultipleCompoundKeys) {
{
WriteUnitOfWork uow(opCtx.get());
ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), compoundKey1a, loc1), loc1, false));
+ opCtx.get(), makeKeyString(sorted.get(), compoundKey1a, loc1), false));
ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), compoundKey1b, loc2), loc2, false));
+ opCtx.get(), makeKeyString(sorted.get(), compoundKey1b, loc2), false));
ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), compoundKey2b, loc3), loc3, false));
+ opCtx.get(), makeKeyString(sorted.get(), compoundKey2b, loc3), false));
uow.commit();
}
}
@@ -654,9 +641,9 @@ TEST(SortedDataInterface, InsertMultipleCompoundKeys) {
{
WriteUnitOfWork uow(opCtx.get());
ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), compoundKey1c, loc4), loc4, false));
+ opCtx.get(), makeKeyString(sorted.get(), compoundKey1c, loc4), false));
ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), compoundKey3a, loc5), loc5, false));
+ opCtx.get(), makeKeyString(sorted.get(), compoundKey3a, loc5), false));
uow.commit();
}
}
@@ -678,7 +665,6 @@ TEST(SortedDataInterface, InsertReservedRecordId) {
ASSERT(reservedLoc.isReserved());
ASSERT_OK(sorted->insert(opCtx.get(),
makeKeyString(sorted.get(), key1, reservedLoc),
- reservedLoc,
/*dupsAllowed*/ true));
uow.commit();
ASSERT_EQUALS(1, sorted->numEntries(opCtx.get()));
diff --git a/src/mongo/db/storage/sorted_data_interface_test_isempty.cpp b/src/mongo/db/storage/sorted_data_interface_test_isempty.cpp
index 1e707b94003..220f5661e2f 100644
--- a/src/mongo/db/storage/sorted_data_interface_test_isempty.cpp
+++ b/src/mongo/db/storage/sorted_data_interface_test_isempty.cpp
@@ -54,8 +54,9 @@ TEST(SortedDataInterface, IsEmpty) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, false));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), false));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc2), false));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc3), false));
uow.commit();
}
}
@@ -69,7 +70,9 @@ TEST(SortedDataInterface, IsEmpty) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, false);
+ sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), false);
+ sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key2, loc2), false);
+ sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key3, loc3), false);
ASSERT(sorted->isEmpty(opCtx.get()));
uow.commit();
}
diff --git a/src/mongo/db/storage/sorted_data_interface_test_rollback.cpp b/src/mongo/db/storage/sorted_data_interface_test_rollback.cpp
index 1bf15ceb744..a633fa1e2e0 100644
--- a/src/mongo/db/storage/sorted_data_interface_test_rollback.cpp
+++ b/src/mongo/db/storage/sorted_data_interface_test_rollback.cpp
@@ -53,8 +53,7 @@ TEST(SortedDataInterface, InsertWithoutCommit) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, false));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), false));
// no commit
}
}
@@ -68,10 +67,8 @@ TEST(SortedDataInterface, InsertWithoutCommit) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc1), loc1, false));
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc2), loc2, false));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc1), false));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc2), false));
// no commit
}
}
@@ -99,10 +96,8 @@ TEST(SortedDataInterface, UnindexWithoutCommit) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true));
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc2), loc2, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc2), true));
uow.commit();
}
}
@@ -116,7 +111,7 @@ TEST(SortedDataInterface, UnindexWithoutCommit) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key2, loc2), loc2, true);
+ sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key2, loc2), true);
ASSERT_EQUALS(1, sorted->numEntries(opCtx.get()));
// no commit
}
@@ -131,8 +126,7 @@ TEST(SortedDataInterface, UnindexWithoutCommit) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc3), loc3, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc3), true));
uow.commit();
}
}
@@ -146,9 +140,9 @@ TEST(SortedDataInterface, UnindexWithoutCommit) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true);
+ sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true);
ASSERT_EQUALS(2, sorted->numEntries(opCtx.get()));
- sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key3, loc3), loc3, true);
+ sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key3, loc3), true);
ASSERT_EQUALS(1, sorted->numEntries(opCtx.get()));
// no commit
}
diff --git a/src/mongo/db/storage/sorted_data_interface_test_spaceused.cpp b/src/mongo/db/storage/sorted_data_interface_test_spaceused.cpp
index 505ac0c7c53..3aeda2442f2 100644
--- a/src/mongo/db/storage/sorted_data_interface_test_spaceused.cpp
+++ b/src/mongo/db/storage/sorted_data_interface_test_spaceused.cpp
@@ -67,8 +67,7 @@ TEST(SortedDataInterface, GetSpaceUsedBytesNonEmpty) {
WriteUnitOfWork uow(opCtx.get());
BSONObj key = BSON("" << i);
RecordId loc(42, i * 2);
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key, loc), loc, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key, loc), true));
uow.commit();
}
}
diff --git a/src/mongo/db/storage/sorted_data_interface_test_touch.cpp b/src/mongo/db/storage/sorted_data_interface_test_touch.cpp
index 3eacc8fb745..4b9fc2137de 100644
--- a/src/mongo/db/storage/sorted_data_interface_test_touch.cpp
+++ b/src/mongo/db/storage/sorted_data_interface_test_touch.cpp
@@ -65,12 +65,9 @@ TEST(SortedDataInterface, TouchNonEmpty) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, false));
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc2), loc2, false));
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc3), loc3, false));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), false));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc2), false));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc3), false));
uow.commit();
}
}
diff --git a/src/mongo/db/storage/sorted_data_interface_test_unindex.cpp b/src/mongo/db/storage/sorted_data_interface_test_unindex.cpp
index 9da2eb2f265..4668aa33546 100644
--- a/src/mongo/db/storage/sorted_data_interface_test_unindex.cpp
+++ b/src/mongo/db/storage/sorted_data_interface_test_unindex.cpp
@@ -52,8 +52,7 @@ void unindex(bool partial) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true));
uow.commit();
}
}
@@ -67,7 +66,7 @@ void unindex(bool partial) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true);
+ sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true);
ASSERT(sorted->isEmpty(opCtx.get()));
uow.commit();
}
@@ -106,7 +105,7 @@ void unindexKeyString(bool partial) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(opCtx.get(), keyString1, loc1, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), keyString1, true));
uow.commit();
}
}
@@ -120,7 +119,7 @@ void unindexKeyString(bool partial) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- sorted->unindex(opCtx.get(), keyString1, loc1, true);
+ sorted->unindex(opCtx.get(), keyString1, true);
ASSERT(sorted->isEmpty(opCtx.get()));
uow.commit();
}
@@ -156,7 +155,7 @@ void unindexCompoundKey(bool partial) {
{
WriteUnitOfWork uow(opCtx.get());
ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), compoundKey1a, loc1), loc1, true));
+ opCtx.get(), makeKeyString(sorted.get(), compoundKey1a, loc1), true));
uow.commit();
}
}
@@ -170,8 +169,7 @@ void unindexCompoundKey(bool partial) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- sorted->unindex(
- opCtx.get(), makeKeyString(sorted.get(), compoundKey1a, loc1), loc1, true);
+ sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), compoundKey1a, loc1), true);
ASSERT(sorted->isEmpty(opCtx.get()));
uow.commit();
}
@@ -206,10 +204,8 @@ void unindexMultipleDistinct(bool partial) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true));
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc2), loc2, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc2), true));
uow.commit();
}
}
@@ -223,7 +219,7 @@ void unindexMultipleDistinct(bool partial) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key2, loc2), loc2, true);
+ sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key2, loc2), true);
ASSERT_EQUALS(1, sorted->numEntries(opCtx.get()));
uow.commit();
}
@@ -238,8 +234,7 @@ void unindexMultipleDistinct(bool partial) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc3), loc3, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc3), true));
uow.commit();
}
}
@@ -253,9 +248,9 @@ void unindexMultipleDistinct(bool partial) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true);
+ sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true);
ASSERT_EQUALS(1, sorted->numEntries(opCtx.get()));
- sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key3, loc3), loc3, true);
+ sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key3, loc3), true);
ASSERT(sorted->isEmpty(opCtx.get()));
uow.commit();
}
@@ -290,12 +285,9 @@ void unindexMultipleSameKey(bool partial) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true));
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), key1, loc2),
- loc2,
- true /* allow duplicates */));
+ ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), key1, loc2), true /* allow duplicates */));
uow.commit();
}
}
@@ -309,7 +301,7 @@ void unindexMultipleSameKey(bool partial) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key1, loc2), loc2, true);
+ sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key1, loc2), true);
ASSERT_EQUALS(1, sorted->numEntries(opCtx.get()));
uow.commit();
}
@@ -324,10 +316,8 @@ void unindexMultipleSameKey(bool partial) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(opCtx.get(),
- makeKeyString(sorted.get(), key1, loc3),
- loc3,
- true /* allow duplicates */));
+ ASSERT_OK(sorted->insert(
+ opCtx.get(), makeKeyString(sorted.get(), key1, loc3), true /* allow duplicates */));
uow.commit();
}
}
@@ -341,9 +331,9 @@ void unindexMultipleSameKey(bool partial) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true);
+ sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true);
ASSERT_EQUALS(1, sorted->numEntries(opCtx.get()));
- sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key1, loc3), loc3, true);
+ sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key1, loc3), true);
ASSERT(sorted->isEmpty(opCtx.get()));
uow.commit();
}
@@ -385,9 +375,8 @@ void unindexMultipleSameKeyString(bool partial) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(opCtx.get(), keyStringLoc1, loc1, true));
- ASSERT_OK(
- sorted->insert(opCtx.get(), keyStringLoc2, loc2, true /* allow duplicates */));
+ ASSERT_OK(sorted->insert(opCtx.get(), keyStringLoc1, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), keyStringLoc2, true /* allow duplicates */));
uow.commit();
}
}
@@ -401,7 +390,7 @@ void unindexMultipleSameKeyString(bool partial) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- sorted->unindex(opCtx.get(), keyStringLoc2, loc2, true);
+ sorted->unindex(opCtx.get(), keyStringLoc2, true);
ASSERT_EQUALS(1, sorted->numEntries(opCtx.get()));
uow.commit();
}
@@ -416,8 +405,7 @@ void unindexMultipleSameKeyString(bool partial) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(
- sorted->insert(opCtx.get(), keyStringLoc3, loc3, true /* allow duplicates */));
+ ASSERT_OK(sorted->insert(opCtx.get(), keyStringLoc3, true /* allow duplicates */));
uow.commit();
}
}
@@ -431,9 +419,9 @@ void unindexMultipleSameKeyString(bool partial) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- sorted->unindex(opCtx.get(), keyStringLoc1, loc1, true);
+ sorted->unindex(opCtx.get(), keyStringLoc1, true);
ASSERT_EQUALS(1, sorted->numEntries(opCtx.get()));
- sorted->unindex(opCtx.get(), keyStringLoc3, loc3, true);
+ sorted->unindex(opCtx.get(), keyStringLoc3, true);
ASSERT(sorted->isEmpty(opCtx.get()));
uow.commit();
}
@@ -469,7 +457,7 @@ void unindexEmpty(bool partial) {
const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true);
+ sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true);
ASSERT(sorted->isEmpty(opCtx.get()));
uow.commit();
}
@@ -500,8 +488,8 @@ TEST(SortedDataInterface, PartialIndex) {
{
{
WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(
- opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true));
+ ASSERT_OK(
+ sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true));
// Assume key1 with loc2 was never indexed due to the partial index.
ASSERT_EQUALS(1, sorted->numEntries(opCtx.get()));
uow.commit();
@@ -510,14 +498,14 @@ TEST(SortedDataInterface, PartialIndex) {
{
WriteUnitOfWork uow(opCtx.get());
// Shouldn't unindex anything as key1 with loc2 wasn't indexed in the first place.
- sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key1, loc2), loc2, true);
+ sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key1, loc2), true);
ASSERT_EQUALS(1, sorted->numEntries(opCtx.get()));
uow.commit();
}
{
WriteUnitOfWork uow(opCtx.get());
- sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), loc1, true);
+ sorted->unindex(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), true);
ASSERT(sorted->isEmpty(opCtx.get()));
uow.commit();
}
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp
index f6bcc016c8c..079ef58d6f1 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp
@@ -247,10 +247,9 @@ WiredTigerIndex::WiredTigerIndex(OperationContext* ctx,
Status WiredTigerIndex::insert(OperationContext* opCtx,
const KeyString::Value& keyString,
- const RecordId& id,
bool dupsAllowed) {
dassert(opCtx->lockState()->isWriteLocked());
- dassert(id == KeyString::decodeRecordIdAtEnd(keyString.getBuffer(), keyString.getSize()));
+ dassert(KeyString::decodeRecordIdAtEnd(keyString.getBuffer(), keyString.getSize()).isValid());
TRACE_INDEX << " KeyString: " << keyString;
@@ -258,23 +257,21 @@ Status WiredTigerIndex::insert(OperationContext* opCtx,
curwrap.assertInActiveTxn();
WT_CURSOR* c = curwrap.get();
- return _insert(opCtx, c, keyString, id, dupsAllowed);
+ return _insert(opCtx, c, keyString, dupsAllowed);
}
void WiredTigerIndex::unindex(OperationContext* opCtx,
const KeyString::Value& keyString,
- const RecordId& id,
bool dupsAllowed) {
- invariant(id.isValid());
dassert(opCtx->lockState()->isWriteLocked());
- dassert(id == KeyString::decodeRecordIdAtEnd(keyString.getBuffer(), keyString.getSize()));
+ dassert(KeyString::decodeRecordIdAtEnd(keyString.getBuffer(), keyString.getSize()).isValid());
WiredTigerCursor curwrap(_uri, _tableId, false, opCtx);
curwrap.assertInActiveTxn();
WT_CURSOR* c = curwrap.get();
invariant(c);
- _unindex(opCtx, c, keyString, id, dupsAllowed);
+ _unindex(opCtx, c, keyString, dupsAllowed);
}
void WiredTigerIndex::fullValidate(OperationContext* opCtx,
@@ -1406,19 +1403,18 @@ bool WiredTigerIndexUnique::isDup(OperationContext* opCtx,
Status WiredTigerIndexUnique::_insert(OperationContext* opCtx,
WT_CURSOR* c,
const KeyString::Value& keyString,
- const RecordId& id,
bool dupsAllowed) {
if (isTimestampSafeUniqueIdx()) {
return _insertTimestampSafe(opCtx, c, keyString, dupsAllowed);
}
- return _insertTimestampUnsafe(opCtx, c, keyString, id, dupsAllowed);
+ return _insertTimestampUnsafe(opCtx, c, keyString, dupsAllowed);
}
Status WiredTigerIndexUnique::_insertTimestampUnsafe(OperationContext* opCtx,
WT_CURSOR* c,
const KeyString::Value& keyString,
- const RecordId& id,
bool dupsAllowed) {
+ const RecordId id = KeyString::decodeRecordIdAtEnd(keyString.getBuffer(), keyString.getSize());
invariant(id.isValid());
auto sizeWithoutRecordId =
@@ -1560,19 +1556,18 @@ Status WiredTigerIndexUnique::_insertTimestampSafe(OperationContext* opCtx,
void WiredTigerIndexUnique::_unindex(OperationContext* opCtx,
WT_CURSOR* c,
const KeyString::Value& keyString,
- const RecordId& id,
bool dupsAllowed) {
if (isTimestampSafeUniqueIdx()) {
return _unindexTimestampSafe(opCtx, c, keyString, dupsAllowed);
}
- return _unindexTimestampUnsafe(opCtx, c, keyString, id, dupsAllowed);
+ return _unindexTimestampUnsafe(opCtx, c, keyString, dupsAllowed);
}
void WiredTigerIndexUnique::_unindexTimestampUnsafe(OperationContext* opCtx,
WT_CURSOR* c,
const KeyString::Value& keyString,
- const RecordId& id,
bool dupsAllowed) {
+ const RecordId id = KeyString::decodeRecordIdAtEnd(keyString.getBuffer(), keyString.getSize());
invariant(id.isValid());
auto sizeWithoutRecordId =
@@ -1738,7 +1733,6 @@ SortedDataBuilderInterface* WiredTigerIndexStandard::getBulkBuilder(OperationCon
Status WiredTigerIndexStandard::_insert(OperationContext* opCtx,
WT_CURSOR* c,
const KeyString::Value& keyString,
- const RecordId& id,
bool dupsAllowed) {
invariant(dupsAllowed);
@@ -1765,7 +1759,6 @@ Status WiredTigerIndexStandard::_insert(OperationContext* opCtx,
void WiredTigerIndexStandard::_unindex(OperationContext* opCtx,
WT_CURSOR* c,
const KeyString::Value& keyString,
- const RecordId&,
bool dupsAllowed) {
invariant(dupsAllowed);
WiredTigerItem item(keyString.getBuffer(), keyString.getSize());
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_index.h b/src/mongo/db/storage/wiredtiger/wiredtiger_index.h
index 821a1ae8e0a..3e962b1356d 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_index.h
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_index.h
@@ -93,12 +93,10 @@ public:
virtual Status insert(OperationContext* opCtx,
const KeyString::Value& keyString,
- const RecordId& id,
bool dupsAllowed);
virtual void unindex(OperationContext* opCtx,
const KeyString::Value& keyString,
- const RecordId& id,
bool dupsAllowed);
virtual void fullValidate(OperationContext* opCtx,
@@ -154,13 +152,11 @@ protected:
virtual Status _insert(OperationContext* opCtx,
WT_CURSOR* c,
const KeyString::Value& keyString,
- const RecordId& id,
bool dupsAllowed) = 0;
virtual void _unindex(OperationContext* opCtx,
WT_CURSOR* c,
const KeyString::Value& keyString,
- const RecordId& id,
bool dupsAllowed) = 0;
void setKey(WT_CURSOR* cursor, const WT_ITEM* item);
@@ -217,13 +213,11 @@ public:
Status _insert(OperationContext* opCtx,
WT_CURSOR* c,
const KeyString::Value& keyString,
- const RecordId& id,
bool dupsAllowed) override;
Status _insertTimestampUnsafe(OperationContext* opCtx,
WT_CURSOR* c,
const KeyString::Value& keyString,
- const RecordId& id,
bool dupsAllowed);
Status _insertTimestampSafe(OperationContext* opCtx,
@@ -234,13 +228,11 @@ public:
void _unindex(OperationContext* opCtx,
WT_CURSOR* c,
const KeyString::Value& keyString,
- const RecordId& id,
bool dupsAllowed) override;
void _unindexTimestampUnsafe(OperationContext* opCtx,
WT_CURSOR* c,
const KeyString::Value& keyString,
- const RecordId& id,
bool dupsAllowed);
void _unindexTimestampSafe(OperationContext* opCtx,
@@ -281,13 +273,11 @@ public:
Status _insert(OperationContext* opCtx,
WT_CURSOR* c,
const KeyString::Value& keyString,
- const RecordId& id,
bool dupsAllowed) override;
void _unindex(OperationContext* opCtx,
WT_CURSOR* c,
const KeyString::Value& keyString,
- const RecordId& id,
bool dupsAllowed) override;
};
diff --git a/src/mongo/dbtests/validate_tests.cpp b/src/mongo/dbtests/validate_tests.cpp
index 999373d2d6b..d3a8de83bad 100644
--- a/src/mongo/dbtests/validate_tests.cpp
+++ b/src/mongo/dbtests/validate_tests.cpp
@@ -1063,7 +1063,7 @@ public:
recordId)
.release();
auto insertStatus =
- sortedDataInterface->insert(&_opCtx, indexKey, recordId, true /* dupsAllowed */);
+ sortedDataInterface->insert(&_opCtx, indexKey, true /* dupsAllowed */);
ASSERT_OK(insertStatus);
wunit.commit();
}
@@ -1085,7 +1085,7 @@ public:
sortedDataInterface->getOrdering(),
recordId)
.release();
- sortedDataInterface->unindex(&_opCtx, indexKey, recordId, true /* dupsAllowed */);
+ sortedDataInterface->unindex(&_opCtx, indexKey, true /* dupsAllowed */);
wunit.commit();
}
@@ -1186,7 +1186,7 @@ public:
sortedDataInterface->getOrdering(),
recordId)
.release();
- sortedDataInterface->unindex(&_opCtx, indexKey, recordId, true /* dupsAllowed */);
+ sortedDataInterface->unindex(&_opCtx, indexKey, true /* dupsAllowed */);
wunit.commit();
}
releaseDb();