diff options
author | Esha Maharishi <esha.maharishi@mongodb.com> | 2016-06-16 01:04:29 -0400 |
---|---|---|
committer | Esha Maharishi <esha.maharishi@mongodb.com> | 2016-07-14 16:32:10 -0400 |
commit | 2ea2c7700d9ccca1150e49c181c97b948889df5e (patch) | |
tree | 1e8d89f6506ea1a7fee2a172d7138e866dd1c111 /src/mongo/db/s/type_shard_identity.cpp | |
parent | af5daa51506541d9526ce576f2432809003d2432 (diff) | |
download | mongo-2ea2c7700d9ccca1150e49c181c97b948889df5e.tar.gz |
SERVER-22660 OpObserver on config server for inserts to config.shards from old mongos
Diffstat (limited to 'src/mongo/db/s/type_shard_identity.cpp')
-rw-r--r-- | src/mongo/db/s/type_shard_identity.cpp | 35 |
1 files changed, 3 insertions, 32 deletions
diff --git a/src/mongo/db/s/type_shard_identity.cpp b/src/mongo/db/s/type_shard_identity.cpp index 6188f08a109..3eef36c9a22 100644 --- a/src/mongo/db/s/type_shard_identity.cpp +++ b/src/mongo/db/s/type_shard_identity.cpp @@ -40,13 +40,9 @@ namespace mongo { const std::string ShardIdentityType::IdName("shardIdentity"); -namespace { - -const BSONField<std::string> configsvrConnString("configsvrConnectionString"); -const BSONField<std::string> shardName("shardName"); -const BSONField<OID> clusterId("clusterId"); - -} // unnamed namespace +const BSONField<std::string> ShardIdentityType::configsvrConnString("configsvrConnectionString"); +const BSONField<std::string> ShardIdentityType::shardName("shardName"); +const BSONField<OID> ShardIdentityType::clusterId("clusterId"); StatusWith<ShardIdentityType> ShardIdentityType::fromBSON(const BSONObj& source) { if (!source.hasField("_id")) { @@ -206,31 +202,6 @@ void ShardIdentityType::setClusterId(OID clusterId) { _clusterId = std::move(clusterId); } -std::unique_ptr<BatchedUpdateRequest> ShardIdentityType::createUpsertForAddShard() const { - invariant(validate().isOK()); - - std::unique_ptr<BatchedUpdateDocument> updateDoc(new BatchedUpdateDocument()); - - BSONObjBuilder query; - query.append("_id", "shardIdentity"); - query.append("shardName", getShardName()); - query.append("clusterId", getClusterId()); - updateDoc->setQuery(query.obj()); - - BSONObjBuilder update; - BSONObjBuilder setConfigBuilder(update.subobjStart("$set")); - setConfigBuilder.append(configsvrConnString(), getConfigsvrConnString().toString()); - setConfigBuilder.doneFast(); - updateDoc->setUpdateExpr(update.obj()); - - updateDoc->setUpsert(true); - - std::unique_ptr<BatchedUpdateRequest> updateRequest(new BatchedUpdateRequest()); - updateRequest->addToUpdates(updateDoc.release()); - - return updateRequest; -} - BSONObj ShardIdentityType::createConfigServerUpdateObject(const std::string& newConnString) { BSONObjBuilder builder; BSONObjBuilder setConfigBuilder(builder.subobjStart("$set")); |