From 929ae35cdd0d5aaa4e9338e05b8ad7abcc5d8b26 Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Tue, 9 Feb 2010 16:58:03 -0500 Subject: [PATCH] inprog takes $all : 1 option --- db/client.cpp | 4 ++++ db/curop.h | 6 +++++- db/instance.cpp | 10 ++++++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/db/client.cpp b/db/client.cpp index 5d8793230bb..fb5f91a151a 100644 --- a/db/client.cpp +++ b/db/client.cpp @@ -209,6 +209,10 @@ namespace mongo { stringstream clientStr; clientStr << inet_ntoa( _remote.sin_addr ) << ":" << ntohs( _remote.sin_port ); b.append("client", clientStr.str()); + + if ( _client ) + b.append( "desc" , _client->desc() ); + return b.obj(); } diff --git a/db/curop.h b/db/curop.h index 8012e817a23..fd0097690ae 100644 --- a/db/curop.h +++ b/db/curop.h @@ -148,11 +148,15 @@ namespace mongo { } AtomicUInt opNum() const { return _opNum; } + + /** if this op is running */ bool active() const { return _active; } + int getLockType() const { return _lockType; } bool isWaitingForLock() const { return _waitingForLock; } int getOp() const { return _op; } - + + /** micros */ unsigned long long startTime() { ensureStarted(); diff --git a/db/instance.cpp b/db/instance.cpp index 0f399327b87..9408bbe11d9 100644 --- a/db/instance.cpp +++ b/db/instance.cpp @@ -89,13 +89,19 @@ namespace mongo { b.append("err", "unauthorized"); } else { + DbMessage d(m); + QueryMessage q(d); + bool all = q.query["$all"].trueValue(); vector vals; { + Client& me = cc(); boostlock bl(Client::clientsMutex); for( set::iterator i = Client::clients.begin(); i != Client::clients.end(); i++ ) { Client *c = *i; + if ( c == &me ) + continue; CurOp& co = *(c->curop()); - if( co.active() ) + if( all || co.active() ) vals.push_back( co.infoNoauth() ); } } @@ -106,7 +112,7 @@ namespace mongo { b.append("info", "use command {unlock:0} to terminate the fsync write/snapshot lock"); } } - + replyToQuery(0, m, dbresponse, b.obj()); }