summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorMax Hirschhorn <max.hirschhorn@mongodb.com>2015-10-07 18:41:00 -0400
committerMax Hirschhorn <max.hirschhorn@mongodb.com>2015-10-07 18:41:00 -0400
commit0891369a428c69283544d4689883eab4e7e31dd9 (patch)
treee19ecc9afef6e8c759304de939c1c5c20d074c16 /src/mongo/db
parentcc5788013eebbbd71e87581f3bb16532ab463ef0 (diff)
downloadmongo-0891369a428c69283544d4689883eab4e7e31dd9.tar.gz
Revert "SERVER-20676 Retry move chunk if it fails due to stale chunk boundaries"
This reverts commit 3099db9c48a17c40b98423a5651943218f9844ce.
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/s/migration_impl.cpp30
-rw-r--r--src/mongo/db/s/migration_impl.h6
2 files changed, 10 insertions, 26 deletions
diff --git a/src/mongo/db/s/migration_impl.cpp b/src/mongo/db/s/migration_impl.cpp
index c84cffd98a2..cb47f8988f3 100644
--- a/src/mongo/db/s/migration_impl.cpp
+++ b/src/mongo/db/s/migration_impl.cpp
@@ -38,7 +38,6 @@
#include "mongo/db/operation_context.h"
#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/s/collection_metadata.h"
-#include "mongo/db/s/operation_shard_version.h"
#include "mongo/db/s/sharding_state.h"
#include "mongo/db/s/sharding_state_recovery.h"
#include "mongo/logger/ramlog.h"
@@ -47,7 +46,6 @@
#include "mongo/s/chunk.h"
#include "mongo/s/client/shard_registry.h"
#include "mongo/s/grid.h"
-#include "mongo/s/stale_exception.h"
#include "mongo/util/exit.h"
#include "mongo/util/fail_point_service.h"
#include "mongo/util/log.h"
@@ -223,24 +221,14 @@ StatusWith<ForwardingCatalogManager::ScopedDistLock*> ChunkMoveOperationState::a
return Status(ErrorCodes::IncompatibleShardingMetadata, msg);
}
- {
- // Mongos >= v3.2 sends the full version, v3.0 only sends the epoch.
- // TODO(SERVER-20742): Stop parsing epoch separately after 3.2.
- auto& operationVersion = OperationShardVersion::get(txn);
- if (operationVersion.hasShardVersion()) {
- _collectionVersion = operationVersion.getShardVersion(_nss);
- _collectionEpoch = _collectionVersion.epoch();
- } // else the epoch will already be set from the parsing of the ChunkMoveOperationState
-
- if (_collectionEpoch != _shardVersion.epoch()) {
- const string msg = stream() << "moveChunk cannot move chunk "
- << "[" << _minKey << "," << _maxKey << "), "
- << "collection may have been dropped. "
- << "current epoch: " << _shardVersion.epoch()
- << ", cmd epoch: " << _collectionEpoch;
- warning() << msg;
- throw SendStaleConfigException(_nss.toString(), msg, _collectionVersion, _shardVersion);
- }
+ if (_collectionEpoch != _shardVersion.epoch()) {
+ const string msg = stream() << "moveChunk cannot move chunk "
+ << "[" << _minKey << "," << _maxKey << "), "
+ << "collection may have been dropped. "
+ << "current epoch: " << _shardVersion.epoch()
+ << ", cmd epoch: " << _collectionEpoch;
+ warning() << msg;
+ return Status(ErrorCodes::IncompatibleShardingMetadata, msg);
}
_collMetadata = shardingState->getCollectionMetadata(_nss.ns());
@@ -259,7 +247,7 @@ StatusWith<ForwardingCatalogManager::ScopedDistLock*> ChunkMoveOperationState::a
<< "[" << _minKey << "," << _maxKey << ")"
<< " to migrate, the chunk boundaries may be stale";
warning() << msg;
- throw SendStaleConfigException(_nss.toString(), msg, _collectionVersion, _shardVersion);
+ return Status(ErrorCodes::IncompatibleShardingMetadata, msg);
}
return &_distLockStatus->getValue();
diff --git a/src/mongo/db/s/migration_impl.h b/src/mongo/db/s/migration_impl.h
index 5e074fc2844..2ac6b85c8ee 100644
--- a/src/mongo/db/s/migration_impl.h
+++ b/src/mongo/db/s/migration_impl.h
@@ -175,13 +175,9 @@ private:
ConnectionString _fromShardCS;
ConnectionString _toShardCS;
- // Epoch for the collection sent along with the command
- // TODO(SERVER-20742): remove this after 3.2, now that we're sending version it is redundant
+ // Expected epoch for the collection, whose chunks are being moved
OID _collectionEpoch;
- // ChunkVersion for the collection sent along with the command
- ChunkVersion _collectionVersion;
-
// Min and max key of the chunk being moved
BSONObj _minKey;
BSONObj _maxKey;