summaryrefslogtreecommitdiff
path: root/s/request.cpp
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-04-20 12:58:04 -0400
committerEliot Horowitz <eliot@10gen.com>2010-04-20 12:58:04 -0400
commit55e8b26481cfe877c4bd90ffe9e74e99c657cd44 (patch)
tree0f9463b751c41862c79092bfa762873bdc1df395 /s/request.cpp
parentfb09b882408b9c607437dc27bd402fe562bdc3a1 (diff)
downloadmongo-55e8b26481cfe877c4bd90ffe9e74e99c657cd44.tar.gz
basic serverStatus for mongos SERVER-942
Diffstat (limited to 's/request.cpp')
-rw-r--r--s/request.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/s/request.cpp b/s/request.cpp
index 02ada3cf376..92a07e8965c 100644
--- a/s/request.cpp
+++ b/s/request.cpp
@@ -21,8 +21,11 @@
#include "stdafx.h"
#include "server.h"
+
#include "../db/commands.h"
#include "../db/dbmessage.h"
+#include "../db/stats/counters.h"
+
#include "../client/connpool.h"
#include "request.h"
@@ -61,7 +64,7 @@ namespace mongo {
}
- string Request::singleServerName(){
+ string Request::singleServerName() const {
if ( _chunkManager ){
if ( _chunkManager->numChunks() > 1 )
throw UserException( 8060 , "can't call singleServerName on a sharded collection" );
@@ -82,12 +85,14 @@ namespace mongo {
Strategy * s = SINGLE;
_d.markSet();
-
+
if ( _chunkManager ){
s = SHARDED;
}
-
+
+ bool iscmd = false;
if ( op == dbQuery ) {
+ iscmd = isCommand();
try {
s->queryOp( *this );
}
@@ -108,8 +113,14 @@ namespace mongo {
else {
s->writeOp( op, *this );
}
+
+ globalOpCounters.gotOp( op , iscmd );
}
+ bool Request::isCommand() const {
+ int x = _d.getQueryNToReturn();
+ return ( x == 1 || x == -1 ) && strstr( getns() , ".$cmd" );
+ }
ClientInfo::ClientInfo( int clientId ) : _id( clientId ){
_cur = &_a;