summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/base_cloner.h
diff options
context:
space:
mode:
authorMatthew Russotto <matthew.russotto@10gen.com>2020-01-27 11:13:14 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-01-28 22:51:06 +0000
commit681631228dbaa98e00d1ea6d98c00662ef293a2b (patch)
tree087ad02de3606d57317764bc34d70ff23aa1cfd4 /src/mongo/db/repl/base_cloner.h
parentf2ea3303ab1116992442102c03371b9e50de789b (diff)
downloadmongo-681631228dbaa98e00d1ea6d98c00662ef293a2b.tar.gz
SERVER-45503 Arrange events so cloner onCompletion is never run with lock held
Diffstat (limited to 'src/mongo/db/repl/base_cloner.h')
-rw-r--r--src/mongo/db/repl/base_cloner.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/mongo/db/repl/base_cloner.h b/src/mongo/db/repl/base_cloner.h
index 7efdd9e640b..38079eeebac 100644
--- a/src/mongo/db/repl/base_cloner.h
+++ b/src/mongo/db/repl/base_cloner.h
@@ -64,10 +64,15 @@ public:
Status run();
/**
- * Executes the run() method asychronously on the given taskExecutor, returning the result
- * as a Future.
+ * Executes the run() method asychronously on the given taskExecutor when the event is
+ * signalled, returning the result as a Future.
+ *
+ * If the executor is valid, the Future is guaranteed to not be ready until the event is
+ * signalled. If the executor is not valid (e.g. shutting down), the future will be
+ * ready immediately after the call and the EventHandle will be invalid.
*/
- Future<void> runOnExecutor(executor::TaskExecutor* executor);
+ std::pair<Future<void>, executor::TaskExecutor::EventHandle> runOnExecutorEvent(
+ executor::TaskExecutor* executor);
/**
* For unit testing, allow stopping after any given stage.
@@ -258,10 +263,10 @@ private:
// invariant checking.
bool _active = false; // (M)
Status _status = Status::OK(); // (M)
- // _startedAsync indicates the cloner is being run on some executor using runOnExecutor(),
+ // _startedAsync indicates the cloner is being run on some executor using runOnExecutorEvent(),
// and is used only for invariant checking.
bool _startedAsync = false; // (M)
- // _promise corresponds to the Future returned by runOnExecutor(). When not running
+ // _promise corresponds to the Future returned by runOnExecutorEvent(). When not running
// asynchronously, this is a null promise.
Promise<void> _promise; // (S)
// _stopAfterStage is used for unit testing and causes the cloner to exit after a given