summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/sync_tail.h
diff options
context:
space:
mode:
authormatt dannenberg <matt.dannenberg@10gen.com>2016-03-15 06:52:29 -0400
committermatt dannenberg <matt.dannenberg@10gen.com>2016-03-23 10:36:12 -0400
commit1bcf7cc983a9ea51b41b0549ad5a3811bf7057b7 (patch)
treed243c3fb3c9af522686ce7c50003b189dbbfa868 /src/mongo/db/repl/sync_tail.h
parentbcac0c80bcf1e4c6b7a55e165f9d08336338068d (diff)
downloadmongo-1bcf7cc983a9ea51b41b0549ad5a3811bf7057b7.tar.gz
SERVER-22858 create a new Applier which wraps multiApply
Diffstat (limited to 'src/mongo/db/repl/sync_tail.h')
-rw-r--r--src/mongo/db/repl/sync_tail.h22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/mongo/db/repl/sync_tail.h b/src/mongo/db/repl/sync_tail.h
index 7fffb39d6e8..9d42ad1ae02 100644
--- a/src/mongo/db/repl/sync_tail.h
+++ b/src/mongo/db/repl/sync_tail.h
@@ -32,6 +32,7 @@
#include "mongo/base/status.h"
#include "mongo/bson/bsonobj.h"
+#include "mongo/db/repl/multiapplier.h"
#include "mongo/db/repl/oplog_entry.h"
#include "mongo/db/storage/mmap_v1/dur.h"
#include "mongo/stdx/functional.h"
@@ -52,8 +53,7 @@ class OpTime;
*/
class SyncTail {
public:
- using MultiSyncApplyFunc =
- stdx::function<void(const std::vector<OplogEntry>& ops, SyncTail* st)>;
+ using MultiSyncApplyFunc = stdx::function<void(const std::vector<OplogEntry>& ops)>;
/**
* Type of function to increment "repl.apply.ops" server status metric.
@@ -178,9 +178,23 @@ private:
OldThreadPool _prefetcherPool;
};
+/**
+ * Applies the opeartions described in the oplog entries contained in "ops" using the
+ * "applyOperation" function.
+ *
+ * Returns ErrorCode::InterruptedAtShutdown if the node enters shutdown while applying ops,
+ * ErrorCodes::CannotApplyOplogWhilePrimary if the node has become primary, and the OpTime of the
+ * final operation applied otherwise.
+ *
+ * Shared between here and MultiApplier.
+ */
+StatusWith<OpTime> multiApply(OperationContext* txn,
+ const MultiApplier::Operations& ops,
+ MultiApplier::ApplyOperationFn applyOperation);
+
// These free functions are used by the thread pool workers to write ops to the db.
-void multiSyncApply(const std::vector<OplogEntry>& ops, SyncTail* st);
-void multiInitialSyncApply(const std::vector<OplogEntry>& ops, SyncTail* st);
+void multiSyncApply(const std::vector<OplogEntry>& ops);
+void multiInitialSyncApply(const std::vector<OplogEntry>& ops);
} // namespace repl
} // namespace mongo