mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-30 00:56:44 +01:00
fix SERVER-474
This commit is contained in:
parent
b07d09c466
commit
e42ea09fd1
@ -366,8 +366,10 @@ namespace mongo {
|
||||
vector< string > toDelete;
|
||||
DBDirectClient cli;
|
||||
auto_ptr< DBClientCursor > c = cli.query( "local.system.namespaces", Query( fromjson( "{name:/^local.temp./}" ) ) );
|
||||
while( c->more() )
|
||||
toDelete.push_back( c->next().getStringField( "name" ) );
|
||||
while( c->more() ) {
|
||||
BSONObj o = c->next();
|
||||
toDelete.push_back( o.getStringField( "name" ) );
|
||||
}
|
||||
for( vector< string >::iterator i = toDelete.begin(); i != toDelete.end(); ++i ) {
|
||||
log() << "Dropping old temporary collection: " << *i << endl;
|
||||
cli.dropCollection( *i );
|
||||
|
@ -138,24 +138,26 @@ namespace mongo {
|
||||
public:
|
||||
SavedContext() {
|
||||
_save = dbMutex.atLeastReadLocked();
|
||||
|
||||
Client *c = currentClient.get();
|
||||
oldAuth = c->ai;
|
||||
// careful, don't want to free this:
|
||||
c->ai = &always;
|
||||
|
||||
/* it only makes sense to manipulate a pointer - c->database() - if locked.
|
||||
thus the _saved flag.
|
||||
*/
|
||||
if( _save ) {
|
||||
Client *c = currentClient.get();
|
||||
if ( c->database() ) {
|
||||
dbMutex.assertAtLeastReadLocked();
|
||||
_oldName = c->database()->name;
|
||||
}
|
||||
oldAuth = c->ai;
|
||||
// careful, don't want to free this:
|
||||
c->ai = &always;
|
||||
}
|
||||
}
|
||||
~SavedContext() {
|
||||
Client *c = currentClient.get();
|
||||
c->ai = oldAuth;
|
||||
if( _save ) {
|
||||
Client *c = currentClient.get();
|
||||
c->ai = oldAuth;
|
||||
if ( !_oldName.empty() ) {
|
||||
dbMutex.assertAtLeastReadLocked();
|
||||
setClient( _oldName.c_str() );
|
||||
|
Loading…
Reference in New Issue
Block a user