diff options
author | Eliot Horowitz <eliot@10gen.com> | 2010-03-16 17:38:39 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2010-03-16 17:38:39 -0400 |
commit | 6ff986d3a53b20fe7b21c83f5265682acae4d7c1 (patch) | |
tree | 5ad3f9937ed8678d39fa5e801a2ae0b4c3da9109 | |
parent | 1e42decc4c2172958ee23491efb0c24bf081a8d5 (diff) | |
download | mongo-6ff986d3a53b20fe7b21c83f5265682acae4d7c1.tar.gz |
fix Top leak with drop SERVER-768
-rw-r--r-- | db/client.cpp | 2 | ||||
-rw-r--r-- | db/stats/top.cpp | 10 | ||||
-rw-r--r-- | db/stats/top.h | 1 |
3 files changed, 12 insertions, 1 deletions
diff --git a/db/client.cpp b/db/client.cpp index 27c137e1dbc..294ceecc17d 100644 --- a/db/client.cpp +++ b/db/client.cpp @@ -69,6 +69,8 @@ namespace mongo { didAnything = true; for ( list<string>::iterator i = _tempCollections.begin(); i!=_tempCollections.end(); i++ ){ string ns = *i; + Top::global.collectionDropped( ns ); + dblock l; Client::Context ctx( ns ); if ( ! nsdetails( ns.c_str() ) ) diff --git a/db/stats/top.cpp b/db/stats/top.cpp index 0c1bd1900af..0f27943df06 100644 --- a/db/stats/top.cpp +++ b/db/stats/top.cpp @@ -44,9 +44,15 @@ namespace mongo { } - + void Top::record( const string& ns , int op , int lockType , long long micros , bool command ){ + //cout << "record: " << ns << "\t" << op << "\t" << command << endl; scoped_lock lk(_lock); + + if ( ( command || op == dbQuery ) && ns == _lastDropped ){ + _lastDropped = ""; + return; + } CollectionData& coll = _usage[ns]; _record( coll , op , lockType , micros , command ); @@ -54,8 +60,10 @@ namespace mongo { } void Top::collectionDropped( const string& ns ){ + //cout << "collectionDropped: " << ns << endl; scoped_lock lk(_lock); _usage.erase(ns); + _lastDropped = ns; } void Top::_record( CollectionData& c , int op , int lockType , long long micros , bool command ){ diff --git a/db/stats/top.h b/db/stats/top.h index 1f977061666..8dab3b0136d 100644 --- a/db/stats/top.h +++ b/db/stats/top.h @@ -85,6 +85,7 @@ namespace mongo { mongo::mutex _lock; CollectionData _global; UsageMap _usage; + string _lastDropped; }; /* Records per namespace utilization of the mongod process. |