rs use aarons new emptycappedcollection impl

This commit is contained in:
Dwight
2010-08-02 17:52:33 -04:00
parent 378a39aba3
commit 3f0ebaf81f

View File

@@ -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;