summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEric Milkie <milkie@10gen.com>2012-09-06 16:06:18 -0400
committerDan Pasette <dan@10gen.com>2012-09-12 15:37:09 -0400
commit5ab736e73e59d17b0867cb05f15c89866bc68657 (patch)
tree817f10ebd4b518eaf8fd72faae53cde7aec027cf /src
parente9e9cc60a49f9bc4ec833d54ed72a9e83918a84a (diff)
downloadmongo-5ab736e73e59d17b0867cb05f15c89866bc68657.tar.gz
SERVER-6816 cap the batch on the journal commit limit
Calling commitIfNeeded() in a local db lock is prohibited so I removed it. Instead, we will make the batch sizes smaller than the journal commit limit size to avoid DR102 messages.
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/oplog.cpp1
-rw-r--r--src/mongo/db/repl/rs_sync.h5
2 files changed, 4 insertions, 2 deletions
diff --git a/src/mongo/db/oplog.cpp b/src/mongo/db/oplog.cpp
index d9c6b3660c5..d7f87074c5b 100644
--- a/src/mongo/db/oplog.cpp
+++ b/src/mongo/db/oplog.cpp
@@ -77,7 +77,6 @@ namespace mongo {
int len = op.objsize();
Record *r = theDataFileMgr.fast_oplog_insert(rsOplogDetails, logns, len);
memcpy(getDur().writingPtr(r->data(), len), op.objdata(), len);
- getDur().commitIfNeeded();
}
/* todo: now() has code to handle clock skew. but if the skew server to server is large it will get unhappy.
this code (or code in now() maybe) should be improved.
diff --git a/src/mongo/db/repl/rs_sync.h b/src/mongo/db/repl/rs_sync.h
index f47538d9742..9298c0d387c 100644
--- a/src/mongo/db/repl/rs_sync.h
+++ b/src/mongo/db/repl/rs_sync.h
@@ -20,6 +20,7 @@
#include <vector>
#include "mongo/db/client.h"
+#include "mongo/db/dur.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/oplog.h"
#include "mongo/util/concurrency/thread_pool.h"
@@ -69,7 +70,9 @@ namespace replset {
void applyOpsToOplog(std::deque<BSONObj>* ops);
protected:
- static const unsigned int replBatchSizeBytes = 1024 * 1024 * 256 ;
+ // Cap the batches using the limit on journal commits.
+ // This works out to be 100 MB (64 bit) or 50 MB (32 bit)
+ static const unsigned int replBatchSizeBytes = dur::UncommittedBytesLimit;
// Prefetch and write a deque of operations, using the supplied function.
// Initial Sync and Sync Tail each use a different function.