summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl
diff options
context:
space:
mode:
authorBernard Gorman <bernard.gorman@gmail.com>2020-06-01 18:47:00 +0100
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-10-21 23:28:32 +0000
commitf58bdb68407abc68fddc8a91c0d58785423db1b5 (patch)
treecdb930fe469052dd6e51fc19ffea9b4500e0daae /src/mongo/db/repl
parentae47641690c8ff75bd0b729d28d705eacdb84c9d (diff)
downloadmongo-f58bdb68407abc68fddc8a91c0d58785423db1b5.tar.gz
SERVER-48523 Unconditionally check the first entry in the oplog when attempting to resume a change stream
(cherry picked from commit 694ed4153b9d5424b5d169fea5c68f99d4dfb45a) (cherry picked from commit 9e38cbba7d3efefa59e25cb0411558591036d30b)
Diffstat (limited to 'src/mongo/db/repl')
-rw-r--r--src/mongo/db/repl/oplog_entry.h5
-rw-r--r--src/mongo/db/repl/replication_coordinator_external_state_impl.cpp3
2 files changed, 6 insertions, 2 deletions
diff --git a/src/mongo/db/repl/oplog_entry.h b/src/mongo/db/repl/oplog_entry.h
index 815de6a4074..f89016e8bc3 100644
--- a/src/mongo/db/repl/oplog_entry.h
+++ b/src/mongo/db/repl/oplog_entry.h
@@ -40,6 +40,11 @@ namespace mongo {
namespace repl {
/**
+ * The first oplog entry is a no-op with this message in its "msg" field.
+ */
+constexpr auto kInitiatingSetMsg = "initiating set"_sd;
+
+/**
* A parsed oplog entry that inherits from the OplogEntryBase parsed by the IDL.
* This class is immutable.
*/
diff --git a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
index 8f3870337c9..092e6971ee8 100644
--- a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
@@ -431,8 +431,7 @@ Status ReplicationCoordinatorExternalStateImpl::initializeReplSetStorage(Operati
WriteUnitOfWork wuow(opCtx);
Helpers::putSingleton(opCtx, configCollectionName, config);
- const auto msgObj = BSON("msg"
- << "initiating set");
+ const auto msgObj = BSON("msg" << kInitiatingSetMsg);
_service->getOpObserver()->onOpMessage(opCtx, msgObj);
wuow.commit();
// ReplSetTest assumes that immediately after the replSetInitiate