mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
rs rollback create collection
This commit is contained in:
parent
c23fc0b083
commit
beaf89b124
@ -300,7 +300,7 @@ namespace mongo {
|
||||
}
|
||||
}
|
||||
|
||||
massert( 13415, "emptying the collection is not allowed", nrecords > 1 );
|
||||
uassert( 13415, "emptying the collection is not allowed", nrecords > 1 );
|
||||
|
||||
if ( !capLooped() ) {
|
||||
theDataFileMgr.deleteRecord(ns, curr.rec(), curr, true);
|
||||
|
@ -78,6 +78,9 @@ namespace mongo {
|
||||
need to refetch it once. */
|
||||
set<DocID> toRefetch;
|
||||
|
||||
/* collections to drop */
|
||||
set<string> toDrop;
|
||||
|
||||
OpTime commonPoint;
|
||||
DiskLoc commonPointOurDiskloc;
|
||||
|
||||
@ -97,7 +100,7 @@ namespace mongo {
|
||||
DocID d;
|
||||
d.ns = ourObj.getStringField("ns");
|
||||
if( *d.ns == 0 ) {
|
||||
log() << "replSet WARNING ignoring op on rollback TODO : " << ourObj.toString() << rsLog;
|
||||
log() << "replSet WARNING ignoring op on rollback no ns TODO : " << ourObj.toString() << rsLog;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -107,6 +110,16 @@ namespace mongo {
|
||||
return;
|
||||
}
|
||||
|
||||
if( *op == 'c' ) {
|
||||
/* Create collection operation
|
||||
{ ts: ..., h: ..., op: "c", ns: "foo.$cmd", o: { create: "abc", ... } }
|
||||
*/
|
||||
NamespaceString s(d.ns); // foo.$cmd
|
||||
string ns = s.db + '.' + o["create"].String(); // -> foo.abc
|
||||
h.toDrop.insert(ns);
|
||||
return;
|
||||
}
|
||||
|
||||
d._id = o["_id"];
|
||||
if( d._id.eoo() ) {
|
||||
log() << "replSet WARNING ignoring op on rollback no _id TODO : " << ourObj.toString() << rsLog;
|
||||
@ -274,6 +287,20 @@ namespace mongo {
|
||||
catch(...){}
|
||||
Helpers::putSingleton("local.replset.minvalid", newMinValid);
|
||||
|
||||
/** first drop collections to drop - that might make things faster below actually if there were subsequent inserts */
|
||||
for( set<string>::iterator i = h.toDrop.begin(); i != h.toDrop.end(); i++ ) {
|
||||
Client::Context c(*i, dbpath, 0, /*doauth*/false);
|
||||
try {
|
||||
bob res;
|
||||
string errmsg;
|
||||
log(1) << "replSet rollback drop: " << *i << rsLog;
|
||||
dropCollection(*i, errmsg, res);
|
||||
}
|
||||
catch(...) {
|
||||
log() << "replset rollback error dropping collection " << *i << rsLog;
|
||||
}
|
||||
}
|
||||
|
||||
Client::Context c(rsoplog, dbpath, 0, /*doauth*/false);
|
||||
NamespaceDetails *oplogDetails = nsdetails(rsoplog);
|
||||
uassert(13423, str::stream() << "replSet error in rollback can't find " << rsoplog, oplogDetails);
|
||||
|
@ -97,8 +97,7 @@ function doItemsToRollBack(db) {
|
||||
db.newcoll.insert({ a: true });
|
||||
|
||||
// create a new empty collection (need to roll back the whole thing)
|
||||
// TODO NOT DONE
|
||||
// db.createCollection("abc");
|
||||
db.createCollection("abc");
|
||||
}
|
||||
|
||||
function doWritesToKeep2(db) {
|
||||
|
Loading…
Reference in New Issue
Block a user