0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

fail fast on oplog already existing

This commit is contained in:
Eliot Horowitz 2009-10-05 16:26:19 -04:00
parent c2b148ad2f
commit 17da656d91

View File

@ -1620,6 +1620,13 @@ namespace mongo {
void createOplog() { void createOplog() {
dblock lk; dblock lk;
const char * ns = "local.oplog.$main";
setClientTempNs(ns);
if ( nsdetails( ns ) )
return;
/* create an oplog collection, if it doesn't yet exist. */ /* create an oplog collection, if it doesn't yet exist. */
BSONObjBuilder b; BSONObjBuilder b;
double sz; double sz;
@ -1643,10 +1650,10 @@ namespace mongo {
b.append("size", sz); b.append("size", sz);
b.appendBool("capped", 1); b.appendBool("capped", 1);
b.appendBool("autoIndexId", false); b.appendBool("autoIndexId", false);
setClientTempNs("local.oplog.$main");
string err; string err;
BSONObj o = b.done(); BSONObj o = b.done();
userCreateNS("local.oplog.$main", o, err, false); userCreateNS(ns, o, err, false);
logOp( "n", "dummy", BSONObj() ); logOp( "n", "dummy", BSONObj() );
database = 0; database = 0;
} }