summaryrefslogtreecommitdiff
path: root/src/mongo/s/request_types/set_shard_version_request.cpp
diff options
context:
space:
mode:
authorMatthew Saltz <matthew.saltz@mongodb.com>2018-04-18 13:43:02 -0400
committerMatthew Saltz <matthew.saltz@mongodb.com>2018-06-05 15:17:44 -0400
commitb93fe0e61bf7e8bc96da2edeb66afa1b915b0b77 (patch)
treea67f0e8ca9eb57f5b55d049340d232b73b2945b2 /src/mongo/s/request_types/set_shard_version_request.cpp
parent7507298b1f05d46fdaf71e9f43f9a0b4ba577326 (diff)
downloadmongo-b93fe0e61bf7e8bc96da2edeb66afa1b915b0b77.tar.gz
SERVER-33954 Modified getCollectionRoutingInfoWithRefresh to refresh twice if the first refresh is not performed by its own thread
Diffstat (limited to 'src/mongo/s/request_types/set_shard_version_request.cpp')
-rw-r--r--src/mongo/s/request_types/set_shard_version_request.cpp31
1 files changed, 25 insertions, 6 deletions
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 e3c8b4bb965..68f72f80132 100644
--- a/src/mongo/s/request_types/set_shard_version_request.cpp
+++ b/src/mongo/s/request_types/set_shard_version_request.cpp
@@ -46,6 +46,7 @@ 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";
@@ -65,9 +66,11 @@ SetShardVersionRequest::SetShardVersionRequest(ConnectionString configServer,
ConnectionString shardConnectionString,
NamespaceString nss,
ChunkVersion version,
- bool isAuthoritative)
+ bool isAuthoritative,
+ bool forceRefresh)
: _init(false),
_isAuthoritative(isAuthoritative),
+ _forceRefresh(forceRefresh),
_configServer(std::move(configServer)),
_shardName(std::move(shardName)),
_shardCS(std::move(shardConnectionString)),
@@ -89,10 +92,16 @@ SetShardVersionRequest SetShardVersionRequest::makeForVersioning(
const ConnectionString& shardConnectionString,
const NamespaceString& nss,
const ChunkVersion& nssVersion,
- bool isAuthoritative) {
+ bool isAuthoritative,
+ bool forceRefresh) {
invariant(nss.isValid());
- return SetShardVersionRequest(
- configServer, shardName, shardConnectionString, nss, nssVersion, isAuthoritative);
+ return SetShardVersionRequest(configServer,
+ shardName,
+ shardConnectionString,
+ nss,
+ nssVersion,
+ isAuthoritative,
+ forceRefresh);
}
SetShardVersionRequest SetShardVersionRequest::makeForVersioningNoPersist(
@@ -101,8 +110,10 @@ SetShardVersionRequest SetShardVersionRequest::makeForVersioningNoPersist(
const ConnectionString& shard,
const NamespaceString& nss,
const ChunkVersion& nssVersion,
- bool isAuthoritative) {
- auto ssv = makeForVersioning(configServer, shardName, shard, nss, nssVersion, isAuthoritative);
+ bool isAuthoritative,
+ bool forceRefresh) {
+ auto ssv = makeForVersioning(
+ configServer, shardName, shard, nss, nssVersion, isAuthoritative, forceRefresh);
ssv._noConnectionVersioning = true;
return ssv;
@@ -141,6 +152,13 @@ StatusWith<SetShardVersionRequest> SetShardVersionRequest::parseFromBSON(const B
{
Status status = bsonExtractBooleanFieldWithDefault(
+ cmdObj, kForceRefresh, false, &request._forceRefresh);
+ if (!status.isOK())
+ return status;
+ }
+
+ {
+ Status status = bsonExtractBooleanFieldWithDefault(
cmdObj, kAuthoritative, false, &request._isAuthoritative);
if (!status.isOK())
return status;
@@ -191,6 +209,7 @@ BSONObj SetShardVersionRequest::toBSON() const {
cmdBuilder.append(kCmdName, _init ? "" : _nss.get().ns());
cmdBuilder.append(kInit, _init);
+ cmdBuilder.append(kForceRefresh, _forceRefresh);
cmdBuilder.append(kAuthoritative, _isAuthoritative);
// 'configdb' field is only included for v3.4 backwards compatibility
cmdBuilder.append(kConfigServer, _configServer.toString());