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:
parent
9436315b03
commit
cfb9ffa0ec
@ -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;
|
||||
|
@ -323,6 +323,9 @@ namespace mongo {
|
||||
void addedIndex() {
|
||||
haveIndexKeys=false;
|
||||
}
|
||||
void deletedIndex() {
|
||||
haveIndexKeys = false;
|
||||
}
|
||||
private:
|
||||
static std::map<string,NamespaceDetailsTransient*> map;
|
||||
public:
|
||||
|
@ -35,6 +35,7 @@ _ disallow system* manipulations from the database.
|
||||
#include "query.h"
|
||||
#include "repl.h"
|
||||
#include "dbhelpers.h"
|
||||
#include "namespace.h"
|
||||
|
||||
namespace mongo {
|
||||
|
||||
@ -448,6 +449,8 @@ namespace mongo {
|
||||
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());
|
||||
|
@ -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 );
|
||||
|
Loading…
Reference in New Issue
Block a user