Permalink
Browse files

SERVER-7074: Return maxMessageSizeBytes in isMaster

  • Loading branch information...
1 parent 2d20562 commit 020047aefeb662e42f4f72f0782ce6734a01d2b0 @scotthernandez scotthernandez committed Dec 26, 2012
View
@@ -0,0 +1,10 @@
+var
+var res = db.isMaster();
+assert( res.maxBsonObjectSize &&
+ isNumber(res.maxBsonObjectSize) &&
+ res.maxBsonObjectSize > 0, "maxBsonObjectSize possibly missing:" + tojson(res))
+assert( res.maxMessageSizeBytes &&
+ isNumber(res.maxMessageSizeBytes) &&
+ res.maxBsonObjectSize > 0, "maxMessageSizeBytes possibly missing:" + tojson(res))
+assert(res.ismaster, "ismaster missing or false:" + tojson(res))
+assert(res.localTime, "localTime possibly missing:" + tojson(res))
@@ -0,0 +1,11 @@
+var st = new ShardingTest({shards:1, mongos:1});
+var res = st.s0.getDB("admin").runCommand("ismaster");
+assert( res.maxBsonObjectSize &&
+ isNumber(res.maxBsonObjectSize) &&
+ res.maxBsonObjectSize > 0, "maxBsonObjectSize possibly missing:" + tojson(res))
+assert( res.maxMessageSizeBytes &&
+ isNumber(res.maxMessageSizeBytes) &&
+ res.maxBsonObjectSize > 0, "maxMessageSizeBytes possibly missing:" + tojson(res))
+assert(res.ismaster, "ismaster missing or false:" + tojson(res))
+assert(res.localTime, "localTime possibly missing:" + tojson(res))
+assert(res.msg && res.msg == "isdbgrid", "msg possibly missing or wrong:" + tojson(res))
View
@@ -280,6 +280,7 @@ namespace mongo {
appendReplicationInfo(result, 0);
result.appendNumber("maxBsonObjectSize", BSONObjMaxUserSize);
+ result.appendNumber("maxMessageSizeBytes", MaxMessageSizeBytes);
result.appendDate("localTime", jsTime());
return true;
}
@@ -1239,6 +1239,9 @@ namespace mongo {
result.appendBool("ismaster", true );
result.append("msg", "isdbgrid");
result.appendNumber("maxBsonObjectSize", BSONObjMaxUserSize);
+ result.appendNumber("maxMessageSizeBytes", MaxMessageSizeBytes);
+ result.appendDate("localTime", jsTime());
+
return true;
}
} ismaster;
@@ -23,6 +23,11 @@
namespace mongo {
+ /**
+ * Maximum accepted message size on the wire protocol.
+ */
+ const int MaxMessageSizeBytes = 48 * 1000 * 1000;
+
class Message;
class MessagingPort;
class PiggyBackData;
@@ -165,7 +165,7 @@ namespace mongo {
int lft = 4;
psock->recv( lenbuf, lft );
- if ( len < 16 || len > 48000000 ) { // messages must be large enough for headers
+ if ( len < 16 || len > MaxMessageSizeBytes ) { // messages must be large enough for headers
if ( len == -1 ) {
// Endian check from the client, after connecting, to see what mode server is running in.
unsigned foo = 0x10203040;

0 comments on commit 020047a

Please sign in to comment.