diff options
author | Aaron <aaron@10gen.com> | 2009-01-13 10:34:36 -0500 |
---|---|---|
committer | Aaron <aaron@10gen.com> | 2009-01-13 10:34:36 -0500 |
commit | 303ad60dcfafceb91753d4dfdf0807f4d6bcc435 (patch) | |
tree | 1fb6752d886a19e5c2de640d0dc8adf1f085522d /db | |
parent | 51276a86b1f0c9c5c4cba779e9d0e942549acc0b (diff) | |
download | mongo-303ad60dcfafceb91753d4dfdf0807f4d6bcc435.tar.gz |
Large oplog collection sizes + misc
Diffstat (limited to 'db')
-rw-r--r-- | db/repl.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/db/repl.cpp b/db/repl.cpp index 5407847b7ee..1a6bef00872 100644 --- a/db/repl.cpp +++ b/db/repl.cpp @@ -47,7 +47,7 @@ extern bool quiet; extern boost::mutex dbMutex; -auto_ptr<Cursor> findTableScan(const char *ns, BSONObj& order, bool *isSorted=0); +extern long long oplogSize; int _updateObjects(const char *ns, BSONObj updateobj, BSONObj pattern, bool upsert, stringstream& ss, bool logOp=false); bool _runCommands(const char *ns, BSONObj& jsobj, stringstream& ss, BufBuilder &b, BSONObjBuilder& anObjBuilder, bool fromRepl); void ensureHaveIdIndex(const char *ns); @@ -1155,9 +1155,19 @@ void startReplication() { dblock lk; /* create an oplog collection, if it doesn't yet exist. */ BSONObjBuilder b; - double sz = 50.0 * 1000 * 1000; - if ( sizeof(int *) >= 8 ) - sz = 990.0 * 1000 * 1000; + double sz; + if ( oplogSize != 0 ) + sz = oplogSize; + else { + sz = 50.0 * 1000 * 1000; + if ( sizeof(int *) >= 8 ) { + sz = 990.0 * 1000 * 1000; + boost::intmax_t free = freeSpace(); //-1 if call not supported. + double fivePct = free * 0.05; + if ( fivePct > sz ) + sz = fivePct; + } + } b.append("size", sz); b.appendBool("capped", 1); setClientTempNs("local.oplog.$main"); |