summaryrefslogtreecommitdiff
path: root/db/repl/rs_rollback.cpp
diff options
context:
space:
mode:
authorDwight <dwight@10gen.com>2010-08-03 14:32:01 -0400
committerDwight <dwight@10gen.com>2010-08-03 14:32:01 -0400
commitc23fc0b083ffa6e6190e2c5038d0d4c4156deb64 (patch)
tree3d82361be688acd31e5dda1b48771ed887e33753 /db/repl/rs_rollback.cpp
parentc74017704115788be868058ec0e1b8ce055561be (diff)
downloadmongo-c23fc0b083ffa6e6190e2c5038d0d4c4156deb64.tar.gz
rollback certain create collection cases
Diffstat (limited to 'db/repl/rs_rollback.cpp')
-rw-r--r--db/repl/rs_rollback.cpp30
1 files changed, 26 insertions, 4 deletions
diff --git a/db/repl/rs_rollback.cpp b/db/repl/rs_rollback.cpp
index 6309f275508..e9d8ed1945d 100644
--- a/db/repl/rs_rollback.cpp
+++ b/db/repl/rs_rollback.cpp
@@ -250,9 +250,9 @@ namespace mongo {
sethbmsg("syncRollback 3.5");
if( h.rbid != getRBID(r.conn()) ) {
- // our source rolled back itself. so the data we received isn't necessarily consistent.
- sethbmsg("syncRollback rbid on source changed during rollback, cancelling this attempt");
- return;
+ // our source rolled back itself. so the data we received isn't necessarily consistent.
+ sethbmsg("syncRollback rbid on source changed during rollback, cancelling this attempt");
+ return;
}
// update them
@@ -267,7 +267,7 @@ namespace mongo {
dbMutex.assertWriteLocked();
/* we have items we are writing that aren't from a point-in-time. thus best not to come online
- until we get to that point in freshness. */
+ until we get to that point in freshness. */
try {
log() << "replSet set minvalid=" << newMinValid["ts"]._opTime().toString() << rsLog;
}
@@ -338,6 +338,28 @@ namespace mongo {
log() << "replSet error rollback delete failed ns:" << d.ns << rsLog;
}
}
+ // did we just empty the collection? if so let's check if it even exists on the source.
+ if( nsd->nrecords == 0 ) {
+ try {
+ string sys = cc().database()->name + ".system.namespaces";
+ bo o = them->findOne(sys, QUERY("name"<<d.ns));
+ if( o.isEmpty() ) {
+ // we should drop
+ try {
+ bob res;
+ string errmsg;
+ dropCollection(d.ns, errmsg, res);
+ }
+ catch(...) {
+ log() << "replset error rolling back collection " << d.ns << rsLog;
+ }
+ }
+ }
+ catch(DBException& ) {
+ /* this isn't *that* big a deal, but is bad. */
+ log() << "replSet warning rollback error querying for existence of " << d.ns << " at the primary, ignoring" << rsLog;
+ }
+ }
}
}
else {