summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2016-01-13 15:11:14 -0500
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2016-01-20 08:25:10 -0500
commitf6716ef64ff42a71aa351dc4d10aebbbf893bb6c (patch)
tree4f7394a8e74e34a7797340a48c22536d81baf749
parent7a7efbb224163e439edfbb6eb1df47c833d814cd (diff)
downloadmongo-f6716ef64ff42a71aa351dc4d10aebbbf893bb6c.tar.gz
SERVER-22174 Cleanup unused sharding code
- Remove 2.2 unused code from _rectChunkStart - Make sure sharding migration clone phase uses ScopedTransaction - Remove unused code from cluster_write.cpp
-rw-r--r--src/mongo/client/parallel.cpp15
-rw-r--r--src/mongo/client/parallel.h7
-rw-r--r--src/mongo/db/s/migration_source_manager.cpp3
-rw-r--r--src/mongo/s/client/shard_connection.h3
-rw-r--r--src/mongo/s/cluster_write.cpp2
-rw-r--r--src/mongo/s/d_migrate.cpp20
6 files changed, 13 insertions, 37 deletions
diff --git a/src/mongo/client/parallel.cpp b/src/mongo/client/parallel.cpp
index 1468b1aa332..b338bf097b3 100644
--- a/src/mongo/client/parallel.cpp
+++ b/src/mongo/client/parallel.cpp
@@ -370,13 +370,14 @@ void ParallelSortClusteredCursor::_handleStaleNS(OperationContext* txn,
}
}
-void ParallelSortClusteredCursor::setupVersionAndHandleSlaveOk(OperationContext* txn,
- PCStatePtr state,
- const ShardId& shardId,
- std::shared_ptr<Shard> primary,
- const NamespaceString& ns,
- const string& vinfo,
- ChunkManagerPtr manager) {
+void ParallelSortClusteredCursor::setupVersionAndHandleSlaveOk(
+ OperationContext* txn,
+ PCStatePtr state,
+ const ShardId& shardId,
+ std::shared_ptr<Shard> primary,
+ const NamespaceString& ns,
+ const string& vinfo,
+ std::shared_ptr<ChunkManager> manager) {
if (manager) {
state->manager = manager;
} else if (primary) {
diff --git a/src/mongo/client/parallel.h b/src/mongo/client/parallel.h
index e96869efa81..65585d352b9 100644
--- a/src/mongo/client/parallel.h
+++ b/src/mongo/client/parallel.h
@@ -31,7 +31,6 @@
#pragma once
-
#include "mongo/db/namespace_string.h"
#include "mongo/s/client/shard.h"
#include "mongo/s/client/shard_connection.h"
@@ -71,11 +70,11 @@ public:
// Please do not reorder. cursor destructor can use conn.
// On a related note, never attempt to cleanup these pointers manually.
- ShardConnectionPtr conn;
+ std::shared_ptr<ShardConnection> conn;
DBClientCursorPtr cursor;
// Version information
- ChunkManagerPtr manager;
+ std::shared_ptr<ChunkManager> manager;
std::shared_ptr<Shard> primary;
// Cursor status information
@@ -215,7 +214,7 @@ private:
std::shared_ptr<Shard> primary /* in */,
const NamespaceString& ns,
const std::string& vinfo,
- ChunkManagerPtr manager /* in */);
+ std::shared_ptr<ChunkManager> manager /* in */);
// LEGACY init - Needed for map reduce
void _oldInit();
diff --git a/src/mongo/db/s/migration_source_manager.cpp b/src/mongo/db/s/migration_source_manager.cpp
index b100842eac5..6553e76b56e 100644
--- a/src/mongo/db/s/migration_source_manager.cpp
+++ b/src/mongo/db/s/migration_source_manager.cpp
@@ -335,6 +335,7 @@ bool MigrationSourceManager::storeCurrentLocs(OperationContext* txn,
long long maxChunkSize,
string& errmsg,
BSONObjBuilder& result) {
+ ScopedTransaction scopedXact(txn, MODE_IS);
AutoGetCollection autoColl(txn, _getNS(), MODE_IS);
Collection* collection = autoColl.getCollection();
@@ -448,8 +449,6 @@ bool MigrationSourceManager::storeCurrentLocs(OperationContext* txn,
}
log() << "moveChunk number of documents: " << cloneLocsRemaining() << migrateLog;
-
- txn->recoveryUnit()->abandonSnapshot();
return true;
}
diff --git a/src/mongo/s/client/shard_connection.h b/src/mongo/s/client/shard_connection.h
index f5902489983..7d73613a9c5 100644
--- a/src/mongo/s/client/shard_connection.h
+++ b/src/mongo/s/client/shard_connection.h
@@ -147,9 +147,6 @@ private:
bool _setVersion;
};
-typedef std::shared_ptr<ChunkManager> ChunkManagerPtr;
-typedef std::shared_ptr<ShardConnection> ShardConnectionPtr;
-
extern DBConnectionPool shardConnectionPool;
} // namespace mongo
diff --git a/src/mongo/s/cluster_write.cpp b/src/mongo/s/cluster_write.cpp
index f782d8cbda1..8fe610978a8 100644
--- a/src/mongo/s/cluster_write.cpp
+++ b/src/mongo/s/cluster_write.cpp
@@ -58,8 +58,6 @@ using std::map;
using std::string;
using std::stringstream;
-const int ConfigOpTimeoutMillis = 30 * 1000;
-
namespace {
/**
diff --git a/src/mongo/s/d_migrate.cpp b/src/mongo/s/d_migrate.cpp
index a5ba7abd118..89f300067ba 100644
--- a/src/mongo/s/d_migrate.cpp
+++ b/src/mongo/s/d_migrate.cpp
@@ -271,25 +271,7 @@ public:
uassertStatusOK(ChunkMoveWriteConcernOptions::initFromCommand(cmdObj));
const auto& writeConcern = moveWriteConcernOptions.getWriteConcern();
- BSONObj shardKeyPattern;
- if (cmdObj.hasField("shardKeyPattern")) {
- shardKeyPattern = cmdObj["shardKeyPattern"].Obj().getOwned();
- } else {
- // shardKeyPattern may not be provided if another shard is from pre 2.2
- // In that case, assume the shard key pattern is the same as the range
- // specifiers provided.
- BSONObj keya = Helpers::inferKeyPattern(min);
- BSONObj keyb = Helpers::inferKeyPattern(max);
- verify(keya == keyb);
-
- warning()
- << "No shard key pattern provided by source shard for migration."
- " This is likely because the source shard is running a version prior to 2.2."
- " Falling back to assuming the shard key matches the pattern of the min and max"
- " chunk range specifiers. Inferred shard key: " << keya;
-
- shardKeyPattern = keya.getOwned();
- }
+ BSONObj shardKeyPattern = cmdObj["shardKeyPattern"].Obj().getOwned();
const string fromShard(cmdObj["from"].String());