summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2017-03-14 12:58:12 -0400
committerMathias Stearn <mathias@10gen.com>2017-03-20 18:38:42 -0400
commit59b3e96b9d2782f044d1113b05c6268ff2ae221b (patch)
tree9cea468a1f6a75a0f9bf8161b3421bdaa3b5be76
parent7ff63b0de1c76b7559c40ffe43360f4161a94277 (diff)
downloadmongo-59b3e96b9d2782f044d1113b05c6268ff2ae221b.tar.gz
SERVER-28303 Delete old OP_MSG code
It is been deprecated since at least 1.2 and was never supported in mongos. Deleting to make room for the new OP_MSG format.
-rw-r--r--src/mongo/db/assemble_response.cpp14
-rw-r--r--src/mongo/db/dbmessage.h3
-rw-r--r--src/mongo/db/stats/counters.cpp1
-rw-r--r--src/mongo/s/service_entry_point_mongos.cpp2
-rw-r--r--src/mongo/tools/bridge.cpp10
-rw-r--r--src/mongo/util/net/message.h26
6 files changed, 27 insertions, 29 deletions
diff --git a/src/mongo/db/assemble_response.cpp b/src/mongo/db/assemble_response.cpp
index a4f21cc5ae2..243b00457a4 100644
--- a/src/mongo/db/assemble_response.cpp
+++ b/src/mongo/db/assemble_response.cpp
@@ -559,20 +559,6 @@ void assembleResponse(OperationContext* opCtx,
} else if (op == dbGetMore) {
if (!receivedGetMore(opCtx, dbresponse, m, currentOp))
shouldLogOpDebug = true;
- } else if (op == dbMsg) {
- // deprecated - replaced by commands
- const char* p = dbmsg.getns();
-
- int len = strlen(p);
- if (len > 400)
- log() << curTimeMillis64() % 10000 << " long msg received, len:" << len;
-
- if (strcmp("end", p) == 0)
- dbresponse.response.setData(opReply, "dbMsg end no longer supported");
- else
- dbresponse.response.setData(opReply, "i am fine - dbMsg deprecated");
-
- dbresponse.responseToMsgId = m.header().getId();
} else {
// The remaining operations do not return any response. They are fire-and-forget.
try {
diff --git a/src/mongo/db/dbmessage.h b/src/mongo/db/dbmessage.h
index 4b070c128b1..d6ed3a68684 100644
--- a/src/mongo/db/dbmessage.h
+++ b/src/mongo/db/dbmessage.h
@@ -222,9 +222,8 @@ public:
DbMessage(const Message& msg);
// Indicates whether this message is expected to have a ns
- // or in the case of dbMsg, a string in the same place as ns
bool messageShouldHaveNs() const {
- return (_msg.operation() >= dbMsg) & (_msg.operation() <= dbDelete);
+ return (_msg.operation() >= dbUpdate) & (_msg.operation() <= dbDelete);
}
/** the 32 bit field before the ns
diff --git a/src/mongo/db/stats/counters.cpp b/src/mongo/db/stats/counters.cpp
index 9f61240dc69..80e3eb3a1d5 100644
--- a/src/mongo/db/stats/counters.cpp
+++ b/src/mongo/db/stats/counters.cpp
@@ -100,7 +100,6 @@ void OpCounters::gotOp(int op, bool isCommand) {
break;
case dbKillCursors:
case opReply:
- case dbMsg:
break;
default:
log() << "OpCounters::gotOp unknown op: " << op << endl;
diff --git a/src/mongo/s/service_entry_point_mongos.cpp b/src/mongo/s/service_entry_point_mongos.cpp
index 623af0e3602..545c4b5bb0b 100644
--- a/src/mongo/s/service_entry_point_mongos.cpp
+++ b/src/mongo/s/service_entry_point_mongos.cpp
@@ -110,7 +110,7 @@ void ServiceEntryPointMongos::_sessionLoop(const transport::SessionHandle& sessi
// connection
uassert(ErrorCodes::IllegalOperation,
str::stream() << "Message type " << op << " is not supported.",
- op > dbMsg);
+ isSupportedNetworkOp(op));
// Start a new LastError session. Any exceptions thrown from here onwards will be returned
// to the caller (if the type of the message permits it).
diff --git a/src/mongo/tools/bridge.cpp b/src/mongo/tools/bridge.cpp
index 1963e92a7fa..710b17f4215 100644
--- a/src/mongo/tools/bridge.cpp
+++ b/src/mongo/tools/bridge.cpp
@@ -138,6 +138,10 @@ public:
break;
}
+ uassert(ErrorCodes::IllegalOperation,
+ str::stream() << "Unsupported network op " << request.operation(),
+ isSupportedNetworkOp(request.operation()));
+
if (request.operation() == dbCompressed) {
auto swm = compressorManager.decompressMessage(request);
if (!swm.isOK()) {
@@ -214,10 +218,10 @@ public:
}
// Send the message we received from '_mp' to 'dest'. 'dest' returns a response for
- // OP_QUERY, OP_MSG, OP_GET_MORE, and OP_COMMAND messages that we respond back to
+ // OP_QUERY, OP_GET_MORE, and OP_COMMAND messages that we respond back to
// '_mp' with.
- if (request.operation() == dbQuery || request.operation() == dbMsg ||
- request.operation() == dbGetMore || request.operation() == dbCommand) {
+ if (request.operation() == dbQuery || request.operation() == dbGetMore ||
+ request.operation() == dbCommand) {
// Forward the message to 'dest' and receive its reply in 'response'.
response.reset();
dest.port().call(request, response);
diff --git a/src/mongo/util/net/message.h b/src/mongo/util/net/message.h
index 1664dded805..0219d3067c5 100644
--- a/src/mongo/util/net/message.h
+++ b/src/mongo/util/net/message.h
@@ -46,7 +46,6 @@ const size_t MaxMessageSizeBytes = 48 * 1000 * 1000;
enum NetworkOp : int32_t {
opInvalid = 0,
opReply = 1, /* reply. responseTo is set. */
- dbMsg = 1000, /* generic msg command followed by a std::string */
dbUpdate = 2001, /* update object */
dbInsert = 2002,
// dbGetByOID = 2003,
@@ -61,9 +60,26 @@ enum NetworkOp : int32_t {
dbCompressed = 2012,
};
+inline bool isSupportedNetworkOp(NetworkOp op) {
+ switch (op) {
+ case opReply:
+ case dbUpdate:
+ case dbInsert:
+ case dbQuery:
+ case dbGetMore:
+ case dbDelete:
+ case dbKillCursors:
+ case dbCommand:
+ case dbCommandReply:
+ case dbCompressed:
+ return true;
+ default:
+ return false;
+ }
+}
+
enum class LogicalOp {
opInvalid,
- opMsg,
opUpdate,
opInsert,
opQuery,
@@ -76,8 +92,6 @@ enum class LogicalOp {
inline LogicalOp networkOpToLogicalOp(NetworkOp networkOp) {
switch (networkOp) {
- case dbMsg:
- return LogicalOp::opMsg;
case dbUpdate:
return LogicalOp::opUpdate;
case dbInsert:
@@ -107,8 +121,6 @@ inline const char* networkOpToString(NetworkOp networkOp) {
return "none";
case opReply:
return "reply";
- case dbMsg:
- return "msg";
case dbUpdate:
return "update";
case dbInsert:
@@ -138,8 +150,6 @@ inline const char* logicalOpToString(LogicalOp logicalOp) {
switch (logicalOp) {
case LogicalOp::opInvalid:
return "none";
- case LogicalOp::opMsg:
- return "msg";
case LogicalOp::opUpdate:
return "update";
case LogicalOp::opInsert: