correctly rollback a failed index create
This commit is contained in:
@@ -598,7 +598,7 @@ namespace mongo {
|
||||
// delete just one index
|
||||
int x = d->findIndexByName(name);
|
||||
if ( x >= 0 ) {
|
||||
out() << " d->nIndexes was " << d->nIndexes << endl;
|
||||
log(4) << " d->nIndexes was " << d->nIndexes << endl;
|
||||
anObjBuilder.append("nIndexesWas", (double)d->nIndexes);
|
||||
|
||||
/* note it is important we remove the IndexDetails with this
|
||||
|
||||
@@ -628,7 +628,13 @@ assert( !eloc.isNull() );
|
||||
b.append("ns", parentNS().c_str());
|
||||
BSONObj cond = b.done(); // e.g.: { name: "ts_1", ns: "foo.coll" }
|
||||
|
||||
btreeStore->drop(ns.c_str());
|
||||
/* important to catch exception here so we can finish cleanup below. */
|
||||
try {
|
||||
btreeStore->drop(ns.c_str());
|
||||
}
|
||||
catch(DBException& ) {
|
||||
log(2) << "IndexDetails::kill(): couldn't drop ns " << ns << endl;
|
||||
}
|
||||
head.setInvalid();
|
||||
info.setInvalid();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user