From 3f0ebaf81fdfa6308359d5eebcfe8a73b3aea4f9 Mon Sep 17 00:00:00 2001 From: Dwight Date: Mon, 2 Aug 2010 17:52:33 -0400 Subject: [PATCH] rs use aarons new emptycappedcollection impl --- db/repl/rs_initialsync.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/db/repl/rs_initialsync.cpp b/db/repl/rs_initialsync.cpp index 583ff29c457..f6c379c6f7b 100644 --- a/db/repl/rs_initialsync.cpp +++ b/db/repl/rs_initialsync.cpp @@ -69,12 +69,7 @@ namespace mongo { bool copyCollectionFromRemote(const string& host, const string& ns, const BSONObj& query, string errmsg); static void emptyOplog() { - /* if we drop we would have to recreate. instead we truncate. but current - truncate impl is slow. TODO */ - writelock lk(rsoplog); - string errmsg; - bob res; Client::Context ctx(rsoplog); NamespaceDetails *d = nsdetails(rsoplog); @@ -82,10 +77,15 @@ namespace mongo { if( d && d->nrecords == 0 ) return; // already empty, ok. - dropCollection(rsoplog, errmsg, res); + log(1) << "replSet empty oplog" << rsLog; + d->emptyCappedCollection(rsoplog); + /* + string errmsg; + bob res; + dropCollection(rsoplog, errmsg, res); log() << "replSet recreated oplog so it is empty. todo optimize this..." << rsLog; - createOplog(); + createOplog();*/ // TEMP: restart to recreate empty oplog //log() << "replSet FATAL error during initial sync. mongod restart required." << rsLog;