summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/bgsync.h
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2018-03-12 17:55:28 -0400
committerBenety Goh <benety@mongodb.com>2018-03-12 17:56:19 -0400
commita1942a4ea0d79aaa7bb93978acbc4273af29a2eb (patch)
treef41d42642f7afa3e184cd62544a5f4f84d5c9220 /src/mongo/db/repl/bgsync.h
parent445d92f0880f4315528032916c6cb7a4567d817f (diff)
downloadmongo-a1942a4ea0d79aaa7bb93978acbc4273af29a2eb.tar.gz
SERVER-32332 move ownership of OplogBuffer from BackgroundSync to ReplicationCoordinatorExternalStateImpl
The new OplogApplier requires an OplogBuffer passed in at construction. Moving the ownership out of BackgroundSync makes it clear that the OplogBuffer is owned by neither BackgroundSync nor OplogApplier.
Diffstat (limited to 'src/mongo/db/repl/bgsync.h')
-rw-r--r--src/mongo/db/repl/bgsync.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/mongo/db/repl/bgsync.h b/src/mongo/db/repl/bgsync.h
index 6f5c7fc116d..127c49fe8ec 100644
--- a/src/mongo/db/repl/bgsync.h
+++ b/src/mongo/db/repl/bgsync.h
@@ -77,10 +77,15 @@ public:
*/
enum class ProducerState { Starting, Running, Stopped };
+ /**
+ * Constructs a BackgroundSync to fetch oplog entries from a sync source.
+ * The BackgroundSync does not own any of the components referenced by the constructor
+ * arguments. All these components must outlive the BackgroundSync object.
+ */
BackgroundSync(ReplicationCoordinator* replicationCoordinator,
ReplicationCoordinatorExternalState* replicationCoordinatorExternalState,
ReplicationProcess* replicationProcess,
- std::unique_ptr<OplogBuffer> oplogBuffer);
+ OplogBuffer* oplogBuffer);
// stop syncing (when this node becomes a primary, e.g.)
// During stepdown, the last fetched optime is not reset in order to keep track of the lastest
@@ -203,8 +208,8 @@ private:
OpTimeWithHash _readLastAppliedOpTimeWithHash(OperationContext* opCtx);
- // Production thread
- std::unique_ptr<OplogBuffer> _oplogBuffer;
+ // This OplogBuffer holds oplog entries fetched from the sync source.
+ OplogBuffer* const _oplogBuffer;
// A pointer to the replication coordinator running the show.
ReplicationCoordinator* _replCoord;