diff options
author | Dwight <dmerriman@gmail.com> | 2008-07-16 17:38:46 -0400 |
---|---|---|
committer | Dwight <dmerriman@gmail.com> | 2008-07-16 17:38:46 -0400 |
commit | 940273d63503299472c55d4dece05472a9fcd417 (patch) | |
tree | 6395af3ce7c65d935cd2c98c385ef0b8742a1a21 | |
parent | 7d5c131193f1740e4efe1750b58e1e4c3471b6e7 (diff) | |
download | mongo-940273d63503299472c55d4dece05472a9fcd417.tar.gz |
show query expression when slow
-rw-r--r-- | db/db.cpp | 3 | ||||
-rw-r--r-- | db/query.cpp | 10 |
2 files changed, 9 insertions, 4 deletions
diff --git a/db/db.cpp b/db/db.cpp index 5241a15f9f4..aba19dd06e1 100644 --- a/db/db.cpp +++ b/db/db.cpp @@ -480,6 +480,9 @@ void jniCallback(Message& m, Message& out) } } +/* we create one thread for each connection from an app server client. + app server will open a pool of threads. +*/ void connThread() { try { diff --git a/db/query.cpp b/db/query.cpp index fef59074a0c..5943fa28b22 100644 --- a/db/query.cpp +++ b/db/query.cpp @@ -829,6 +829,7 @@ int runCount(const char *ns, JSObj& cmd, string& err) { QueryResult* runQuery(Message& message, const char *ns, int ntoskip, int _ntoreturn, JSObj jsobj, auto_ptr< set<string> > filter, stringstream& ss) { + time_t t = time(0); bool wantMore = true; int ntoreturn = _ntoreturn; if( _ntoreturn < 0 ) { @@ -836,10 +837,6 @@ QueryResult* runQuery(Message& message, const char *ns, int ntoskip, int _ntoret wantMore = false; } ss << "query " << ns << " ntoreturn:" << ntoreturn; - if( ntoskip ) - ss << " ntoskip:" << ntoskip; - if( client->profile ) - ss << "<br>query: " << jsobj.toString() << ' '; int n = 0; BufBuilder b(32768); @@ -963,6 +960,11 @@ assert( debug.getN() < 5000 ); qr->nReturned = n; b.decouple(); + if( (client && client->profile) || time(0)-t > 5 ) { + if( ntoskip ) + ss << " ntoskip:" << ntoskip; + ss << " <br>query: " << jsobj.toString() << ' '; + } ss << " nreturned:" << n; return qr; } |