diff options
author | Dianna Hohensee <dianna.hohensee@10gen.com> | 2017-02-24 12:42:37 -0500 |
---|---|---|
committer | Dianna Hohensee <dianna.hohensee@10gen.com> | 2017-02-24 17:37:55 -0500 |
commit | ce23378926659bc50604032782485c2f962c37ac (patch) | |
tree | 8511c2aabaef6b7950f73c62dc16cef13757f799 /src/mongo/db | |
parent | 02dbff056f913f77df2bfe5558897bc9a229ae4f (diff) | |
download | mongo-ce23378926659bc50604032782485c2f962c37ac.tar.gz |
SERVER-27941 change the shardVersion check to an epoch check when entering the critical section.
Diffstat (limited to 'src/mongo/db')
-rw-r--r-- | src/mongo/db/s/migration_source_manager.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mongo/db/s/migration_source_manager.cpp b/src/mongo/db/s/migration_source_manager.cpp index 22d6d259dab..1de1af92316 100644 --- a/src/mongo/db/s/migration_source_manager.cpp +++ b/src/mongo/db/s/migration_source_manager.cpp @@ -235,16 +235,18 @@ Status MigrationSourceManager::enterCriticalSection(OperationContext* txn) { ScopedTransaction scopedXact(txn, MODE_IX); AutoGetCollection autoColl(txn, getNss(), MODE_IX, MODE_X); + // Check that the collection has not been dropped or recreated since the migration began. auto css = CollectionShardingState::get(txn, getNss().ns()); auto metadata = css->getMetadata(); if (!metadata || - !metadata->getCollVersion().equals(_collectionMetadata->getCollVersion())) { + (metadata->getCollVersion().epoch() != _collectionMetadata->getCollVersion().epoch())) { return {ErrorCodes::IncompatibleShardingMetadata, str::stream() - << "Sharding metadata changed while holding distributed lock. Expected: " - << _collectionMetadata->getCollVersion().toString() + << "The collection was dropped or recreated since the migration began. " + << "Expected collection epoch: " + << _collectionMetadata->getCollVersion().epoch().toString() << ", but found: " - << (metadata ? metadata->getCollVersion().toString() + << (metadata ? metadata->getCollVersion().epoch().toString() : "unsharded collection.")}; } |