diff options
author | Yuhong Zhang <danielzhangyh@gmail.com> | 2021-11-11 23:00:11 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-11-11 23:50:10 +0000 |
commit | c5aa4a5f2035733b85ee55edcf7b74b530db29e7 (patch) | |
tree | c982483151e41fe6a040684f1aea2deca950de58 /src/mongo/dbtests/index_access_method_test.cpp | |
parent | 091bde78cac24e21d7c6b57aa7484e5273aea471 (diff) | |
download | mongo-c5aa4a5f2035733b85ee55edcf7b74b530db29e7.tar.gz |
Revert "SERVER-59831 Pass `dupsAllowed=true` to `WiredTigerIndexUnique::_insert` on secondaries"
This reverts commit a52ee5999b0fc7adcbce77b37a7313d4585a4cbf.
Diffstat (limited to 'src/mongo/dbtests/index_access_method_test.cpp')
-rw-r--r-- | src/mongo/dbtests/index_access_method_test.cpp | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/src/mongo/dbtests/index_access_method_test.cpp b/src/mongo/dbtests/index_access_method_test.cpp index 409ae85770a..ad4bcca07bd 100644 --- a/src/mongo/dbtests/index_access_method_test.cpp +++ b/src/mongo/dbtests/index_access_method_test.cpp @@ -31,10 +31,8 @@ #include "mongo/bson/bsonobj.h" #include "mongo/bson/simple_bsonobj_comparator.h" -#include "mongo/db/client.h" #include "mongo/db/index/index_access_method.h" #include "mongo/db/json.h" -#include "mongo/dbtests/dbtests.h" #include "mongo/unittest/unittest.h" namespace mongo { @@ -225,37 +223,6 @@ TEST(IndexAccessMethodSetDifference, ShouldNotReportOverlapsFromNonDisjointSets) } } -TEST(IndexAccessMethodInsertKeys, DuplicatesCheckingOnSecondaryUniqueIndexes) { - ServiceContext::UniqueOperationContext opCtxRaii = cc().makeOperationContext(); - OperationContext* opCtx = opCtxRaii.get(); - NamespaceString nss("unittests.DuplicatesCheckingOnSecondaryUniqueIndexes"); - auto indexName = "a_1"; - auto indexSpec = BSON("name" << indexName << "key" << BSON("a" << 1) << "unique" << true << "v" - << static_cast<int>(IndexDescriptor::IndexVersion::kV2)); - ASSERT_OK(dbtests::createIndexFromSpec(opCtx, nss.ns(), indexSpec)); - - AutoGetCollection autoColl(opCtx, nss, LockMode::MODE_X); - const auto& coll = autoColl.getCollection(); - auto indexDescriptor = coll->getIndexCatalog()->findIndexByName(opCtx, indexName); - IndexAccessMethod* indexAccessMethod = - coll->getIndexCatalog()->getEntry(indexDescriptor)->accessMethod(); - - KeyString::HeapBuilder keyString1( - KeyString::Version::kLatestVersion, BSON("" << 1), Ordering::make(BSONObj()), RecordId(1)); - KeyString::HeapBuilder keyString2( - KeyString::Version::kLatestVersion, BSON("" << 1), Ordering::make(BSONObj()), RecordId(2)); - KeyStringSet keys{keyString1.release(), keyString2.release()}; - struct InsertDeleteOptions options; /* options.dupsAllowed = false */ - - // Checks duplicates and returns the error code when constraints are enforced. - auto status = indexAccessMethod->insertKeys(opCtx, coll, keys, {}, options, {}, nullptr); - ASSERT_EQ(status.code(), ErrorCodes::DuplicateKey); - - // Skips the check on duplicates when constraints are not enforced. - opCtx->setEnforceConstraints(false); - ASSERT_OK(indexAccessMethod->insertKeys(opCtx, coll, keys, {}, options, {}, nullptr)); -} - } // namespace } // namespace mongo |