summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthew Russotto <matthew.russotto@10gen.com>2018-02-26 13:05:51 -0500
committerMatthew Russotto <matthew.russotto@10gen.com>2018-03-01 08:22:45 -0500
commitc713377e4b99475563f26de19f88c45ece8a0546 (patch)
tree90eb6d4e9228d5e5d40d5d92cd7917b5b5e16702 /src
parentabc0f64403a170f2145e52f2ff28ccaf3b297b6f (diff)
downloadmongo-c713377e4b99475563f26de19f88c45ece8a0546.tar.gz
SERVER-32320 Make sharding doTxn back into applyOps temporarily.
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager_chunk_operations.cpp30
-rw-r--r--src/mongo/s/catalog/sharding_catalog_client_impl.cpp6
-rw-r--r--src/mongo/s/catalog/sharding_catalog_test.cpp2
3 files changed, 19 insertions, 19 deletions
diff --git a/src/mongo/db/s/config/sharding_catalog_manager_chunk_operations.cpp b/src/mongo/db/s/config/sharding_catalog_manager_chunk_operations.cpp
index dca5b5403e8..365255fe542 100644
--- a/src/mongo/db/s/config/sharding_catalog_manager_chunk_operations.cpp
+++ b/src/mongo/db/s/config/sharding_catalog_manager_chunk_operations.cpp
@@ -220,10 +220,10 @@ BSONObj makeCommitChunkTransactionCommand(const NamespaceString& nss,
updates.append(op.obj());
}
- // Do not give doTxn a write concern. If doTxn tries to wait for replication, it will fail
+ // Do not give applyOps a write concern. If applyOps tries to wait for replication, it will fail
// because of the GlobalWrite lock CommitChunkMigration already holds. Replication will not be
// able to take the lock it requires.
- return BSON("doTxn" << updates.arr());
+ return BSON("applyOps" << updates.arr());
}
} // namespace
@@ -375,7 +375,7 @@ Status ShardingCatalogManager::commitChunkSplit(OperationContext* opCtx,
}
// apply the batch of updates to local metadata.
- Status doTxnStatus = Grid::get(opCtx)->catalogClient()->applyChunkOpsDeprecated(
+ Status applyOpsStatus = Grid::get(opCtx)->catalogClient()->applyChunkOpsDeprecated(
opCtx,
updates.arr(),
preCond.arr(),
@@ -383,8 +383,8 @@ Status ShardingCatalogManager::commitChunkSplit(OperationContext* opCtx,
currentMaxVersion,
WriteConcernOptions(),
repl::ReadConcernLevel::kLocalReadConcern);
- if (!doTxnStatus.isOK()) {
- return doTxnStatus;
+ if (!applyOpsStatus.isOK()) {
+ return applyOpsStatus;
}
// log changes
@@ -424,7 +424,7 @@ Status ShardingCatalogManager::commitChunkSplit(OperationContext* opCtx,
}
}
- return doTxnStatus;
+ return applyOpsStatus;
}
Status ShardingCatalogManager::commitChunkMerge(OperationContext* opCtx,
@@ -504,7 +504,7 @@ Status ShardingCatalogManager::commitChunkMerge(OperationContext* opCtx,
auto preCond = buildMergeChunksTransactionPrecond(chunksToMerge, collVersion);
// apply the batch of updates to local metadata
- Status doTxnStatus = Grid::get(opCtx)->catalogClient()->applyChunkOpsDeprecated(
+ Status applyOpsStatus = Grid::get(opCtx)->catalogClient()->applyChunkOpsDeprecated(
opCtx,
updates,
preCond,
@@ -512,8 +512,8 @@ Status ShardingCatalogManager::commitChunkMerge(OperationContext* opCtx,
mergeVersion,
WriteConcernOptions(),
repl::ReadConcernLevel::kLocalReadConcern);
- if (!doTxnStatus.isOK()) {
- return doTxnStatus;
+ if (!applyOpsStatus.isOK()) {
+ return applyOpsStatus;
}
// log changes
@@ -532,7 +532,7 @@ Status ShardingCatalogManager::commitChunkMerge(OperationContext* opCtx,
->logChange(opCtx, "merge", nss.ns(), logDetail.obj(), WriteConcernOptions())
.transitional_ignore();
- return doTxnStatus;
+ return applyOpsStatus;
}
StatusWith<BSONObj> ShardingCatalogManager::commitChunkMigration(
@@ -641,7 +641,7 @@ StatusWith<BSONObj> ShardingCatalogManager::commitChunkMigration(
auto command = makeCommitChunkTransactionCommand(
nss, newMigratedChunk, newControlChunk, fromShard.toString(), toShard.toString());
- StatusWith<Shard::CommandResponse> doTxnCommandResponse =
+ StatusWith<Shard::CommandResponse> applyOpsCommandResponse =
configShard->runCommandWithFixedRetryAttempts(
opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
@@ -649,12 +649,12 @@ StatusWith<BSONObj> ShardingCatalogManager::commitChunkMigration(
command,
Shard::RetryPolicy::kIdempotent);
- if (!doTxnCommandResponse.isOK()) {
- return doTxnCommandResponse.getStatus();
+ if (!applyOpsCommandResponse.isOK()) {
+ return applyOpsCommandResponse.getStatus();
}
- if (!doTxnCommandResponse.getValue().commandStatus.isOK()) {
- return doTxnCommandResponse.getValue().commandStatus;
+ if (!applyOpsCommandResponse.getValue().commandStatus.isOK()) {
+ return applyOpsCommandResponse.getValue().commandStatus;
}
BSONObjBuilder result;
diff --git a/src/mongo/s/catalog/sharding_catalog_client_impl.cpp b/src/mongo/s/catalog/sharding_catalog_client_impl.cpp
index 940583a992e..9b26d5903bd 100644
--- a/src/mongo/s/catalog/sharding_catalog_client_impl.cpp
+++ b/src/mongo/s/catalog/sharding_catalog_client_impl.cpp
@@ -717,9 +717,9 @@ Status ShardingCatalogClientImpl::applyChunkOpsDeprecated(OperationContext* opCt
invariant(serverGlobalParams.clusterRole == ClusterRole::ConfigServer ||
(readConcern == repl::ReadConcernLevel::kMajorityReadConcern &&
writeConcern.wMode == WriteConcernOptions::kMajority));
- BSONObj cmd = BSON("doTxn" << updateOps << "preCondition" << preCondition
- << WriteConcernOptions::kWriteConcernField
- << writeConcern.toBSON());
+ BSONObj cmd = BSON("applyOps" << updateOps << "preCondition" << preCondition
+ << WriteConcernOptions::kWriteConcernField
+ << writeConcern.toBSON());
auto response =
Grid::get(opCtx)->shardRegistry()->getConfigShard()->runCommandWithFixedRetryAttempts(
diff --git a/src/mongo/s/catalog/sharding_catalog_test.cpp b/src/mongo/s/catalog/sharding_catalog_test.cpp
index d20ab52f4ff..9f1c784a9f0 100644
--- a/src/mongo/s/catalog/sharding_catalog_test.cpp
+++ b/src/mongo/s/catalog/sharding_catalog_test.cpp
@@ -1176,7 +1176,7 @@ TEST_F(ShardingCatalogClientTest, ApplyChunkOpsDeprecatedSuccessful) {
request.cmdObj["writeConcern"].Obj());
ASSERT_BSONOBJ_EQ(BSON(rpc::kReplSetMetadataFieldName << 1),
rpc::TrackingMetadata::removeTrackingData(request.metadata));
- ASSERT_BSONOBJ_EQ(updateOps, request.cmdObj["doTxn"].Obj());
+ ASSERT_BSONOBJ_EQ(updateOps, request.cmdObj["applyOps"].Obj());
ASSERT_BSONOBJ_EQ(preCondition, request.cmdObj["preCondition"].Obj());
return BSON("ok" << 1);