summaryrefslogtreecommitdiff
path: root/src/mongo/s
diff options
context:
space:
mode:
authorBlake Oler <blake.oler@mongodb.com>2020-04-14 12:23:43 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-04-24 14:47:56 +0000
commit3cc55fa1d000155d149662488257f226ea2b1820 (patch)
treeb6d4f6467ba2b39bc718ac955576751347c65e28 /src/mongo/s
parent3566db153ea61fb10d3ef11ea917fc7bc93eac4d (diff)
downloadmongo-3cc55fa1d000155d149662488257f226ea2b1820.tar.gz
SERVER-47426 Remove ShardedConnectionInfo and pare down SetShardVersion
Diffstat (limited to 'src/mongo/s')
-rw-r--r--src/mongo/s/config_server_test_fixture.cpp1
-rw-r--r--src/mongo/s/request_types/set_shard_version_request.cpp92
-rw-r--r--src/mongo/s/request_types/set_shard_version_request.h87
-rw-r--r--src/mongo/s/request_types/set_shard_version_request_test.cpp169
-rw-r--r--src/mongo/s/sharding_router_test_fixture.cpp1
5 files changed, 29 insertions, 321 deletions
diff --git a/src/mongo/s/config_server_test_fixture.cpp b/src/mongo/s/config_server_test_fixture.cpp
index 6f774f08f74..e098bc0fa1c 100644
--- a/src/mongo/s/config_server_test_fixture.cpp
+++ b/src/mongo/s/config_server_test_fixture.cpp
@@ -417,7 +417,6 @@ void ConfigServerTestFixture::expectSetShardVersion(
SetShardVersionRequest ssv =
assertGet(SetShardVersionRequest::parseFromBSON(request.cmdObj));
- ASSERT(!ssv.isInit());
ASSERT(ssv.isAuthoritative());
ASSERT_EQ(expectedShard.getHost(), ssv.getShardConnectionString().toString());
ASSERT_EQ(expectedNs.toString(), ssv.getNS().ns());
diff --git a/src/mongo/s/request_types/set_shard_version_request.cpp b/src/mongo/s/request_types/set_shard_version_request.cpp
index f05fa4093f3..72fa066452e 100644
--- a/src/mongo/s/request_types/set_shard_version_request.cpp
+++ b/src/mongo/s/request_types/set_shard_version_request.cpp
@@ -46,7 +46,6 @@ const char kCmdName[] = "setShardVersion";
const char kConfigServer[] = "configdb";
const char kShardName[] = "shard";
const char kShardConnectionString[] = "shardHost";
-const char kInit[] = "init";
const char kForceRefresh[] = "forceRefresh";
const char kAuthoritative[] = "authoritative";
const char kNoConnectionVersioning[] = "noConnectionVersioning";
@@ -57,22 +56,12 @@ constexpr StringData SetShardVersionRequest::kVersion;
SetShardVersionRequest::SetShardVersionRequest(ConnectionString configServer,
ShardId shardName,
- ConnectionString shardConnectionString)
- : _init(true),
- _isAuthoritative(true),
- _configServer(std::move(configServer)),
- _shardName(std::move(shardName)),
- _shardCS(std::move(shardConnectionString)) {}
-
-SetShardVersionRequest::SetShardVersionRequest(ConnectionString configServer,
- ShardId shardName,
ConnectionString shardConnectionString,
NamespaceString nss,
ChunkVersion version,
bool isAuthoritative,
bool forceRefresh)
- : _init(false),
- _isAuthoritative(isAuthoritative),
+ : _isAuthoritative(isAuthoritative),
_forceRefresh(forceRefresh),
_configServer(std::move(configServer)),
_shardName(std::move(shardName)),
@@ -82,46 +71,6 @@ SetShardVersionRequest::SetShardVersionRequest(ConnectionString configServer,
SetShardVersionRequest::SetShardVersionRequest() = default;
-SetShardVersionRequest SetShardVersionRequest::makeForInit(
- const ConnectionString& configServer,
- const ShardId& shardName,
- const ConnectionString& shardConnectionString) {
- return SetShardVersionRequest(configServer, shardName, shardConnectionString);
-}
-
-SetShardVersionRequest SetShardVersionRequest::makeForVersioning(
- const ConnectionString& configServer,
- const ShardId& shardName,
- const ConnectionString& shardConnectionString,
- const NamespaceString& nss,
- const ChunkVersion& nssVersion,
- bool isAuthoritative,
- bool forceRefresh) {
- invariant(nss.isValid());
- return SetShardVersionRequest(configServer,
- shardName,
- shardConnectionString,
- nss,
- nssVersion,
- isAuthoritative,
- forceRefresh);
-}
-
-SetShardVersionRequest SetShardVersionRequest::makeForVersioningNoPersist(
- const ConnectionString& configServer,
- const ShardId& shardName,
- const ConnectionString& shard,
- const NamespaceString& nss,
- const ChunkVersion& nssVersion,
- bool isAuthoritative,
- bool forceRefresh) {
- auto ssv = makeForVersioning(
- configServer, shardName, shard, nss, nssVersion, isAuthoritative, forceRefresh);
- ssv._noConnectionVersioning = true;
-
- return ssv;
-}
-
StatusWith<SetShardVersionRequest> SetShardVersionRequest::parseFromBSON(const BSONObj& cmdObj) {
SetShardVersionRequest request;
@@ -148,12 +97,6 @@ StatusWith<SetShardVersionRequest> SetShardVersionRequest::parseFromBSON(const B
}
{
- Status status = bsonExtractBooleanFieldWithDefault(cmdObj, kInit, false, &request._init);
- if (!status.isOK())
- return status;
- }
-
- {
Status status = bsonExtractBooleanFieldWithDefault(
cmdObj, kForceRefresh, false, &request._forceRefresh);
if (!status.isOK())
@@ -168,19 +111,6 @@ StatusWith<SetShardVersionRequest> SetShardVersionRequest::parseFromBSON(const B
}
{
- Status status = bsonExtractBooleanFieldWithDefault(
- cmdObj, kNoConnectionVersioning, false, &request._noConnectionVersioning);
- if (!status.isOK())
- return status;
- }
-
- if (request.isInit()) {
- return request;
- }
-
- // Only initialize the version information if this is not an "init" request
-
- {
std::string ns;
Status status = bsonExtractStringField(cmdObj, kCmdName, &ns);
if (!status.isOK())
@@ -210,37 +140,25 @@ StatusWith<SetShardVersionRequest> SetShardVersionRequest::parseFromBSON(const B
BSONObj SetShardVersionRequest::toBSON() const {
BSONObjBuilder cmdBuilder;
- cmdBuilder.append(kCmdName, _init ? "" : _nss.get().ns());
- cmdBuilder.append(kInit, _init);
+ cmdBuilder.append(kCmdName, _nss.get().ns());
cmdBuilder.append(kForceRefresh, _forceRefresh);
cmdBuilder.append(kAuthoritative, _isAuthoritative);
- // 'configdb' field is only included for v3.4 backwards compatibility
+ // TODO (SERVER-47440): Remove adding config server to BSON once v4.4 parsing is
+ // removed.
cmdBuilder.append(kConfigServer, _configServer.toString());
cmdBuilder.append(kShardName, _shardName.toString());
cmdBuilder.append(kShardConnectionString, _shardCS.toString());
- if (_init) {
- // Always include a 30 second timeout on sharding state initialization, to work around
- // SERVER-21458.
- cmdBuilder.append(QueryRequest::cmdOptionMaxTimeMS, 30000);
- } else {
- _version->appendLegacyWithField(&cmdBuilder, kVersion);
- }
-
- if (_noConnectionVersioning) {
- cmdBuilder.append(kNoConnectionVersioning, true);
- }
+ _version->appendLegacyWithField(&cmdBuilder, kVersion);
return cmdBuilder.obj();
}
const NamespaceString& SetShardVersionRequest::getNS() const {
- invariant(!_init);
return _nss.get();
}
const ChunkVersion SetShardVersionRequest::getNSVersion() const {
- invariant(!_init);
return _version.get();
}
diff --git a/src/mongo/s/request_types/set_shard_version_request.h b/src/mongo/s/request_types/set_shard_version_request.h
index 59e571b20c4..70c5ee678e3 100644
--- a/src/mongo/s/request_types/set_shard_version_request.h
+++ b/src/mongo/s/request_types/set_shard_version_request.h
@@ -50,50 +50,13 @@ class SetShardVersionRequest {
public:
static constexpr StringData kVersion = "version"_sd;
- /**
- * Constructs a new set shard version request, which is of the "init" type, meaning it has no
- * namespace or version information associated with it and the init flag is set.
- * The constructed request will not contain the "noConnectionVersioning" field, which means that
- * the entire connection will be marked as "versioned" on the mongod side. DO NOT USE when
- * sending through the TaskExecutor, which pools connections without consideration for which
- * are marked as sharded.
- */
- static SetShardVersionRequest makeForInit(const ConnectionString& configServer,
- const ShardId& shardName,
- const ConnectionString& shardConnectionString);
-
- /**
- * Constructs a new set shard version request, which is of the "versioning" type, meaning it has
- * both initialization data and namespace and version information associated with it.
- *
- * The constructed request will not contain the "noConnectionVersioning" field, which means that
- * the entire connection will be marked as "versioned" on the mongod side. DO NOT USE when
- * sending through the TaskExecutor, which pools connections without consideration for which
- * are marked as sharded.
- */
- static SetShardVersionRequest makeForVersioning(const ConnectionString& configServer,
- const ShardId& shardName,
- const ConnectionString& shard,
- const NamespaceString& nss,
- const ChunkVersion& nssVersion,
- bool isAuthoritative,
- bool forceRefresh = false);
-
- /**
- * Constructs a new set shard version request, which is of the "versioning" type, meaning it has
- * both initialization data and namespace and version information associated with it. In
- * addition, the request will contain the "noConnectionVersioning" field, which means that the
- * connection WILL NOT be marked as "versioned". DO NOT USE except on connections only used
- * with operations that do per-operation versioning, and do not depend on the connection being
- * marked as sharded.
- */
- static SetShardVersionRequest makeForVersioningNoPersist(const ConnectionString& configServer,
- const ShardId& shardName,
- const ConnectionString& shard,
- const NamespaceString& nss,
- const ChunkVersion& nssVersion,
- bool isAuthoritative,
- bool forceRefresh = false);
+ SetShardVersionRequest(ConnectionString configServer,
+ ShardId shardName,
+ ConnectionString shardConnectionString,
+ NamespaceString nss,
+ ChunkVersion version,
+ bool isAuthoritative,
+ bool forceRefresh = false);
/**
* Parses an SSV request from a set shard version command.
@@ -106,16 +69,6 @@ public:
BSONObj toBSON() const;
/**
- * Returns whether this is an "init" type of request, where we only have the config server
- * information and the identity that the targeted shard should assume or it contains namespace
- * version as well. If this value is true, it is illegal to access anything other than the
- * config server, shard name and shard connection string fields.
- */
- bool isInit() const {
- return _init;
- }
-
- /**
* Returns whether this request should force the version to be set instead of it being reloaded
* and recalculated from the metadata.
*/
@@ -154,41 +107,19 @@ public:
*/
const ChunkVersion getNSVersion() const;
- /**
- * Returns whether this setShardVersion request should be persisted on the connection or it
- * should only be used to initialize the namespace in the global sharding state.
- */
- bool getNoConnectionVersioning() const {
- return _noConnectionVersioning;
- }
-
private:
- SetShardVersionRequest(ConnectionString configServer,
- ShardId shardName,
- ConnectionString shardConnectionString);
-
- SetShardVersionRequest(ConnectionString configServer,
- ShardId shardName,
- ConnectionString shardConnectionString,
- NamespaceString nss,
- ChunkVersion version,
- bool isAuthoritative,
- bool forceRefresh = false);
-
SetShardVersionRequest();
- bool _init{false};
bool _isAuthoritative{false};
bool _forceRefresh{false};
- bool _noConnectionVersioning{false};
- // Only required for v3.4 backwards compatibility.
+ // TODO (SERVER-47440): Remove this parameter once the v4.4 SetShardVersion command stops
+ // parsing it.
ConnectionString _configServer;
ShardId _shardName;
ConnectionString _shardCS;
- // These values are only set if _init is false
boost::optional<NamespaceString> _nss;
boost::optional<ChunkVersion> _version;
};
diff --git a/src/mongo/s/request_types/set_shard_version_request_test.cpp b/src/mongo/s/request_types/set_shard_version_request_test.cpp
index 59003730f98..2f1a2e880ca 100644
--- a/src/mongo/s/request_types/set_shard_version_request_test.cpp
+++ b/src/mongo/s/request_types/set_shard_version_request_test.cpp
@@ -46,53 +46,6 @@ const ConnectionString configCS = ConnectionString::forReplicaSet(
const ConnectionString shardCS = ConnectionString::forReplicaSet(
"ShardRS", {HostAndPort{"shardHost1:12345"}, HostAndPort{"shardHost2:12345"}});
-TEST(SetShardVersionRequest, ParseInitMissingAuthoritative) {
- SetShardVersionRequest request = assertGet(
- SetShardVersionRequest::parseFromBSON(BSON("setShardVersion"
- << ""
- << "init" << true << "shard"
- << "TestShard"
- << "shardHost" << shardCS.toString())));
-
- ASSERT(request.isInit());
- ASSERT(!request.isAuthoritative());
- ASSERT(!request.getNoConnectionVersioning());
- ASSERT_EQ(request.getShardName(), "TestShard");
- ASSERT_EQ(request.getShardConnectionString().toString(), shardCS.toString());
-}
-
-TEST(SetShardVersionRequest, ParseInitWithAuthoritative) {
- SetShardVersionRequest request =
- assertGet(SetShardVersionRequest::parseFromBSON(
- BSON("setShardVersion"
- << ""
- << "init" << true << "authoritative" << true << "shard"
- << "TestShard"
- << "shardHost" << shardCS.toString())));
-
- ASSERT(request.isInit());
- ASSERT(request.isAuthoritative());
- ASSERT(!request.getNoConnectionVersioning());
- ASSERT_EQ(request.getShardName(), "TestShard");
- ASSERT_EQ(request.getShardConnectionString().toString(), shardCS.toString());
-}
-
-TEST(SetShardVersionRequest, ParseInitNoConnectionVersioning) {
- SetShardVersionRequest request =
- assertGet(SetShardVersionRequest::parseFromBSON(
- BSON("setShardVersion"
- << ""
- << "init" << true << "authoritative" << true << "shard"
- << "TestShard"
- << "shardHost" << shardCS.toString() << "noConnectionVersioning" << true)));
-
- ASSERT(request.isInit());
- ASSERT(request.isAuthoritative());
- ASSERT(request.getNoConnectionVersioning());
- ASSERT_EQ(request.getShardName(), "TestShard");
- ASSERT_EQ(request.getShardConnectionString().toString(), shardCS.toString());
-}
-
TEST(SetShardVersionRequest, ParseFull) {
const ChunkVersion chunkVersion(1, 2, OID::gen());
@@ -105,10 +58,8 @@ TEST(SetShardVersionRequest, ParseFull) {
<< "shardHost" << shardCS.toString() << "version"
<< Timestamp(chunkVersion.toLong()) << "versionEpoch" << chunkVersion.epoch())));
- ASSERT(!request.isInit());
ASSERT(!request.shouldForceRefresh());
ASSERT(!request.isAuthoritative());
- ASSERT(!request.getNoConnectionVersioning());
ASSERT_EQ(request.getShardName(), "TestShard");
ASSERT_EQ(request.getShardConnectionString().toString(), shardCS.toString());
ASSERT_EQ(request.getNS().toString(), "db.coll");
@@ -130,10 +81,8 @@ TEST(SetShardVersionRequest, ParseFullWithAuthoritative) {
<< Timestamp(chunkVersion.toLong()) << "versionEpoch" << chunkVersion.epoch()
<< "authoritative" << true)));
- ASSERT(!request.isInit());
ASSERT(!request.shouldForceRefresh());
ASSERT(request.isAuthoritative());
- ASSERT(!request.getNoConnectionVersioning());
ASSERT_EQ(request.getShardName(), "TestShard");
ASSERT_EQ(request.getShardConnectionString().toString(), shardCS.toString());
ASSERT_EQ(request.getNS().toString(), "db.coll");
@@ -155,10 +104,8 @@ TEST(SetShardVersionRequest, ParseFullNoConnectionVersioning) {
<< Timestamp(chunkVersion.toLong()) << "versionEpoch" << chunkVersion.epoch()
<< "noConnectionVersioning" << true)));
- ASSERT(!request.isInit());
ASSERT(!request.shouldForceRefresh());
ASSERT(!request.isAuthoritative());
- ASSERT(request.getNoConnectionVersioning());
ASSERT_EQ(request.getShardName(), "TestShard");
ASSERT_EQ(request.getShardConnectionString().toString(), shardCS.toString());
ASSERT_EQ(request.getNS().toString(), "db.coll");
@@ -197,36 +144,14 @@ TEST(SetShardVersionRequest, ParseFullNSContainsDBOnly) {
ASSERT_EQ(ErrorCodes::InvalidNamespace, ssvStatus.getStatus().code());
}
-TEST(SetShardVersionRequest, ToSSVCommandInit) {
- SetShardVersionRequest ssv =
- SetShardVersionRequest::makeForInit(configCS, ShardId("TestShard"), shardCS);
-
- ASSERT(ssv.isInit());
- ASSERT(!ssv.shouldForceRefresh());
- ASSERT(ssv.isAuthoritative());
- ASSERT(!ssv.getNoConnectionVersioning());
- ASSERT_EQ(ssv.getShardName(), "TestShard");
- ASSERT_EQ(ssv.getShardConnectionString().toString(), shardCS.toString());
-
- ASSERT_BSONOBJ_EQ(ssv.toBSON(),
- BSON("setShardVersion"
- << ""
- << "init" << true << "forceRefresh" << false << "authoritative" << true
- << "configdb" << configCS.toString() << "shard"
- << "TestShard"
- << "shardHost" << shardCS.toString() << "maxTimeMS" << 30000));
-}
-
TEST(SetShardVersionRequest, ToSSVCommandFull) {
const ChunkVersion chunkVersion(1, 2, OID::gen());
- SetShardVersionRequest ssv = SetShardVersionRequest::makeForVersioning(
+ SetShardVersionRequest ssv(
configCS, ShardId("TestShard"), shardCS, NamespaceString("db.coll"), chunkVersion, false);
- ASSERT(!ssv.isInit());
ASSERT(!ssv.shouldForceRefresh());
ASSERT(!ssv.isAuthoritative());
- ASSERT(!ssv.getNoConnectionVersioning());
ASSERT_EQ(ssv.getShardName(), "TestShard");
ASSERT_EQ(ssv.getShardConnectionString().toString(), shardCS.toString());
ASSERT_EQ(ssv.getNS().ns(), "db.coll");
@@ -235,8 +160,8 @@ TEST(SetShardVersionRequest, ToSSVCommandFull) {
ASSERT_BSONOBJ_EQ(ssv.toBSON(),
BSON("setShardVersion"
<< "db.coll"
- << "init" << false << "forceRefresh" << false << "authoritative" << false
- << "configdb" << configCS.toString() << "shard"
+ << "forceRefresh" << false << "authoritative" << false << "configdb"
+ << configCS.toString() << "shard"
<< "TestShard"
<< "shardHost" << shardCS.toString() << "version"
<< Timestamp(chunkVersion.toLong()) << "versionEpoch"
@@ -246,13 +171,11 @@ TEST(SetShardVersionRequest, ToSSVCommandFull) {
TEST(SetShardVersionRequest, ToSSVCommandFullAuthoritative) {
const ChunkVersion chunkVersion(1, 2, OID::gen());
- SetShardVersionRequest ssv = SetShardVersionRequest::makeForVersioning(
+ SetShardVersionRequest ssv(
configCS, ShardId("TestShard"), shardCS, NamespaceString("db.coll"), chunkVersion, true);
- ASSERT(!ssv.isInit());
ASSERT(!ssv.shouldForceRefresh());
ASSERT(ssv.isAuthoritative());
- ASSERT(!ssv.getNoConnectionVersioning());
ASSERT_EQ(ssv.getShardName(), "TestShard");
ASSERT_EQ(ssv.getShardConnectionString().toString(), shardCS.toString());
ASSERT_EQ(ssv.getNS().ns(), "db.coll");
@@ -261,8 +184,8 @@ TEST(SetShardVersionRequest, ToSSVCommandFullAuthoritative) {
ASSERT_BSONOBJ_EQ(ssv.toBSON(),
BSON("setShardVersion"
<< "db.coll"
- << "init" << false << "forceRefresh" << false << "authoritative" << true
- << "configdb" << configCS.toString() << "shard"
+ << "forceRefresh" << false << "authoritative" << true << "configdb"
+ << configCS.toString() << "shard"
<< "TestShard"
<< "shardHost" << shardCS.toString() << "version"
<< Timestamp(chunkVersion.toLong()) << "versionEpoch"
@@ -272,19 +195,16 @@ TEST(SetShardVersionRequest, ToSSVCommandFullAuthoritative) {
TEST(SetShardVersionRequest, ToSSVCommandFullForceRefresh) {
const ChunkVersion chunkVersion(1, 2, OID::gen());
- SetShardVersionRequest ssv =
- SetShardVersionRequest::makeForVersioning(configCS,
- ShardId("TestShard"),
- shardCS,
- NamespaceString("db.coll"),
- chunkVersion,
- false,
- true);
+ SetShardVersionRequest ssv(configCS,
+ ShardId("TestShard"),
+ shardCS,
+ NamespaceString("db.coll"),
+ chunkVersion,
+ false,
+ true);
- ASSERT(!ssv.isInit());
ASSERT(ssv.shouldForceRefresh());
ASSERT(!ssv.isAuthoritative());
- ASSERT(!ssv.getNoConnectionVersioning());
ASSERT_EQ(ssv.getShardName(), "TestShard");
ASSERT_EQ(ssv.getShardConnectionString().toString(), shardCS.toString());
ASSERT_EQ(ssv.getNS().ns(), "db.coll");
@@ -293,72 +213,13 @@ TEST(SetShardVersionRequest, ToSSVCommandFullForceRefresh) {
ASSERT_BSONOBJ_EQ(ssv.toBSON(),
BSON("setShardVersion"
<< "db.coll"
- << "init" << false << "forceRefresh" << true << "authoritative" << false
- << "configdb" << configCS.toString() << "shard"
+ << "forceRefresh" << true << "authoritative" << false << "configdb"
+ << configCS.toString() << "shard"
<< "TestShard"
<< "shardHost" << shardCS.toString() << "version"
<< Timestamp(chunkVersion.toLong()) << "versionEpoch"
<< chunkVersion.epoch()));
}
-TEST(SetShardVersionRequest, ToSSVCommandFullNoConnectionVersioning) {
- const ChunkVersion chunkVersion(1, 2, OID::gen());
-
- SetShardVersionRequest ssv = SetShardVersionRequest::makeForVersioningNoPersist(
- configCS, ShardId("TestShard"), shardCS, NamespaceString("db.coll"), chunkVersion, true);
-
- ASSERT(!ssv.isInit());
- ASSERT(!ssv.shouldForceRefresh());
- ASSERT(ssv.isAuthoritative());
- ASSERT(ssv.getNoConnectionVersioning());
- ASSERT_EQ(ssv.getShardName(), "TestShard");
- ASSERT_EQ(ssv.getShardConnectionString().toString(), shardCS.toString());
- ASSERT_EQ(ssv.getNS().ns(), "db.coll");
- ASSERT_BSONOBJ_EQ(ssv.getNSVersion().toBSON(), chunkVersion.toBSON());
-
- ASSERT_BSONOBJ_EQ(ssv.toBSON(),
- BSON("setShardVersion"
- << "db.coll"
- << "init" << false << "forceRefresh" << false << "authoritative" << true
- << "configdb" << configCS.toString() << "shard"
- << "TestShard"
- << "shardHost" << shardCS.toString() << "version"
- << Timestamp(chunkVersion.toLong()) << "versionEpoch"
- << chunkVersion.epoch() << "noConnectionVersioning" << true));
-}
-
-TEST(SetShardVersionRequest, ToSSVCommandFullNoConnectionVersioningForceRefresh) {
- const ChunkVersion chunkVersion(1, 2, OID::gen());
-
- SetShardVersionRequest ssv =
- SetShardVersionRequest::makeForVersioningNoPersist(configCS,
- ShardId("TestShard"),
- shardCS,
- NamespaceString("db.coll"),
- chunkVersion,
- false,
- true);
-
- ASSERT(!ssv.isInit());
- ASSERT(ssv.shouldForceRefresh());
- ASSERT(!ssv.isAuthoritative());
- ASSERT(ssv.getNoConnectionVersioning());
- ASSERT_EQ(ssv.getShardName(), "TestShard");
- ASSERT_EQ(ssv.getShardConnectionString().toString(), shardCS.toString());
- ASSERT_EQ(ssv.getNS().ns(), "db.coll");
- ASSERT_BSONOBJ_EQ(ssv.getNSVersion().toBSON(), chunkVersion.toBSON());
-
- ASSERT_BSONOBJ_EQ(ssv.toBSON(),
- BSON("setShardVersion"
- << "db.coll"
- << "init" << false << "forceRefresh" << true << "authoritative" << false
- << "configdb" << configCS.toString() << "shard"
- << "TestShard"
- << "shardHost" << shardCS.toString() << "version"
- << Timestamp(chunkVersion.toLong()) << "versionEpoch"
- << chunkVersion.epoch() << "noConnectionVersioning" << true));
-}
-
-
} // namespace
} // namespace mongo
diff --git a/src/mongo/s/sharding_router_test_fixture.cpp b/src/mongo/s/sharding_router_test_fixture.cpp
index c4114df7138..b4aff842805 100644
--- a/src/mongo/s/sharding_router_test_fixture.cpp
+++ b/src/mongo/s/sharding_router_test_fixture.cpp
@@ -459,7 +459,6 @@ void ShardingTestFixture::expectSetShardVersion(const HostAndPort& expectedHost,
SetShardVersionRequest ssv =
assertGet(SetShardVersionRequest::parseFromBSON(request.cmdObj));
- ASSERT(!ssv.isInit());
ASSERT(ssv.isAuthoritative());
ASSERT_EQ(expectedShard.getHost(), ssv.getShardConnectionString().toString());
ASSERT_EQ(expectedNs, ssv.getNS());