diff options
-rw-r--r-- | src/mongo/db/catalog_raii.cpp | 8 | ||||
-rw-r--r-- | src/mongo/db/catalog_raii.h | 32 | ||||
-rw-r--r-- | src/mongo/db/catalog_raii_test.cpp | 10 |
3 files changed, 0 insertions, 50 deletions
diff --git a/src/mongo/db/catalog_raii.cpp b/src/mongo/db/catalog_raii.cpp index 1c3ddcdeee3..514feb946bb 100644 --- a/src/mongo/db/catalog_raii.cpp +++ b/src/mongo/db/catalog_raii.cpp @@ -428,14 +428,6 @@ LockMode fixLockModeForSystemDotViewsChanges(const NamespaceString& nss, LockMod return nss.isSystemDotViews() ? MODE_X : mode; } -AutoGetOrCreateDb::AutoGetOrCreateDb(OperationContext* opCtx, - StringData dbName, - LockMode mode, - Date_t deadline) - : _autoDb(opCtx, dbName, mode, deadline), _db(_autoDb.ensureDbExists()) { - invariant(mode == MODE_IX || mode == MODE_X); -} - ReadSourceScope::ReadSourceScope(OperationContext* opCtx, RecoveryUnit::ReadSource readSource, boost::optional<Timestamp> provided) diff --git a/src/mongo/db/catalog_raii.h b/src/mongo/db/catalog_raii.h index 151f1daf723..1355592e614 100644 --- a/src/mongo/db/catalog_raii.h +++ b/src/mongo/db/catalog_raii.h @@ -398,38 +398,6 @@ private: LockMode fixLockModeForSystemDotViewsChanges(const NamespaceString& nss, LockMode mode); /** - * RAII-style class, which acquires a lock on the specified database in the requested mode and - * obtains a reference to the database, creating it was non-existing. Used as a shortcut for - * calls to DatabaseHolder::get(opCtx)->openDb(), taking care of locking details. The - * requested mode must be MODE_IX or MODE_X. - * - * Use this when you are about to perform a write, and want to create the database if it doesn't - * already exist. - * - * It is guaranteed that locks will be released when this object goes out of scope, therefore - * the database reference returned by this class should not be retained. - */ -class AutoGetOrCreateDb { - AutoGetOrCreateDb(const AutoGetOrCreateDb&) = delete; - AutoGetOrCreateDb& operator=(const AutoGetOrCreateDb&) = delete; - -public: - AutoGetOrCreateDb(OperationContext* opCtx, - StringData dbName, - LockMode mode, - Date_t deadline = Date_t::max()); - - Database* getDb() const { - return _db; - } - -private: - AutoGetDb _autoDb; - - Database* _db; -}; - -/** * RAII type to set and restore the timestamp read source on the recovery unit. * * Snapshot is abandoned in constructor and destructor, so it can only be used before diff --git a/src/mongo/db/catalog_raii_test.cpp b/src/mongo/db/catalog_raii_test.cpp index 531e6af2e2a..f1b41a22fee 100644 --- a/src/mongo/db/catalog_raii_test.cpp +++ b/src/mongo/db/catalog_raii_test.cpp @@ -118,16 +118,6 @@ TEST_F(CatalogRAIITestFixture, AutoGetDBDeadlineMin) { Milliseconds(0)); } -TEST_F(CatalogRAIITestFixture, AutoGetOrCreateDbDeadline) { - Lock::DBLock dbLock1(client1.second.get(), nss.db(), MODE_X); - ASSERT(client1.second->lockState()->isDbLockedForMode(nss.db(), MODE_X)); - failsWithLockTimeout( - [&] { - AutoGetOrCreateDb db(client2.second.get(), nss.db(), MODE_X, Date_t::now() + timeoutMs); - }, - timeoutMs); -} - TEST_F(CatalogRAIITestFixture, AutoGetCollectionCollLockDeadline) { Lock::DBLock dbLock1(client1.second.get(), nss.db(), MODE_IX); ASSERT(client1.second->lockState()->isDbLockedForMode(nss.db(), MODE_IX)); |