diff options
author | Eliot Horowitz <eliot@10gen.com> | 2009-10-14 10:20:53 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2009-10-14 10:20:53 -0400 |
commit | 25d2f88e1ec30777dedb0e3f6887cd4792344a30 (patch) | |
tree | 4d48a65fc963c49e345c1a3ee5f0c2db45971609 /db/security.cpp | |
parent | 47fcbc6b67a3f5661bf658ba4646ed204f5f45cc (diff) | |
download | mongo-25d2f88e1ec30777dedb0e3f6887cd4792344a30.tar.gz |
clean up MR temp tables SERVER-327
Client shutdown hook
Diffstat (limited to 'db/security.cpp')
-rw-r--r-- | db/security.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/db/security.cpp b/db/security.cpp index a4c524404a5..25a9f32f315 100644 --- a/db/security.cpp +++ b/db/security.cpp @@ -18,6 +18,7 @@ #include "stdafx.h" #include "security.h" +#include "instance.h" #include "client.h" namespace mongo { @@ -30,8 +31,36 @@ namespace mongo { Client::~Client() { delete ai; + ai = 0; + if ( _tempCollections.size() ){ + cerr << "ERROR: Client::shutdown not called!" << endl; + } } + bool Client::shutdown(){ + bool didAnything = false; + + if ( _tempCollections.size() ){ + didAnything = true; + for ( list<string>::iterator i = _tempCollections.begin(); i!=_tempCollections.end(); i++ ){ + string ns = *i; + if ( ! nsdetails( ns.c_str() ) ) + continue; + try { + string err; + BSONObjBuilder b; + dropCollection( ns , err , b ); + } + catch ( ... ){ + log() << "error dropping temp collection: " << ns << endl; + } + } + _tempCollections.clear(); + } + + return didAnything; + } + bool noauth = true; int AuthenticationInfo::warned; |