summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorMihai Andrei <mihai.andrei@mongodb.com>2020-01-16 15:40:09 +0000
committerevergreen <evergreen@mongodb.com>2020-01-16 15:40:09 +0000
commit23f5b983b0b60d1cbe4d6373dc34b92fada72f5b (patch)
tree24bb5710361115948aa4ddc64205f218147e771f /src/mongo
parent9a51aba53026de2e026598a311adf80838246919 (diff)
downloadmongo-23f5b983b0b60d1cbe4d6373dc34b92fada72f5b.tar.gz
SERVER-45414 Remove CannotImplicitlyCreateCollection retry logic on mongos
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/base/error_codes.yml3
-rw-r--r--src/mongo/s/cluster_commands_helpers.cpp9
-rw-r--r--src/mongo/s/commands/strategy.cpp21
-rw-r--r--src/mongo/s/write_ops/batch_write_exec.cpp15
-rw-r--r--src/mongo/s/write_ops/write_op.cpp4
5 files changed, 4 insertions, 48 deletions
diff --git a/src/mongo/base/error_codes.yml b/src/mongo/base/error_codes.yml
index 9f1a4c5f8e5..02b57214382 100644
--- a/src/mongo/base/error_codes.yml
+++ b/src/mongo/base/error_codes.yml
@@ -247,8 +247,7 @@ error_codes:
- {code: 225,name: TransactionTooOld,categories: [VoteAbortError]}
- {code: 226,name: AtomicityFailure}
- {code: 227,name: CannotImplicitlyCreateCollection,
- extra: CannotImplicitlyCreateCollectionInfo,
- categories: [NeedRetargettingError]}
+ extra: CannotImplicitlyCreateCollectionInfo}
- {code: 228,name: SessionTransferIncomplete}
- {code: 229,name: MustDowngrade}
- {code: 230,name: DNSHostNotFound}
diff --git a/src/mongo/s/cluster_commands_helpers.cpp b/src/mongo/s/cluster_commands_helpers.cpp
index 8e8daa948de..7d80604743a 100644
--- a/src/mongo/s/cluster_commands_helpers.cpp
+++ b/src/mongo/s/cluster_commands_helpers.cpp
@@ -221,15 +221,6 @@ std::vector<AsyncRequestsSender::Response> gatherResponses(
if (ErrorCodes::CommandOnShardedViewNotSupportedOnMongod == status) {
uassertStatusOK(status);
}
-
- // TODO: This should not be needed once we get better targetting with SERVER-32723.
- // Some commands are sent with allowImplicit: false to all shards and expect only some
- // of them to succeed.
- if (ignorableErrors.find(ErrorCodes::CannotImplicitlyCreateCollection) ==
- ignorableErrors.end() &&
- ErrorCodes::CannotImplicitlyCreateCollection == status) {
- uassertStatusOK(status);
- }
}
responses.push_back(std::move(response));
}
diff --git a/src/mongo/s/commands/strategy.cpp b/src/mongo/s/commands/strategy.cpp
index 0d82d4c3b6a..b138a8ae36e 100644
--- a/src/mongo/s/commands/strategy.cpp
+++ b/src/mongo/s/commands/strategy.cpp
@@ -67,7 +67,6 @@
#include "mongo/rpc/metadata/tracking_metadata.h"
#include "mongo/rpc/op_msg.h"
#include "mongo/rpc/op_msg_rpc_impls.h"
-#include "mongo/s/cannot_implicitly_create_collection_info.h"
#include "mongo/s/catalog_cache.h"
#include "mongo/s/client/parallel.h"
#include "mongo/s/client/shard_connection.h"
@@ -554,20 +553,8 @@ void runCommand(OperationContext* opCtx,
const auto staleNs = [&] {
if (auto staleInfo = ex.extraInfo<StaleConfigInfo>()) {
return staleInfo->getNss();
- } else if (auto implicitCreateInfo =
- ex.extraInfo<CannotImplicitlyCreateCollectionInfo>()) {
- // Requests that attempt to implicitly create a collection in a transaction
- // should always fail with OperationNotSupportedInTransaction - this
- // assertion is only meant to safeguard that assumption.
- uassert(50983,
- str::stream() << "Cannot handle exception in a transaction: "
- << ex.toStatus(),
- !TransactionRouter::get(opCtx));
-
- return implicitCreateInfo->getNss();
- } else {
- throw;
}
+ throw;
}();
// Send setShardVersion on this thread's versioned connections to shards (to support
@@ -1094,12 +1081,8 @@ void Strategy::explainFind(OperationContext* opCtx,
const auto staleNs = [&] {
if (auto staleInfo = ex.extraInfo<StaleConfigInfo>()) {
return staleInfo->getNss();
- } else if (auto implicitCreateInfo =
- ex.extraInfo<CannotImplicitlyCreateCollectionInfo>()) {
- return implicitCreateInfo->getNss();
- } else {
- throw;
}
+ throw;
}();
// Send setShardVersion on this thread's versioned connections to shards (to support
diff --git a/src/mongo/s/write_ops/batch_write_exec.cpp b/src/mongo/s/write_ops/batch_write_exec.cpp
index 0020eb137f8..c480589e65a 100644
--- a/src/mongo/s/write_ops/batch_write_exec.cpp
+++ b/src/mongo/s/write_ops/batch_write_exec.cpp
@@ -308,7 +308,6 @@ void BatchWriteExec::executeBatch(OperationContext* opCtx,
TrackedErrors trackedErrors;
trackedErrors.startTracking(ErrorCodes::StaleShardVersion);
trackedErrors.startTracking(ErrorCodes::StaleDbVersion);
- trackedErrors.startTracking(ErrorCodes::CannotImplicitlyCreateCollection);
LOG(4) << "Write results received from " << shardHost.toString() << ": "
<< redact(batchedCommandResponse.toStatus());
@@ -356,20 +355,6 @@ void BatchWriteExec::executeBatch(OperationContext* opCtx,
++stats->numStaleDbBatches;
}
- const auto& cannotImplicitlyCreateErrors =
- trackedErrors.getErrors(ErrorCodes::CannotImplicitlyCreateCollection);
- if (!cannotImplicitlyCreateErrors.empty()) {
- // This forces the chunk manager to reload so we can attach the correct
- // version on retry and make sure we route to the correct shard.
- targeter.noteCouldNotTarget();
-
- // It is also possible that information about which shard is the primary
- // for this collection collection is stale, so refresh the database as
- // well.
- Grid::get(opCtx)->catalogCache()->invalidateDatabaseEntry(
- targeter.getNS().db());
- }
-
// Remember that we successfully wrote to this shard
// NOTE: This will record lastOps for shards where we actually didn't update
// or delete any documents, which preserves old behavior but is conservative
diff --git a/src/mongo/s/write_ops/write_op.cpp b/src/mongo/s/write_ops/write_op.cpp
index 822b9578268..ca2407843d3 100644
--- a/src/mongo/s/write_ops/write_op.cpp
+++ b/src/mongo/s/write_ops/write_op.cpp
@@ -118,9 +118,7 @@ size_t WriteOp::getNumTargeted() {
}
static bool isRetryErrCode(int errCode) {
- return errCode == ErrorCodes::StaleShardVersion ||
- errCode == ErrorCodes::CannotImplicitlyCreateCollection ||
- errCode == ErrorCodes::StaleDbVersion;
+ return errCode == ErrorCodes::StaleShardVersion || errCode == ErrorCodes::StaleDbVersion;
}
static bool errorsAllSame(const vector<ChildWriteOp const*>& errOps) {