summaryrefslogtreecommitdiff
path: root/src/mongo/s/client/shard_remote.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/s/client/shard_remote.cpp')
-rw-r--r--src/mongo/s/client/shard_remote.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/mongo/s/client/shard_remote.cpp b/src/mongo/s/client/shard_remote.cpp
index 8602c3d31d2..5e5f2617d47 100644
--- a/src/mongo/s/client/shard_remote.cpp
+++ b/src/mongo/s/client/shard_remote.cpp
@@ -106,14 +106,21 @@ bool ShardRemote::isRetriableError(ErrorCodes::Error code, RetryPolicy options)
return false;
}
- if (options == RetryPolicy::kNoRetry) {
- return false;
+ switch (options) {
+ case RetryPolicy::kNoRetry: {
+ return false;
+ } break;
+
+ case RetryPolicy::kIdempotent: {
+ return ErrorCodes::isRetriableError(code);
+ } break;
+
+ case RetryPolicy::kNotIdempotent: {
+ return ErrorCodes::isNotMasterError(code);
+ } break;
}
- const auto& retriableErrors = options == RetryPolicy::kIdempotent
- ? RemoteCommandRetryScheduler::kAllRetriableErrors
- : RemoteCommandRetryScheduler::kNotMasterErrors;
- return std::find(retriableErrors.begin(), retriableErrors.end(), code) != retriableErrors.end();
+ MONGO_UNREACHABLE;
}
const ConnectionString ShardRemote::getConnString() const {