summaryrefslogtreecommitdiff
path: root/db/stats
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-03-16 17:38:39 -0400
committerEliot Horowitz <eliot@10gen.com>2010-03-16 17:38:39 -0400
commit6ff986d3a53b20fe7b21c83f5265682acae4d7c1 (patch)
tree5ad3f9937ed8678d39fa5e801a2ae0b4c3da9109 /db/stats
parent1e42decc4c2172958ee23491efb0c24bf081a8d5 (diff)
downloadmongo-6ff986d3a53b20fe7b21c83f5265682acae4d7c1.tar.gz
fix Top leak with drop SERVER-768
Diffstat (limited to 'db/stats')
-rw-r--r--db/stats/top.cpp10
-rw-r--r--db/stats/top.h1
2 files changed, 10 insertions, 1 deletions
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.