summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/balancer
diff options
context:
space:
mode:
authorKevin Pulo <kevin.pulo@mongodb.com>2018-02-01 07:39:32 +0000
committerKevin Pulo <kevin.pulo@mongodb.com>2018-02-01 07:39:32 +0000
commit6476d7205b2bf4a8d02bf877bb84f1290878bb04 (patch)
tree643d0826ea220b521e605d3f537b7b978eec3a83 /src/mongo/db/s/balancer
parentad7235f3b739c3aeb0c21ddaba58fd1cb494cc61 (diff)
downloadmongo-6476d7205b2bf4a8d02bf877bb84f1290878bb04.tar.gz
SERVER-18137 Use NamespaceString for fully-qualified ns in sharding
Diffstat (limited to 'src/mongo/db/s/balancer')
-rw-r--r--src/mongo/db/s/balancer/balancer.cpp4
-rw-r--r--src/mongo/db/s/balancer/balancer_chunk_selection_policy_impl.cpp13
-rw-r--r--src/mongo/db/s/balancer/balancer_policy.cpp8
-rw-r--r--src/mongo/db/s/balancer/balancer_policy.h3
-rw-r--r--src/mongo/db/s/balancer/balancer_policy_test.cpp2
-rw-r--r--src/mongo/db/s/balancer/migration_manager.cpp6
-rw-r--r--src/mongo/db/s/balancer/migration_manager_test.cpp60
-rw-r--r--src/mongo/db/s/balancer/scoped_migration_request.cpp7
-rw-r--r--src/mongo/db/s/balancer/scoped_migration_request_test.cpp4
-rw-r--r--src/mongo/db/s/balancer/type_migration.cpp8
-rw-r--r--src/mongo/db/s/balancer/type_migration.h3
11 files changed, 59 insertions, 59 deletions
diff --git a/src/mongo/db/s/balancer/balancer.cpp b/src/mongo/db/s/balancer/balancer.cpp
index 99fed7b8737..d537260c666 100644
--- a/src/mongo/db/s/balancer/balancer.cpp
+++ b/src/mongo/db/s/balancer/balancer.cpp
@@ -605,7 +605,7 @@ int Balancer::_moveChunks(OperationContext* opCtx,
log() << "Performing a split because migration " << redact(requestIt->toString())
<< " failed for size reasons" << causedBy(redact(status));
- _splitOrMarkJumbo(opCtx, NamespaceString(requestIt->ns), requestIt->minKey);
+ _splitOrMarkJumbo(opCtx, requestIt->nss, requestIt->minKey);
continue;
}
@@ -650,7 +650,7 @@ void Balancer::_splitOrMarkJumbo(OperationContext* opCtx,
chunk->markAsJumbo();
- const std::string chunkName = ChunkType::genID(nss.ns(), chunk->getMin());
+ const std::string chunkName = ChunkType::genID(nss, chunk->getMin());
auto status = Grid::get(opCtx)->catalogClient()->updateConfigDocument(
opCtx,
diff --git a/src/mongo/db/s/balancer/balancer_chunk_selection_policy_impl.cpp b/src/mongo/db/s/balancer/balancer_chunk_selection_policy_impl.cpp
index c00455f05cd..5e89baca4e1 100644
--- a/src/mongo/db/s/balancer/balancer_chunk_selection_policy_impl.cpp
+++ b/src/mongo/db/s/balancer/balancer_chunk_selection_policy_impl.cpp
@@ -86,12 +86,11 @@ StatusWith<DistributionStatus> createCollectionDistributionStatus(
Grid::get(opCtx)->catalogClient()->getTagsForCollection(opCtx, chunkMgr->getns());
if (!swCollectionTags.isOK()) {
return swCollectionTags.getStatus().withContext(
- str::stream() << "Unable to load tags for collection " << chunkMgr->getns());
+ str::stream() << "Unable to load tags for collection " << chunkMgr->getns().ns());
}
const auto& collectionTags = swCollectionTags.getValue();
- DistributionStatus distribution(NamespaceString(chunkMgr->getns()),
- std::move(shardToChunksMap));
+ DistributionStatus distribution(chunkMgr->getns(), std::move(shardToChunksMap));
// Cache the collection tags
const auto& keyPattern = chunkMgr->getShardKeyPattern().getKeyPattern();
@@ -298,8 +297,8 @@ BalancerChunkSelectionPolicyImpl::selectSpecificChunkToMove(OperationContext* op
const auto& shardStats = shardStatsStatus.getValue();
auto routingInfoStatus =
- Grid::get(opCtx)->catalogCache()->getShardedCollectionRoutingInfoWithRefresh(
- opCtx, NamespaceString(chunk.getNS()));
+ Grid::get(opCtx)->catalogCache()->getShardedCollectionRoutingInfoWithRefresh(opCtx,
+ chunk.getNS());
if (!routingInfoStatus.isOK()) {
return routingInfoStatus.getStatus();
}
@@ -327,8 +326,8 @@ Status BalancerChunkSelectionPolicyImpl::checkMoveAllowed(OperationContext* opCt
auto shardStats = std::move(shardStatsStatus.getValue());
auto routingInfoStatus =
- Grid::get(opCtx)->catalogCache()->getShardedCollectionRoutingInfoWithRefresh(
- opCtx, NamespaceString(chunk.getNS()));
+ Grid::get(opCtx)->catalogCache()->getShardedCollectionRoutingInfoWithRefresh(opCtx,
+ chunk.getNS());
if (!routingInfoStatus.isOK()) {
return routingInfoStatus.getStatus();
}
diff --git a/src/mongo/db/s/balancer/balancer_policy.cpp b/src/mongo/db/s/balancer/balancer_policy.cpp
index 46a20de8676..7239f9b9e61 100644
--- a/src/mongo/db/s/balancer/balancer_policy.cpp
+++ b/src/mongo/db/s/balancer/balancer_policy.cpp
@@ -537,7 +537,7 @@ MigrateInfo::MigrateInfo(const ShardId& a_to, const ChunkType& a_chunk) {
to = a_to;
- ns = a_chunk.getNS();
+ nss = a_chunk.getNS();
from = a_chunk.getShard();
minKey = a_chunk.getMin();
maxKey = a_chunk.getMax();
@@ -545,12 +545,12 @@ MigrateInfo::MigrateInfo(const ShardId& a_to, const ChunkType& a_chunk) {
}
std::string MigrateInfo::getName() const {
- return ChunkType::genID(ns, minKey);
+ return ChunkType::genID(nss, minKey);
}
string MigrateInfo::toString() const {
- return str::stream() << ns << ": [" << minKey << ", " << maxKey << "), from " << from << ", to "
- << to;
+ return str::stream() << nss.ns() << ": [" << minKey << ", " << maxKey << "), from " << from
+ << ", to " << to;
}
} // namespace mongo
diff --git a/src/mongo/db/s/balancer/balancer_policy.h b/src/mongo/db/s/balancer/balancer_policy.h
index afba1db4915..ed70c40d3c9 100644
--- a/src/mongo/db/s/balancer/balancer_policy.h
+++ b/src/mongo/db/s/balancer/balancer_policy.h
@@ -34,6 +34,7 @@
#include "mongo/base/disallow_copying.h"
#include "mongo/bson/bsonobj.h"
#include "mongo/bson/simple_bsonobj_comparator.h"
+#include "mongo/db/namespace_string.h"
#include "mongo/db/s/balancer/cluster_statistics.h"
#include "mongo/s/catalog/type_chunk.h"
#include "mongo/s/shard_id.h"
@@ -57,7 +58,7 @@ struct MigrateInfo {
std::string toString() const;
- std::string ns;
+ NamespaceString nss;
ShardId to;
ShardId from;
BSONObj minKey;
diff --git a/src/mongo/db/s/balancer/balancer_policy_test.cpp b/src/mongo/db/s/balancer/balancer_policy_test.cpp
index f6abd7c8acf..14e34cf298a 100644
--- a/src/mongo/db/s/balancer/balancer_policy_test.cpp
+++ b/src/mongo/db/s/balancer/balancer_policy_test.cpp
@@ -91,7 +91,7 @@ std::pair<ShardStatisticsVector, ShardToChunksMap> generateCluster(
for (size_t i = 0; i < numChunks; i++, currentChunk++) {
ChunkType chunk;
- chunk.setNS(kNamespace.ns());
+ chunk.setNS(kNamespace);
chunk.setMin(currentChunk == 0 ? shardKeyPattern.globalMin()
: BSON("x" << currentChunk));
chunk.setMax(currentChunk == totalNumChunks - 1 ? shardKeyPattern.globalMax()
diff --git a/src/mongo/db/s/balancer/migration_manager.cpp b/src/mongo/db/s/balancer/migration_manager.cpp
index 0beffad2508..ce7ed13d743 100644
--- a/src/mongo/db/s/balancer/migration_manager.cpp
+++ b/src/mongo/db/s/balancer/migration_manager.cpp
@@ -183,7 +183,7 @@ Status MigrationManager::executeManualMigration(
auto routingInfoStatus =
Grid::get(opCtx)->catalogCache()->getShardedCollectionRoutingInfoWithRefresh(
- opCtx, NamespaceString(migrateInfo.ns));
+ opCtx, migrateInfo.nss);
if (!routingInfoStatus.isOK()) {
return routingInfoStatus.getStatus();
}
@@ -228,7 +228,7 @@ void MigrationManager::startRecoveryAndAcquireDistLocks(OperationContext* opCtx)
opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
repl::ReadConcernLevel::kLocalReadConcern,
- NamespaceString(MigrationType::ConfigNS),
+ MigrationType::ConfigNS,
BSONObj(),
BSONObj(),
boost::none);
@@ -417,7 +417,7 @@ shared_ptr<Notification<RemoteCommandResponse>> MigrationManager::_schedule(
uint64_t maxChunkSizeBytes,
const MigrationSecondaryThrottleOptions& secondaryThrottle,
bool waitForDelete) {
- const NamespaceString nss(migrateInfo.ns);
+ const NamespaceString& nss = migrateInfo.nss;
// Ensure we are not stopped in order to avoid doing the extra work
{
diff --git a/src/mongo/db/s/balancer/migration_manager_test.cpp b/src/mongo/db/s/balancer/migration_manager_test.cpp
index 70718a25504..515ebceb7b2 100644
--- a/src/mongo/db/s/balancer/migration_manager_test.cpp
+++ b/src/mongo/db/s/balancer/migration_manager_test.cpp
@@ -99,13 +99,13 @@ protected:
* Inserts a document into the config.collections collection to indicate that "collName" is
* sharded with version "version". The shard key pattern defaults to "_id".
*/
- void setUpCollection(const std::string collName, ChunkVersion version);
+ void setUpCollection(const NamespaceString& collName, ChunkVersion version);
/**
* Inserts a document into the config.chunks collection so that the chunk defined by the
* parameters exists. Returns a ChunkType defined by the parameters.
*/
- ChunkType setUpChunk(const std::string& collName,
+ ChunkType setUpChunk(const NamespaceString& collName,
const BSONObj& chunkMin,
const BSONObj& chunkMax,
const ShardId& shardId,
@@ -188,9 +188,9 @@ void MigrationManagerTest::setUpDatabase(const std::string& dbName, const ShardI
operationContext(), DatabaseType::ConfigNS, db.toBSON(), kMajorityWriteConcern));
}
-void MigrationManagerTest::setUpCollection(const std::string collName, ChunkVersion version) {
+void MigrationManagerTest::setUpCollection(const NamespaceString& collName, ChunkVersion version) {
CollectionType coll;
- coll.setNs(NamespaceString(collName));
+ coll.setNs(collName);
coll.setEpoch(version.epoch());
coll.setUpdatedAt(Date_t::fromMillisSinceEpoch(version.toLong()));
coll.setKeyPattern(kKeyPattern);
@@ -199,7 +199,7 @@ void MigrationManagerTest::setUpCollection(const std::string collName, ChunkVers
operationContext(), CollectionType::ConfigNS, coll.toBSON(), kMajorityWriteConcern));
}
-ChunkType MigrationManagerTest::setUpChunk(const std::string& collName,
+ChunkType MigrationManagerTest::setUpChunk(const NamespaceString& collName,
const BSONObj& chunkMin,
const BSONObj& chunkMax,
const ShardId& shardId,
@@ -217,7 +217,7 @@ ChunkType MigrationManagerTest::setUpChunk(const std::string& collName,
void MigrationManagerTest::setUpMigration(const ChunkType& chunk, const ShardId& toShard) {
BSONObjBuilder builder;
- builder.append(MigrationType::ns(), chunk.getNS());
+ builder.append(MigrationType::ns(), chunk.getNS().ns());
builder.append(MigrationType::min(), chunk.getMin());
builder.append(MigrationType::max(), chunk.getMax());
builder.append(MigrationType::toShard(), toShard.toString());
@@ -237,7 +237,7 @@ void MigrationManagerTest::checkMigrationsCollectionIsEmptyAndLocksAreUnlocked()
operationContext(),
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
repl::ReadConcernLevel::kMajorityReadConcern,
- NamespaceString(MigrationType::ConfigNS),
+ MigrationType::ConfigNS,
BSONObj(),
BSONObj(),
boost::none);
@@ -249,7 +249,7 @@ void MigrationManagerTest::checkMigrationsCollectionIsEmptyAndLocksAreUnlocked()
operationContext(),
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
repl::ReadConcernLevel::kMajorityReadConcern,
- NamespaceString(LocksType::ConfigNS),
+ LocksType::ConfigNS,
BSON(LocksType::state(LocksType::LOCKED) << LocksType::name("{ '$ne' : 'balancer'}")),
BSONObj(),
boost::none);
@@ -262,13 +262,13 @@ void MigrationManagerTest::expectMoveChunkCommand(const ChunkType& chunk,
const BSONObj& response) {
onCommand([&chunk, &toShardId, &response](const RemoteCommandRequest& request) {
NamespaceString nss(request.cmdObj.firstElement().valueStringData());
- ASSERT_EQ(chunk.getNS(), nss.ns());
+ ASSERT_EQ(chunk.getNS(), nss);
const StatusWith<MoveChunkRequest> moveChunkRequestWithStatus =
MoveChunkRequest::createFromCommand(nss, request.cmdObj);
ASSERT_OK(moveChunkRequestWithStatus.getStatus());
- ASSERT_EQ(chunk.getNS(), moveChunkRequestWithStatus.getValue().getNss().ns());
+ ASSERT_EQ(chunk.getNS(), moveChunkRequestWithStatus.getValue().getNss());
ASSERT_BSONOBJ_EQ(chunk.getMin(), moveChunkRequestWithStatus.getValue().getMinKey());
ASSERT_BSONOBJ_EQ(chunk.getMax(), moveChunkRequestWithStatus.getValue().getMaxKey());
ASSERT_EQ(chunk.getShard(), moveChunkRequestWithStatus.getValue().getFromShardId());
@@ -295,8 +295,8 @@ TEST_F(MigrationManagerTest, OneCollectionTwoMigrations) {
operationContext(), ShardType::ConfigNS, kShard2, kMajorityWriteConcern));
// Set up the database and collection as sharded in the metadata.
- std::string dbName = "foo";
- std::string collName = "foo.bar";
+ const std::string dbName = "foo";
+ const NamespaceString collName(dbName, "bar");
ChunkVersion version(2, 0, OID::gen());
setUpDatabase(dbName, kShardId0);
@@ -347,8 +347,8 @@ TEST_F(MigrationManagerTest, TwoCollectionsTwoMigrationsEach) {
// Set up a database and two collections as sharded in the metadata.
std::string dbName = "foo";
- std::string collName1 = "foo.bar";
- std::string collName2 = "foo.baz";
+ const NamespaceString collName1(dbName, "bar");
+ const NamespaceString collName2(dbName, "baz");
ChunkVersion version1(2, 0, OID::gen());
ChunkVersion version2(2, 0, OID::gen());
@@ -413,8 +413,8 @@ TEST_F(MigrationManagerTest, SourceShardNotFound) {
operationContext(), ShardType::ConfigNS, kShard2, kMajorityWriteConcern));
// Set up the database and collection as sharded in the metadata.
- std::string dbName = "foo";
- std::string collName = "foo.bar";
+ const std::string dbName = "foo";
+ const NamespaceString collName(dbName, "bar");
ChunkVersion version(2, 0, OID::gen());
setUpDatabase(dbName, kShardId0);
@@ -463,8 +463,8 @@ TEST_F(MigrationManagerTest, JumboChunkResponseBackwardsCompatibility) {
operationContext(), ShardType::ConfigNS, kShard0, kMajorityWriteConcern));
// Set up the database and collection as sharded in the metadata.
- std::string dbName = "foo";
- std::string collName = "foo.bar";
+ const std::string dbName = "foo";
+ const NamespaceString collName(dbName, "bar");
ChunkVersion version(2, 0, OID::gen());
setUpDatabase(dbName, kShardId0);
@@ -505,8 +505,8 @@ TEST_F(MigrationManagerTest, InterruptMigration) {
operationContext(), ShardType::ConfigNS, kShard0, kMajorityWriteConcern));
// Set up the database and collection as sharded in the metadata.
- std::string dbName = "foo";
- std::string collName = "foo.bar";
+ const std::string dbName = "foo";
+ const NamespaceString collName(dbName, "bar");
ChunkVersion version(2, 0, OID::gen());
setUpDatabase(dbName, kShardId0);
@@ -564,7 +564,7 @@ TEST_F(MigrationManagerTest, InterruptMigration) {
operationContext(),
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
repl::ReadConcernLevel::kMajorityReadConcern,
- NamespaceString(MigrationType::ConfigNS),
+ MigrationType::ConfigNS,
BSON(MigrationType::name(chunk.getName())),
BSONObj(),
boost::none);
@@ -588,8 +588,8 @@ TEST_F(MigrationManagerTest, RestartMigrationManager) {
operationContext(), ShardType::ConfigNS, kShard0, kMajorityWriteConcern));
// Set up the database and collection as sharded in the metadata.
- std::string dbName = "foo";
- std::string collName = "foo.bar";
+ const std::string dbName = "foo";
+ const NamespaceString collName(dbName, "bar");
ChunkVersion version(2, 0, OID::gen());
setUpDatabase(dbName, kShardId0);
@@ -633,8 +633,8 @@ TEST_F(MigrationManagerTest, MigrationRecovery) {
operationContext(), ShardType::ConfigNS, kShard2, kMajorityWriteConcern));
// Set up the database and collection as sharded in the metadata.
- std::string dbName = "foo";
- std::string collName = "foo.bar";
+ const std::string dbName = "foo";
+ const NamespaceString collName(dbName, "bar");
ChunkVersion version(1, 0, OID::gen());
setUpDatabase(dbName, kShardId0);
@@ -689,8 +689,8 @@ TEST_F(MigrationManagerTest, FailMigrationRecovery) {
operationContext(), ShardType::ConfigNS, kShard2, kMajorityWriteConcern));
// Set up the database and collection as sharded in the metadata.
- std::string dbName = "foo";
- std::string collName = "foo.bar";
+ const std::string dbName = "foo";
+ const NamespaceString collName(dbName, "bar");
ChunkVersion version(1, 0, OID::gen());
setUpDatabase(dbName, kShardId0);
@@ -725,7 +725,7 @@ TEST_F(MigrationManagerTest, FailMigrationRecovery) {
// session ID used here doesn't matter.
ASSERT_OK(catalogClient()->getDistLockManager()->lockWithSessionID(
operationContext(),
- collName,
+ collName.ns(),
"MigrationManagerTest",
OID::gen(),
DistLockManager::kSingleLockAttemptTimeout));
@@ -748,8 +748,8 @@ TEST_F(MigrationManagerTest, RemoteCallErrorConversionToOperationFailed) {
operationContext(), ShardType::ConfigNS, kShard2, kMajorityWriteConcern));
// Set up the database and collection as sharded in the metadata.
- std::string dbName = "foo";
- std::string collName = "foo.bar";
+ const std::string dbName = "foo";
+ const NamespaceString collName(dbName, "bar");
ChunkVersion version(1, 0, OID::gen());
setUpDatabase(dbName, kShardId0);
diff --git a/src/mongo/db/s/balancer/scoped_migration_request.cpp b/src/mongo/db/s/balancer/scoped_migration_request.cpp
index d55855b14b8..6cf19c1f4bf 100644
--- a/src/mongo/db/s/balancer/scoped_migration_request.cpp
+++ b/src/mongo/db/s/balancer/scoped_migration_request.cpp
@@ -110,7 +110,7 @@ StatusWith<ScopedMigrationRequest> ScopedMigrationRequest::writeMigration(
opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
repl::ReadConcernLevel::kLocalReadConcern,
- NamespaceString(MigrationType::ConfigNS),
+ MigrationType::ConfigNS,
BSON(MigrationType::name(migrateInfo.getName())),
BSONObj(),
boost::none);
@@ -156,8 +156,7 @@ StatusWith<ScopedMigrationRequest> ScopedMigrationRequest::writeMigration(
// As long as there isn't a DuplicateKey error, the document may have been written, and it's
// safe (won't delete another migration's document) and necessary to try to clean up the
// document via the destructor.
- ScopedMigrationRequest scopedMigrationRequest(
- opCtx, NamespaceString(migrateInfo.ns), migrateInfo.minKey);
+ ScopedMigrationRequest scopedMigrationRequest(opCtx, migrateInfo.nss, migrateInfo.minKey);
// If there was a write error, let the object go out of scope and clean up in the
// destructor.
@@ -173,7 +172,7 @@ StatusWith<ScopedMigrationRequest> ScopedMigrationRequest::writeMigration(
<< "number of retries. Chunk '"
<< ChunkRange(migrateInfo.minKey, migrateInfo.maxKey).toString()
<< "' in collection '"
- << migrateInfo.ns
+ << migrateInfo.nss.ns()
<< "' was being moved (somewhere) by another operation.");
}
diff --git a/src/mongo/db/s/balancer/scoped_migration_request_test.cpp b/src/mongo/db/s/balancer/scoped_migration_request_test.cpp
index 1aab0157210..1d9b7ba6c7d 100644
--- a/src/mongo/db/s/balancer/scoped_migration_request_test.cpp
+++ b/src/mongo/db/s/balancer/scoped_migration_request_test.cpp
@@ -71,7 +71,7 @@ void ScopedMigrationRequestTest::checkMigrationsCollectionForDocument(
operationContext(),
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
repl::ReadConcernLevel::kMajorityReadConcern,
- NamespaceString(MigrationType::ConfigNS),
+ MigrationType::ConfigNS,
BSON(MigrationType::name(chunkName)),
BSONObj(),
boost::none);
@@ -161,7 +161,7 @@ TEST_F(ScopedMigrationRequestTest, CreateScopedMigrationRequestOnRecovery) {
// still removes the document corresponding to the MigrationRequest.
{
ScopedMigrationRequest scopedMigrationRequest = ScopedMigrationRequest::createForRecovery(
- operationContext(), NamespaceString(migrateInfo.ns), migrateInfo.minKey);
+ operationContext(), migrateInfo.nss, migrateInfo.minKey);
checkMigrationsCollectionForDocument(migrateInfo.getName(), 1);
}
diff --git a/src/mongo/db/s/balancer/type_migration.cpp b/src/mongo/db/s/balancer/type_migration.cpp
index efaf453048d..e6341b77685 100644
--- a/src/mongo/db/s/balancer/type_migration.cpp
+++ b/src/mongo/db/s/balancer/type_migration.cpp
@@ -40,7 +40,7 @@ const StringData kChunkVersion = "chunkVersion"_sd;
} // namespace
-const std::string MigrationType::ConfigNS = "config.migrations";
+const NamespaceString MigrationType::ConfigNS("config.migrations");
const BSONField<std::string> MigrationType::name("_id");
const BSONField<std::string> MigrationType::ns("ns");
@@ -53,7 +53,7 @@ const BSONField<bool> MigrationType::waitForDelete("waitForDelete");
MigrationType::MigrationType() = default;
MigrationType::MigrationType(MigrateInfo info, bool waitForDelete)
- : _nss(NamespaceString(info.ns)),
+ : _nss(info.nss),
_min(info.minKey),
_max(info.maxKey),
_fromShard(info.from),
@@ -138,7 +138,7 @@ BSONObj MigrationType::toBSON() const {
MigrateInfo MigrationType::toMigrateInfo() const {
ChunkType chunk;
- chunk.setNS(_nss.ns());
+ chunk.setNS(_nss);
chunk.setShard(_fromShard);
chunk.setMin(_min);
chunk.setMax(_max);
@@ -148,7 +148,7 @@ MigrateInfo MigrationType::toMigrateInfo() const {
}
std::string MigrationType::getName() const {
- return ChunkType::genID(_nss.ns(), _min);
+ return ChunkType::genID(_nss, _min);
}
} // namespace mongo
diff --git a/src/mongo/db/s/balancer/type_migration.h b/src/mongo/db/s/balancer/type_migration.h
index dd35bd9b844..000145c0941 100644
--- a/src/mongo/db/s/balancer/type_migration.h
+++ b/src/mongo/db/s/balancer/type_migration.h
@@ -29,6 +29,7 @@
#pragma once
#include "mongo/bson/bsonobj.h"
+#include "mongo/db/namespace_string.h"
#include "mongo/db/s/balancer/balancer_policy.h"
#include "mongo/s/chunk_version.h"
#include "mongo/s/client/shard.h"
@@ -43,7 +44,7 @@ namespace mongo {
class MigrationType {
public:
// Name of the migrations collection in the config server.
- static const std::string ConfigNS;
+ static const NamespaceString ConfigNS;
// Field names and types in the migrations collection type.
static const BSONField<std::string> name;