diff options
author | Leon Zaruvinsky <leon@mongodb.com> | 2016-06-22 17:34:05 -0400 |
---|---|---|
committer | Leon Zaruvinsky <leon@mongodb.com> | 2016-07-07 17:44:19 -0400 |
commit | abaa59f3990f42aadba3b04e32dabbf3c1e47ce3 (patch) | |
tree | bf88ab49e7ec53cea70626b83e8020db75631389 /src/mongo/db/s/migration_source_manager.cpp | |
parent | 419a2e4eaf791a8d217050dbf0ca63149f261e0f (diff) | |
download | mongo-abaa59f3990f42aadba3b04e32dabbf3c1e47ce3.tar.gz |
SERVER-24415 Replace instances of shared_ptr<CollectionMetadata> with ScopedCollectionMetadata
Diffstat (limited to 'src/mongo/db/s/migration_source_manager.cpp')
-rw-r--r-- | src/mongo/db/s/migration_source_manager.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/mongo/db/s/migration_source_manager.cpp b/src/mongo/db/s/migration_source_manager.cpp index 61a4399a7c5..cdc188dcd46 100644 --- a/src/mongo/db/s/migration_source_manager.cpp +++ b/src/mongo/db/s/migration_source_manager.cpp @@ -120,8 +120,8 @@ MigrationSourceManager::MigrationSourceManager(OperationContext* txn, MoveChunkR ScopedTransaction scopedXact(txn, MODE_IS); AutoGetCollection autoColl(txn, _args.getNss(), MODE_IS); - auto css = CollectionShardingState::get(txn, _args.getNss()); - _committedMetadata = css->getMetadata(); + _committedMetadata = CollectionShardingState::get(txn, _args.getNss())->getMetadata(); + _keyPattern = _committedMetadata->getKeyPattern(); } const ChunkVersion collectionVersion = _committedMetadata->getCollVersion(); @@ -357,10 +357,10 @@ Status MigrationSourceManager::commitDonateChunk(OperationContext* txn) { ChunkType migratingChunkToForget; migratingChunkToForget.setMin(_args.getMinKey()); migratingChunkToForget.setMax(_args.getMaxKey()); - _committedMetadata = - _committedMetadata->cloneMigrate(migratingChunkToForget, uncommittedCollVersion); auto css = CollectionShardingState::get(txn, _args.getNss().ns()); - css->setMetadata(_committedMetadata); + css->setMetadata( + _committedMetadata->cloneMigrate(migratingChunkToForget, uncommittedCollVersion)); + _committedMetadata = css->getMetadata(); } else { // This could be an unrelated error (e.g. network error). Check whether the metadata update // succeeded by refreshing the collection metadata from the config server and checking that @@ -415,8 +415,8 @@ Status MigrationSourceManager::commitDonateChunk(OperationContext* txn) { AutoGetCollection autoColl(txn, _args.getNss(), MODE_IS); ChunkVersion previousMetadataCollVersion = _committedMetadata->getCollVersion(); - auto css = CollectionShardingState::get(txn, _args.getNss()); - std::shared_ptr<CollectionMetadata> refreshedMetadata = css->getMetadata(); + auto refreshedMetadata = + CollectionShardingState::get(txn, _args.getNss())->getMetadata(); if (refreshedMetadata->keyBelongsToMe(_args.getMinKey())) { invariant(refreshedMetadata->getCollVersion() == previousMetadataCollVersion); |