0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 09:06:21 +01:00

Reset index cache when deleting index

This commit is contained in:
Aaron 2009-01-27 16:16:53 -05:00
parent 9436315b03
commit cfb9ffa0ec
4 changed files with 9 additions and 2 deletions

View File

@ -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<string> fields;

View File

@ -323,6 +323,9 @@ namespace mongo {
void addedIndex() {
haveIndexKeys=false;
}
void deletedIndex() {
haveIndexKeys = false;
}
private:
static std::map<string,NamespaceDetailsTransient*> map;
public:

View File

@ -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());

View File

@ -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 );