summaryrefslogtreecommitdiff
path: root/src/mongo/db/ops
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2020-03-31 13:38:25 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-04-06 10:31:45 +0000
commit1d6cd3e2fbe7b31fab7c6d2dc73587c40ec66d56 (patch)
treeabf271920cc857b9c56105eb6f8067af4e617e01 /src/mongo/db/ops
parentbbc5d49e563669349e1df290afce3f25b424a80a (diff)
downloadmongo-1d6cd3e2fbe7b31fab7c6d2dc73587c40ec66d56.tar.gz
SERVER-46981 Make the BatchWriteExecutor account for the potential size of the error response
Diffstat (limited to 'src/mongo/db/ops')
-rw-r--r--src/mongo/db/ops/write_ops_exec.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/mongo/db/ops/write_ops_exec.cpp b/src/mongo/db/ops/write_ops_exec.cpp
index f3c52f27162..b41263f3329 100644
--- a/src/mongo/db/ops/write_ops_exec.cpp
+++ b/src/mongo/db/ops/write_ops_exec.cpp
@@ -262,14 +262,15 @@ bool handleError(OperationContext* opCtx,
return false;
}
- if (ex.extraInfo<StaleConfigInfo>() || ex.extraInfo<StaleDbRoutingVersion>()) {
+ if (ex.code() == ErrorCodes::StaleDbVersion || ErrorCodes::isStaleShardVersionError(ex)) {
if (!opCtx->getClient()->isInDirectClient()) {
auto& oss = OperationShardingState::get(opCtx);
oss.setShardingOperationFailedStatus(ex.toStatus());
}
- // Don't try doing more ops since they will fail with the same error.
- // Command reply serializer will handle repeating this error if needed.
+ // Since this is a routing error, it is guaranteed that all subsequent operations will fail
+ // with the same cause, so don't try doing any more operations. The command reply serializer
+ // will handle repeating this error for unordered writes.
out->results.emplace_back(ex.toStatus());
return false;
}