diff --git a/db/namespace.cpp b/db/namespace.cpp index 64027f6423d..519f1de9fab 100644 --- a/db/namespace.cpp +++ b/db/namespace.cpp @@ -508,6 +508,7 @@ namespace mongo { } void NamespaceDetailsTransient::computeIndexKeys() { + allIndexKeys.clear(); NamespaceDetails *d = nsdetails(ns.c_str()); for ( int i = 0; i < d->nIndexes; i++ ) { // set fields; diff --git a/db/namespace.h b/db/namespace.h index 506423cf67d..30a3cffdd56 100644 --- a/db/namespace.h +++ b/db/namespace.h @@ -323,6 +323,9 @@ namespace mongo { void addedIndex() { haveIndexKeys=false; } + void deletedIndex() { + haveIndexKeys = false; + } private: static std::map map; public: diff --git a/db/pdfile.cpp b/db/pdfile.cpp index 69e704ba162..b17c6994d1c 100644 --- a/db/pdfile.cpp +++ b/db/pdfile.cpp @@ -35,6 +35,7 @@ _ disallow system* manipulations from the database. #include "query.h" #include "repl.h" #include "dbhelpers.h" +#include "namespace.h" namespace mongo { @@ -446,8 +447,10 @@ namespace mongo { */ void IndexDetails::kill() { string ns = indexNamespace(); // e.g. foo.coll.$ts_1 - + { + // clean up parent namespace index cache + NamespaceDetailsTransient::get( parentNS().c_str() ).deletedIndex(); // clean up in system.indexes BSONObjBuilder b; b.append("name", indexName().c_str()); diff --git a/jstests/update2.js b/jstests/update2.js index 4f05cc1d28a..726489d64d8 100644 --- a/jstests/update2.js +++ b/jstests/update2.js @@ -1,7 +1,7 @@ db = connect( "test" ); f = db.ed_db_update2; -f.drop(); +f.drop(); f.save( { a: 4 } ); f.update( { a: 4 }, { $inc: { a: 2 } } ); assert.eq( 6, f.findOne().a );