summaryrefslogtreecommitdiff
path: root/src/mongo/client/dbclient.cpp
diff options
context:
space:
mode:
authorDianna Hohensee <dianna.hohensee@10gen.com>2018-01-17 10:43:14 -0500
committerDianna Hohensee <dianna.hohensee@10gen.com>2018-02-16 16:30:44 -0500
commitd1c188b17167f0430f5a8d10e972c0d00a908ba2 (patch)
tree8ce4510c4ec7507a17a2ad6719cf6695f5149b4b /src/mongo/client/dbclient.cpp
parent902b8552f11697308604823c19d6dbce661fc3d6 (diff)
downloadmongo-d1c188b17167f0430f5a8d10e972c0d00a908ba2.tar.gz
SERVER-32635 an old mongos server communicating with a fully upgraded cluster should crash
Diffstat (limited to 'src/mongo/client/dbclient.cpp')
-rw-r--r--src/mongo/client/dbclient.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mongo/client/dbclient.cpp b/src/mongo/client/dbclient.cpp
index 916ac5b6c21..2d05e518b7b 100644
--- a/src/mongo/client/dbclient.cpp
+++ b/src/mongo/client/dbclient.cpp
@@ -60,6 +60,7 @@
#include "mongo/rpc/metadata.h"
#include "mongo/rpc/metadata/client_metadata.h"
#include "mongo/rpc/reply_interface.h"
+#include "mongo/s/is_mongos.h"
#include "mongo/s/stale_exception.h"
#include "mongo/stdx/functional.h"
#include "mongo/stdx/memory.h"
@@ -67,6 +68,7 @@
#include "mongo/util/assert_util.h"
#include "mongo/util/concurrency/mutex.h"
#include "mongo/util/debug_util.h"
+#include "mongo/util/fail_point_service.h"
#include "mongo/util/log.h"
#include "mongo/util/net/message_port.h"
#include "mongo/util/net/socket_exception.h"
@@ -92,6 +94,8 @@ using executor::RemoteCommandResponse;
namespace {
+MONGO_FP_DECLARE(turnOffDBClientIncompatibleWithUpgradedServerCheck);
+
#ifdef MONGO_CONFIG_SSL
static SimpleMutex s_mtx;
static SSLManagerInterface* s_sslMgr(NULL);
@@ -890,6 +894,16 @@ Status DBClientConnection::connect(const HostAndPort& serverAddress, StringData
auto validateStatus =
rpc::validateWireVersion(WireSpec::instance().outgoing, swProtocolSet.getValue().version);
if (!validateStatus.isOK()) {
+ if (mongo::isMongos() && validateStatus == ErrorCodes::IncompatibleWithUpgradedServer &&
+ !MONGO_FAIL_POINT(turnOffDBClientIncompatibleWithUpgradedServerCheck)) {
+ severe() << "This mongos server must be upgraded. It is attempting to communicate with "
+ "an upgraded cluster with which it is incompatible. Error: '"
+ << validateStatus.toString()
+ << "' Crashing in order to bring attention to the incompatibility, rather "
+ "than erroring endlessly.";
+ fassertNoTrace(50709, false);
+ }
+
warning() << "remote host has incompatible wire version: " << validateStatus;
return validateStatus;