diff options
author | jannaerin <golden.janna@gmail.com> | 2019-07-03 13:24:58 -0400 |
---|---|---|
committer | jannaerin <golden.janna@gmail.com> | 2019-07-08 17:09:04 -0400 |
commit | c6468f7d3ac783b4bcdeb6744fc976c8ecee2969 (patch) | |
tree | 1f425d3bc85d26cd24ff1fdf0d8c9ad81aca8d66 /src/mongo/db/catalog_raii.cpp | |
parent | 13434801be12a72d370147aed4c2ac194e658062 (diff) | |
download | mongo-c6468f7d3ac783b4bcdeb6744fc976c8ecee2969.tar.gz |
SERVER-34431 MoveDatabaseShardingState into its own map
Diffstat (limited to 'src/mongo/db/catalog_raii.cpp')
-rw-r--r-- | src/mongo/db/catalog_raii.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/mongo/db/catalog_raii.cpp b/src/mongo/db/catalog_raii.cpp index b3f109c90e5..3fe1fee4bc2 100644 --- a/src/mongo/db/catalog_raii.cpp +++ b/src/mongo/db/catalog_raii.cpp @@ -49,11 +49,9 @@ AutoGetDb::AutoGetDb(OperationContext* opCtx, StringData dbName, LockMode mode, auto databaseHolder = DatabaseHolder::get(opCtx); return databaseHolder->getDb(opCtx, dbName); }()) { - if (_db) { - auto& dss = DatabaseShardingState::get(_db); - auto dssLock = DatabaseShardingState::DSSLock::lockShared(opCtx, &dss); - dss.checkDbVersion(opCtx, dssLock); - } + auto dss = DatabaseShardingState::get(opCtx, dbName); + auto dssLock = DatabaseShardingState::DSSLock::lockShared(opCtx, dss); + dss->checkDbVersion(opCtx, dssLock); } AutoGetCollection::AutoGetCollection(OperationContext* opCtx, @@ -183,9 +181,9 @@ AutoGetOrCreateDb::AutoGetOrCreateDb(OperationContext* opCtx, _db = databaseHolder->openDb(opCtx, dbName, &_justCreated); } - auto& dss = DatabaseShardingState::get(_db); - auto dssLock = DatabaseShardingState::DSSLock::lockShared(opCtx, &dss); - dss.checkDbVersion(opCtx, dssLock); + auto dss = DatabaseShardingState::get(opCtx, dbName); + auto dssLock = DatabaseShardingState::DSSLock::lockShared(opCtx, dss); + dss->checkDbVersion(opCtx, dssLock); } ConcealCollectionCatalogChangesBlock::ConcealCollectionCatalogChangesBlock(OperationContext* opCtx) |