diff options
author | Sophia Tan <sophia_tll@hotmail.com> | 2022-02-03 14:09:41 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-02-03 14:54:57 +0000 |
commit | c81c668189f7c7a933661d1e225aacfdbc33840d (patch) | |
tree | 7a650c5cb0c5ba8bf3569005d93bc1428bad1005 /src/mongo/dbtests | |
parent | 7e917657f0f23fc962010a2f2e1a837309b787ae (diff) | |
download | mongo-c81c668189f7c7a933661d1e225aacfdbc33840d.tar.gz |
SERVER-61987 Change DatabaseHolder's map to be keyed by TenantDatabaseName
Diffstat (limited to 'src/mongo/dbtests')
-rw-r--r-- | src/mongo/dbtests/catalogtests.cpp | 4 | ||||
-rw-r--r-- | src/mongo/dbtests/dbhelper_tests.cpp | 4 | ||||
-rw-r--r-- | src/mongo/dbtests/query_stage_cached_plan.cpp | 3 | ||||
-rw-r--r-- | src/mongo/dbtests/querytests.cpp | 2 | ||||
-rw-r--r-- | src/mongo/dbtests/rollbacktests.cpp | 2 |
5 files changed, 9 insertions, 6 deletions
diff --git a/src/mongo/dbtests/catalogtests.cpp b/src/mongo/dbtests/catalogtests.cpp index 5df1d340b30..445a91b8502 100644 --- a/src/mongo/dbtests/catalogtests.cpp +++ b/src/mongo/dbtests/catalogtests.cpp @@ -61,14 +61,14 @@ public: auto op1 = client1->makeOperationContext(); auto op2 = client2->makeOperationContext(); - Lock::DBLock dbLk1(op1.get(), competingNss.db(), LockMode::MODE_IX); Lock::CollectionLock collLk1(op1.get(), competingNss, LockMode::MODE_IX); Lock::DBLock dbLk2(op2.get(), competingNss.db(), LockMode::MODE_IX); Lock::CollectionLock collLk2(op2.get(), competingNss, LockMode::MODE_IX); + const TenantDatabaseName competingTenantDbName(boost::none, competingNss.db()); Database* db = - DatabaseHolder::get(op1.get())->openDb(op1.get(), competingNss.db(), nullptr); + DatabaseHolder::get(op1.get())->openDb(op1.get(), competingTenantDbName, nullptr); { WriteUnitOfWork wuow1(op1.get()); diff --git a/src/mongo/dbtests/dbhelper_tests.cpp b/src/mongo/dbtests/dbhelper_tests.cpp index 04dee799791..5dbc2f05ca4 100644 --- a/src/mongo/dbtests/dbhelper_tests.cpp +++ b/src/mongo/dbtests/dbhelper_tests.cpp @@ -137,7 +137,9 @@ public: Lock::DBLock dbLk2(opCtx2.get(), nss.db(), LockMode::MODE_IX); Lock::CollectionLock collLk2(opCtx2.get(), nss, LockMode::MODE_IX); - Database* db = DatabaseHolder::get(opCtx1.get())->openDb(opCtx1.get(), nss.db(), nullptr); + const TenantDatabaseName tenantDbName(boost::none, nss.db()); + Database* db = + DatabaseHolder::get(opCtx1.get())->openDb(opCtx1.get(), tenantDbName, nullptr); // Create the collection and insert one doc BSONObj doc = BSON("_id" << 1 << "x" << 2); diff --git a/src/mongo/dbtests/query_stage_cached_plan.cpp b/src/mongo/dbtests/query_stage_cached_plan.cpp index d3cf8bd8a63..bbea1b278ac 100644 --- a/src/mongo/dbtests/query_stage_cached_plan.cpp +++ b/src/mongo/dbtests/query_stage_cached_plan.cpp @@ -101,8 +101,9 @@ public: void dropCollection() { Lock::DBLock dbLock(&_opCtx, nss.db(), MODE_X); + const TenantDatabaseName tenantDbName(boost::none, nss.db()); auto databaseHolder = DatabaseHolder::get(&_opCtx); - auto database = databaseHolder->getDb(&_opCtx, nss.db()); + auto database = databaseHolder->getDb(&_opCtx, tenantDbName); if (!database) { return; } diff --git a/src/mongo/dbtests/querytests.cpp b/src/mongo/dbtests/querytests.cpp index 06757ea35ee..3310f766ff4 100644 --- a/src/mongo/dbtests/querytests.cpp +++ b/src/mongo/dbtests/querytests.cpp @@ -1169,7 +1169,7 @@ public: Lock::GlobalWrite lk(&_opCtx); OldClientContext ctx(&_opCtx, "unittests.DirectLocking"); _client.remove("a.b", BSONObj()); - ASSERT_EQUALS("unittests", ctx.db()->name()); + ASSERT_EQUALS("unittests", ctx.db()->name().dbName()); } const char* ns; }; diff --git a/src/mongo/dbtests/rollbacktests.cpp b/src/mongo/dbtests/rollbacktests.cpp index 95310d74bc1..10586a30ee7 100644 --- a/src/mongo/dbtests/rollbacktests.cpp +++ b/src/mongo/dbtests/rollbacktests.cpp @@ -55,7 +55,7 @@ const auto kIndexVersion = IndexDescriptor::IndexVersion::kV2; void dropDatabase(OperationContext* opCtx, const NamespaceString& nss) { Lock::GlobalWrite globalWriteLock(opCtx); auto databaseHolder = DatabaseHolder::get(opCtx); - auto db = databaseHolder->getDb(opCtx, nss.db()); + auto db = databaseHolder->getDb(opCtx, TenantDatabaseName(boost::none, nss.db())); if (db) { databaseHolder->dropDb(opCtx, db); |