summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorDianna Hohensee <dianna.hohensee@10gen.com>2017-02-24 12:42:37 -0500
committerDianna Hohensee <dianna.hohensee@10gen.com>2017-02-24 17:37:55 -0500
commitce23378926659bc50604032782485c2f962c37ac (patch)
tree8511c2aabaef6b7950f73c62dc16cef13757f799 /src/mongo/db
parent02dbff056f913f77df2bfe5558897bc9a229ae4f (diff)
downloadmongo-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.cpp10
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.")};
}