summaryrefslogtreecommitdiff
path: root/db/namespace.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'db/namespace.cpp')
-rw-r--r--db/namespace.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/db/namespace.cpp b/db/namespace.cpp
index fcdaee26946..0cb0e7495ac 100644
--- a/db/namespace.cpp
+++ b/db/namespace.cpp
@@ -598,6 +598,17 @@ namespace mongo {
}
}
+ void NamespaceDetailsTransient::eraseForPrefix(const char *prefix) {
+ assertInWriteLock();
+ vector< string > found;
+ for( ouriter i = _map.begin(); i != _map.end(); ++i )
+ if ( strncmp( i->first.c_str(), prefix, strlen( prefix ) ) == 0 )
+ found.push_back( i->first );
+ for( vector< string >::iterator i = found.begin(); i != found.end(); ++i ) {
+ _map.erase(*i);
+ }
+ }
+
void NamespaceDetailsTransient::computeIndexKeys() {
_keysComputed = true;
_indexKeys.clear();
@@ -648,7 +659,7 @@ namespace mongo {
// index details across commands are in cursors and nsd
// transient (including query cache) so clear these.
ClientCursor::invalidate( from );
- NamespaceDetailsTransient::clearForPrefix( from );
+ NamespaceDetailsTransient::eraseForPrefix( from );
NamespaceDetails *details = ni->details( from );
ni->add_ns( to, *details );