summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2016-01-26 16:26:15 -0500
committerBenety Goh <benety@mongodb.com>2016-02-05 13:32:33 -0500
commit1ecf7de7e18df42c154c04b1d9310956c91a75b7 (patch)
tree737f52e7e6ef1c3ca98caba26465ff37e22237a7
parent102e832f218ecdec47d8eebf4e827072075325d7 (diff)
downloadmongo-1ecf7de7e18df42c154c04b1d9310956c91a75b7.tar.gz
SERVER-22287 added replicaSetId field to replica set configuration and metadata.
This field is generated when a replica set configuration is created from the replSetInitiate command
-rw-r--r--src/mongo/db/repl/replica_set_config.cpp49
-rw-r--r--src/mongo/db/repl/replica_set_config.h31
-rw-r--r--src/mongo/db/repl/replica_set_config_test.cpp92
-rw-r--r--src/mongo/db/repl/topology_coordinator_impl.cpp1
-rw-r--r--src/mongo/rpc/metadata/repl_set_metadata.cpp11
-rw-r--r--src/mongo/rpc/metadata/repl_set_metadata.h18
-rw-r--r--src/mongo/rpc/metadata/repl_set_metadata_test.cpp23
-rw-r--r--src/mongo/s/catalog/replset/catalog_manager_replica_set_test.cpp20
8 files changed, 219 insertions, 26 deletions
diff --git a/src/mongo/db/repl/replica_set_config.cpp b/src/mongo/db/repl/replica_set_config.cpp
index 5f9220918fd..bd71c7fb77a 100644
--- a/src/mongo/db/repl/replica_set_config.cpp
+++ b/src/mongo/db/repl/replica_set_config.cpp
@@ -78,18 +78,24 @@ const std::string kGetLastErrorDefaultsFieldName = "getLastErrorDefaults";
const std::string kGetLastErrorModesFieldName = "getLastErrorModes";
const std::string kHeartbeatIntervalFieldName = "heartbeatIntervalMillis";
const std::string kHeartbeatTimeoutFieldName = "heartbeatTimeoutSecs";
+const std::string kReplicaSetIdFieldName = "replicaSetId";
} // namespace
-Status ReplicaSetConfig::initialize(const BSONObj& cfg, bool usePV1ByDefault) {
- return _initialize(cfg, false, usePV1ByDefault);
+Status ReplicaSetConfig::initialize(const BSONObj& cfg,
+ bool usePV1ByDefault,
+ OID defaultReplicaSetId) {
+ return _initialize(cfg, false, usePV1ByDefault, defaultReplicaSetId);
}
Status ReplicaSetConfig::initializeForInitiate(const BSONObj& cfg, bool usePV1ByDefault) {
- return _initialize(cfg, true, usePV1ByDefault);
+ return _initialize(cfg, true, usePV1ByDefault, OID());
}
-Status ReplicaSetConfig::_initialize(const BSONObj& cfg, bool forInitiate, bool usePV1ByDefault) {
+Status ReplicaSetConfig::_initialize(const BSONObj& cfg,
+ bool forInitiate,
+ bool usePV1ByDefault,
+ OID defaultReplicaSetId) {
_isInitialized = false;
_members.clear();
Status status =
@@ -185,6 +191,23 @@ Status ReplicaSetConfig::_initialize(const BSONObj& cfg, bool forInitiate, bool
if (!status.isOK())
return status;
+ //
+ // Generate replica set ID if called from replSetInitiate.
+ // Otherwise, uses 'defaultReplicatSetId' as default if 'cfg' doesn't have an ID.
+ //
+ if (forInitiate) {
+ if (_replicaSetId.isSet()) {
+ return Status(ErrorCodes::InvalidReplicaSetConfig,
+ str::stream() << "replica set configuration cannot contain '"
+ << kReplicaSetIdFieldName
+ << "' "
+ "field when called from replSetInitiate: " << cfg);
+ }
+ _replicaSetId = OID::gen();
+ } else if (!_replicaSetId.isSet()) {
+ _replicaSetId = defaultReplicaSetId;
+ }
+
_calculateMajorities();
_addInternalWriteConcernModes();
_isInitialized = true;
@@ -322,6 +345,19 @@ Status ReplicaSetConfig::_parseSettingsSubdocument(const BSONObj& settings) {
_customWriteConcernModes[modeElement.fieldNameStringData()] = pattern;
}
+ // Parse replica set ID.
+ OID replicaSetId;
+ status = mongo::bsonExtractOIDField(settings, kReplicaSetIdFieldName, &replicaSetId);
+ if (status.isOK()) {
+ if (!replicaSetId.isSet()) {
+ return Status(ErrorCodes::BadValue,
+ str::stream() << kReplicaSetIdFieldName << " field value cannot be null");
+ }
+ } else if (status != ErrorCodes::NoSuchKey) {
+ return status;
+ }
+ _replicaSetId = replicaSetId;
+
return Status::OK();
}
@@ -687,6 +723,11 @@ BSONObj ReplicaSetConfig::toBSON() const {
gleModes.done();
settingsBuilder.append(kGetLastErrorDefaultsFieldName, _defaultWriteConcern.toBSON());
+
+ if (_replicaSetId.isSet()) {
+ settingsBuilder.append(kReplicaSetIdFieldName, _replicaSetId);
+ }
+
settingsBuilder.done();
return configBuilder.obj();
}
diff --git a/src/mongo/db/repl/replica_set_config.h b/src/mongo/db/repl/replica_set_config.h
index 651c4e904da..509a84b0b5c 100644
--- a/src/mongo/db/repl/replica_set_config.h
+++ b/src/mongo/db/repl/replica_set_config.h
@@ -68,8 +68,11 @@ public:
* Initializes this ReplicaSetConfig from the contents of "cfg".
* The default protocol version is 0 to keep backward-compatibility.
* If usePV1ByDefault is true, the protocol version will be 1 when it's not specified in "cfg".
+ * Sets _replicaSetId to "defaultReplicaSetId" if a replica set ID is not specified in "cfg".
*/
- Status initialize(const BSONObj& cfg, bool usePV1ByDefault = false);
+ Status initialize(const BSONObj& cfg,
+ bool usePV1ByDefault = false,
+ OID defaultReplicaSetId = OID());
/**
* Same as the generic initialize() above except will default "configsvr" setting to the value
@@ -294,6 +297,22 @@ public:
}
/**
+ * Returns true if this configuration contains a valid replica set ID.
+ * This ID is set at creation and is used to disambiguate replica set configurations that may
+ * have the same replica set name (_id field) but meant for different replica set instances.
+ */
+ bool hasReplicaSetId() const {
+ return _replicaSetId.isSet();
+ }
+
+ /**
+ * Returns replica set ID.
+ */
+ OID getReplicaSetId() const {
+ return _replicaSetId;
+ }
+
+ /**
* Returns the duration to wait before running for election when this node (indicated by
* "memberIdx") sees that it has higher priority than the current primary.
*/
@@ -320,7 +339,14 @@ private:
*/
void _addInternalWriteConcernModes();
- Status _initialize(const BSONObj& cfg, bool forInitiate, bool usePV1ByDefault);
+ /**
+ * Sets replica set ID to 'defaultReplicaSetId' if forInitiate is false and 'cfg' does not
+ * contain an ID.
+ */
+ Status _initialize(const BSONObj& cfg,
+ bool forInitiate,
+ bool usePV1ByDefault,
+ OID defaultReplicaSetId);
bool _isInitialized = false;
long long _version = 1;
@@ -339,6 +365,7 @@ private:
StringMap<ReplicaSetTagPattern> _customWriteConcernModes;
long long _protocolVersion = 0;
bool _configServer = false;
+ OID _replicaSetId;
};
diff --git a/src/mongo/db/repl/replica_set_config_test.cpp b/src/mongo/db/repl/replica_set_config_test.cpp
index 4749a5d4168..a140967c562 100644
--- a/src/mongo/db/repl/replica_set_config_test.cpp
+++ b/src/mongo/db/repl/replica_set_config_test.cpp
@@ -954,7 +954,8 @@ bool operator==(const ReplicaSetConfig& a, const ReplicaSetConfig& b) {
a.isConfigServer() == b.isConfigServer() &&
a.getDefaultWriteConcern().wNumNodes == b.getDefaultWriteConcern().wNumNodes &&
a.getDefaultWriteConcern().wMode == b.getDefaultWriteConcern().wMode &&
- a.getProtocolVersion() == b.getProtocolVersion();
+ a.getProtocolVersion() == b.getProtocolVersion() &&
+ a.getReplicaSetId() == b.getReplicaSetId();
}
TEST(ReplicaSetConfig, toBSONRoundTripAbility) {
@@ -966,7 +967,8 @@ TEST(ReplicaSetConfig, toBSONRoundTripAbility) {
<< BSON_ARRAY(BSON("_id" << 0 << "host"
<< "localhost:12345")) << "settings"
<< BSON("heartbeatIntervalMillis"
- << 5000 << "heartbeatTimeoutSecs" << 20))));
+ << 5000 << "heartbeatTimeoutSecs" << 20
+ << "replicaSetId" << OID::gen()))));
ASSERT_OK(configB.initialize(configA.toBSON()));
ASSERT_TRUE(configA == configB);
}
@@ -1317,6 +1319,92 @@ TEST(ReplicaSetConfig, ConfirmDefaultValuesOfAndAbilityToSetWriteConcernMajority
ASSERT_FALSE(config.getWriteConcernMajorityShouldJournal());
ASSERT_TRUE(config.toBSON().hasField("writeConcernMajorityJournalDefault"));
}
+
+TEST(ReplicaSetConfig, ReplSetId) {
+ // Uninitialized configuration has no ID.
+ ASSERT_FALSE(ReplicaSetConfig().hasReplicaSetId());
+
+ // Cannot provide replica set ID in configuration document when initialized from
+ // replSetInitiate.
+ auto status =
+ ReplicaSetConfig().initializeForInitiate(BSON("_id"
+ << "rs0"
+ << "version" << 1 << "members"
+ << BSON_ARRAY(BSON("_id" << 0 << "host"
+ << "localhost:12345"
+ << "priority" << 1))
+ << "settings"
+ << BSON("replicaSetId" << OID::gen())));
+ ASSERT_EQUALS(ErrorCodes::InvalidReplicaSetConfig, status);
+ ASSERT_STRING_CONTAINS(status.reason(),
+ "replica set configuration cannot contain 'replicaSetId' field when "
+ "called from replSetInitiate");
+
+
+ // Configuration created by replSetInitiate should generate replica set ID.
+ ReplicaSetConfig configInitiate;
+ ASSERT_OK(
+ configInitiate.initializeForInitiate(BSON("_id"
+ << "rs0"
+ << "version" << 1 << "members"
+ << BSON_ARRAY(BSON("_id" << 0 << "host"
+ << "localhost:12345"
+ << "priority" << 1)))));
+ ASSERT_OK(configInitiate.validate());
+ ASSERT_TRUE(configInitiate.hasReplicaSetId());
+ OID replicaSetId = configInitiate.getReplicaSetId();
+
+ // Configuration initialized from local database can contain ID.
+ ReplicaSetConfig configLocal;
+ ASSERT_OK(configLocal.initialize(BSON("_id"
+ << "rs0"
+ << "version" << 1 << "members"
+ << BSON_ARRAY(BSON("_id" << 0 << "host"
+ << "localhost:12345"
+ << "priority" << 1))
+ << "settings" << BSON("replicaSetId" << replicaSetId))));
+ ASSERT_OK(configLocal.validate());
+ ASSERT_TRUE(configLocal.hasReplicaSetId());
+ ASSERT_EQUALS(replicaSetId, configLocal.getReplicaSetId());
+
+ // When reconfiguring, we can provide an default ID if the configuration does not contain one.
+ OID defaultReplicaSetId = OID::gen();
+ ASSERT_OK(configLocal.initialize(BSON("_id"
+ << "rs0"
+ << "version" << 1 << "members"
+ << BSON_ARRAY(BSON("_id" << 0 << "host"
+ << "localhost:12345"
+ << "priority" << 1))),
+ true,
+ defaultReplicaSetId));
+ ASSERT_OK(configLocal.validate());
+ ASSERT_TRUE(configLocal.hasReplicaSetId());
+ ASSERT_EQUALS(defaultReplicaSetId, configLocal.getReplicaSetId());
+
+ // 'replicaSetId' field cannot be null.
+ status = configLocal.initialize(BSON("_id"
+ << "rs0"
+ << "version" << 1 << "members"
+ << BSON_ARRAY(BSON("_id" << 0 << "host"
+ << "localhost:12345"
+ << "priority" << 1)) << "settings"
+ << BSON("replicaSetId" << OID())));
+ ASSERT_EQUALS(ErrorCodes::BadValue, status);
+ ASSERT_STRING_CONTAINS(status.reason(), "replicaSetId field value cannot be null");
+
+ // 'replicaSetId' field must be an OID.
+ status = configLocal.initialize(BSON("_id"
+ << "rs0"
+ << "version" << 1 << "members"
+ << BSON_ARRAY(BSON("_id" << 0 << "host"
+ << "localhost:12345"
+ << "priority" << 1)) << "settings"
+ << BSON("replicaSetId" << 12345)));
+ ASSERT_EQUALS(ErrorCodes::TypeMismatch, status);
+ ASSERT_STRING_CONTAINS(status.reason(),
+ "\"replicaSetId\" had the wrong type. Expected OID, found NumberInt32");
+}
+
} // namespace
} // namespace repl
} // namespace mongo
diff --git a/src/mongo/db/repl/topology_coordinator_impl.cpp b/src/mongo/db/repl/topology_coordinator_impl.cpp
index dd0ce2f766f..a735e702b67 100644
--- a/src/mongo/db/repl/topology_coordinator_impl.cpp
+++ b/src/mongo/db/repl/topology_coordinator_impl.cpp
@@ -2363,6 +2363,7 @@ void TopologyCoordinatorImpl::prepareReplResponseMetadata(rpc::ReplSetMetadata*
lastCommittedOpTime,
lastVisibleOpTime,
_rsConfig.getConfigVersion(),
+ _rsConfig.getReplicaSetId(),
_currentPrimaryIndex,
_rsConfig.findMemberIndexByHostAndPort(getSyncSourceAddress()));
}
diff --git a/src/mongo/rpc/metadata/repl_set_metadata.cpp b/src/mongo/rpc/metadata/repl_set_metadata.cpp
index 5e9a1e89f77..da9fc744469 100644
--- a/src/mongo/rpc/metadata/repl_set_metadata.cpp
+++ b/src/mongo/rpc/metadata/repl_set_metadata.cpp
@@ -45,6 +45,7 @@ namespace {
const char kLastOpCommittedFieldName[] = "lastOpCommitted";
const char kLastOpVisibleFieldName[] = "lastOpVisible";
const char kConfigVersionFieldName[] = "configVersion";
+const char kReplicaSetIdFieldName[] = "replicaSetId";
const char kPrimaryIndexFieldName[] = "primaryIndex";
const char kSyncSourceIndexFieldName[] = "syncSourceIndex";
const char kTermFieldName[] = "term";
@@ -59,12 +60,14 @@ ReplSetMetadata::ReplSetMetadata(long long term,
OpTime committedOpTime,
OpTime visibleOpTime,
long long configVersion,
+ OID id,
int currentPrimaryIndex,
int currentSyncSourceIndex)
: _lastOpCommitted(std::move(committedOpTime)),
_lastOpVisible(std::move(visibleOpTime)),
_currentTerm(term),
_configVersion(configVersion),
+ _replicaSetId(id),
_currentPrimaryIndex(currentPrimaryIndex),
_currentSyncSourceIndex(currentSyncSourceIndex) {}
@@ -82,6 +85,11 @@ StatusWith<ReplSetMetadata> ReplSetMetadata::readFromMetadata(const BSONObj& met
if (!status.isOK())
return status;
+ OID id;
+ status = bsonExtractOIDFieldWithDefault(replMetadataObj, kReplicaSetIdFieldName, OID(), &id);
+ if (!status.isOK())
+ return status;
+
long long primaryIndex;
status = bsonExtractIntegerField(replMetadataObj, kPrimaryIndexFieldName, &primaryIndex);
if (!status.isOK())
@@ -108,7 +116,7 @@ StatusWith<ReplSetMetadata> ReplSetMetadata::readFromMetadata(const BSONObj& met
return status;
return ReplSetMetadata(
- term, lastOpCommitted, lastOpVisible, configVersion, primaryIndex, syncSourceIndex);
+ term, lastOpCommitted, lastOpVisible, configVersion, id, primaryIndex, syncSourceIndex);
}
Status ReplSetMetadata::writeToMetadata(BSONObjBuilder* builder) const {
@@ -117,6 +125,7 @@ Status ReplSetMetadata::writeToMetadata(BSONObjBuilder* builder) const {
_lastOpCommitted.append(&replMetadataBuilder, kLastOpCommittedFieldName);
_lastOpVisible.append(&replMetadataBuilder, kLastOpVisibleFieldName);
replMetadataBuilder.append(kConfigVersionFieldName, _configVersion);
+ replMetadataBuilder.append(kReplicaSetIdFieldName, _replicaSetId);
replMetadataBuilder.append(kPrimaryIndexFieldName, _currentPrimaryIndex);
replMetadataBuilder.append(kSyncSourceIndexFieldName, _currentSyncSourceIndex);
replMetadataBuilder.doneFast();
diff --git a/src/mongo/rpc/metadata/repl_set_metadata.h b/src/mongo/rpc/metadata/repl_set_metadata.h
index 3e80afc1f9b..24022063a04 100644
--- a/src/mongo/rpc/metadata/repl_set_metadata.h
+++ b/src/mongo/rpc/metadata/repl_set_metadata.h
@@ -28,6 +28,7 @@
#pragma once
+#include "mongo/bson/oid.h"
#include "mongo/db/repl/optime.h"
namespace mongo {
@@ -55,6 +56,7 @@ public:
repl::OpTime committedOpTime,
repl::OpTime visibleOpTime,
long long configVersion,
+ OID replicaSetId,
int currentPrimaryIndex,
int currentSyncSourceIndex);
@@ -65,6 +67,7 @@ public:
* lastOpCommitted: {ts: Timestamp(0, 0), term: 0},
* lastOpVisible: {ts: Timestamp(0, 0), term: 0},
* configVersion: 0,
+ * replicaSetId: ObjectId("..."), // Only present in certain versions and above.
* primaryIndex: 0,
* syncSourceIndex: 0
* }
@@ -94,6 +97,20 @@ public:
}
/**
+ * Returns true if the sender has a replica set ID.
+ */
+ bool hasReplicaSetId() const {
+ return _replicaSetId.isSet();
+ }
+
+ /**
+ * Returns the replica set ID of the sender.
+ */
+ OID getReplicaSetId() const {
+ return _replicaSetId;
+ }
+
+ /**
* Returns the index of the current primary from the perspective of the sender.
* Returns kNoPrimary if there is no primary.
*/
@@ -121,6 +138,7 @@ private:
repl::OpTime _lastOpVisible = repl::OpTime(Timestamp(0, 0), repl::OpTime::kUninitializedTerm);
long long _currentTerm = -1;
long long _configVersion = -1;
+ OID _replicaSetId;
int _currentPrimaryIndex = kNoPrimary;
int _currentSyncSourceIndex = -1;
};
diff --git a/src/mongo/rpc/metadata/repl_set_metadata_test.cpp b/src/mongo/rpc/metadata/repl_set_metadata_test.cpp
index 68d073be8cb..58b31f63517 100644
--- a/src/mongo/rpc/metadata/repl_set_metadata_test.cpp
+++ b/src/mongo/rpc/metadata/repl_set_metadata_test.cpp
@@ -36,23 +36,30 @@ namespace {
using repl::OpTime;
+TEST(ReplResponseMetadataTest, ReplicaSetIdNotSet) {
+ ASSERT_FALSE(ReplSetMetadata(3, OpTime(), OpTime(), 6, OID(), 12, -1).hasReplicaSetId());
+}
+
TEST(ReplResponseMetadataTest, Roundtrip) {
OpTime opTime(Timestamp(1234, 100), 5);
OpTime opTime2(Timestamp(7777, 100), 6);
- ReplSetMetadata metadata(3, opTime, opTime2, 6, 12, -1);
+ ReplSetMetadata metadata(3, opTime, opTime2, 6, OID::gen(), 12, -1);
ASSERT_EQ(opTime, metadata.getLastOpCommitted());
ASSERT_EQ(opTime2, metadata.getLastOpVisible());
+ ASSERT_TRUE(metadata.hasReplicaSetId());
BSONObjBuilder builder;
metadata.writeToMetadata(&builder);
- BSONObj expectedObj(BSON(
- kReplSetMetadataFieldName << BSON(
- "term" << 3 << "lastOpCommitted" << BSON("ts" << opTime.getTimestamp() << "t"
- << opTime.getTerm()) << "lastOpVisible"
- << BSON("ts" << opTime2.getTimestamp() << "t" << opTime2.getTerm())
- << "configVersion" << 6 << "primaryIndex" << 12 << "syncSourceIndex" << -1)));
+ BSONObj expectedObj(
+ BSON(kReplSetMetadataFieldName
+ << BSON("term" << 3 << "lastOpCommitted"
+ << BSON("ts" << opTime.getTimestamp() << "t" << opTime.getTerm())
+ << "lastOpVisible"
+ << BSON("ts" << opTime2.getTimestamp() << "t" << opTime2.getTerm())
+ << "configVersion" << 6 << "replicaSetId" << metadata.getReplicaSetId()
+ << "primaryIndex" << 12 << "syncSourceIndex" << -1)));
BSONObj serializedObj = builder.obj();
ASSERT_EQ(expectedObj, serializedObj);
@@ -63,6 +70,8 @@ TEST(ReplResponseMetadataTest, Roundtrip) {
const auto& clonedMetadata = cloneStatus.getValue();
ASSERT_EQ(opTime, clonedMetadata.getLastOpCommitted());
ASSERT_EQ(opTime2, clonedMetadata.getLastOpVisible());
+ ASSERT_EQ(metadata.getConfigVersion(), clonedMetadata.getConfigVersion());
+ ASSERT_EQ(metadata.getReplicaSetId(), clonedMetadata.getReplicaSetId());
BSONObjBuilder clonedBuilder;
clonedMetadata.writeToMetadata(&clonedBuilder);
diff --git a/src/mongo/s/catalog/replset/catalog_manager_replica_set_test.cpp b/src/mongo/s/catalog/replset/catalog_manager_replica_set_test.cpp
index 1dfea9a3b33..b0ef51e1615 100644
--- a/src/mongo/s/catalog/replset/catalog_manager_replica_set_test.cpp
+++ b/src/mongo/s/catalog/replset/catalog_manager_replica_set_test.cpp
@@ -117,7 +117,7 @@ TEST_F(CatalogManagerReplSetTest, GetCollectionExisting) {
checkReadConcern(request.cmdObj, Timestamp(0, 0), repl::OpTime::kUninitializedTerm);
- ReplSetMetadata metadata(10, OpTime(), newOpTime, 100, 30, -1);
+ ReplSetMetadata metadata(10, OpTime(), newOpTime, 100, OID(), 30, -1);
BSONObjBuilder builder;
metadata.writeToMetadata(&builder);
@@ -179,7 +179,7 @@ TEST_F(CatalogManagerReplSetTest, GetDatabaseExisting) {
checkReadConcern(request.cmdObj, Timestamp(0, 0), repl::OpTime::kUninitializedTerm);
- ReplSetMetadata metadata(10, OpTime(), newOpTime, 100, 30, -1);
+ ReplSetMetadata metadata(10, OpTime(), newOpTime, 100, OID(), 30, -1);
BSONObjBuilder builder;
metadata.writeToMetadata(&builder);
@@ -505,7 +505,7 @@ TEST_F(CatalogManagerReplSetTest, GetChunksForNSWithSortAndLimit) {
checkReadConcern(request.cmdObj, Timestamp(0, 0), repl::OpTime::kUninitializedTerm);
- ReplSetMetadata metadata(10, OpTime(), newOpTime, 100, 30, -1);
+ ReplSetMetadata metadata(10, OpTime(), newOpTime, 100, OID(), 30, -1);
BSONObjBuilder builder;
metadata.writeToMetadata(&builder);
@@ -1017,7 +1017,7 @@ TEST_F(CatalogManagerReplSetTest, GetCollectionsValidResultsNoDb) {
checkReadConcern(request.cmdObj, Timestamp(0, 0), repl::OpTime::kUninitializedTerm);
- ReplSetMetadata metadata(10, OpTime(), newOpTime, 100, 30, -1);
+ ReplSetMetadata metadata(10, OpTime(), newOpTime, 100, OID(), 30, -1);
BSONObjBuilder builder;
metadata.writeToMetadata(&builder);
@@ -2297,7 +2297,7 @@ TEST_F(CatalogManagerReplSetTest, BasicReadAfterOpTime) {
ASSERT_EQ(string("dummy"), request.cmdObj.firstElementFieldName());
checkReadConcern(request.cmdObj, lastOpTime.getTimestamp(), lastOpTime.getTerm());
- ReplSetMetadata metadata(10, repl::OpTime(), newOpTime, 100, 30, -1);
+ ReplSetMetadata metadata(10, repl::OpTime(), newOpTime, 100, OID(), 30, -1);
BSONObjBuilder builder;
metadata.writeToMetadata(&builder);
@@ -2332,7 +2332,7 @@ TEST_F(CatalogManagerReplSetTest, ReadAfterOpTimeShouldNotGoBack) {
ASSERT_EQ(string("dummy"), request.cmdObj.firstElementFieldName());
checkReadConcern(request.cmdObj, highestOpTime.getTimestamp(), highestOpTime.getTerm());
- ReplSetMetadata metadata(10, repl::OpTime(), newOpTime, 100, 30, -1);
+ ReplSetMetadata metadata(10, repl::OpTime(), newOpTime, 100, OID(), 30, -1);
BSONObjBuilder builder;
metadata.writeToMetadata(&builder);
@@ -2360,7 +2360,7 @@ TEST_F(CatalogManagerReplSetTest, ReadAfterOpTimeShouldNotGoBack) {
ASSERT_EQ(string("dummy"), request.cmdObj.firstElementFieldName());
checkReadConcern(request.cmdObj, highestOpTime.getTimestamp(), highestOpTime.getTerm());
- ReplSetMetadata metadata(10, repl::OpTime(), oldOpTime, 100, 30, -1);
+ ReplSetMetadata metadata(10, repl::OpTime(), oldOpTime, 100, OID(), 30, -1);
BSONObjBuilder builder;
metadata.writeToMetadata(&builder);
@@ -2384,7 +2384,7 @@ TEST_F(CatalogManagerReplSetTest, ReadAfterOpTimeShouldNotGoBack) {
ASSERT_EQ(string("dummy"), request.cmdObj.firstElementFieldName());
checkReadConcern(request.cmdObj, highestOpTime.getTimestamp(), highestOpTime.getTerm());
- ReplSetMetadata metadata(10, repl::OpTime(), oldOpTime, 100, 30, -1);
+ ReplSetMetadata metadata(10, repl::OpTime(), oldOpTime, 100, OID(), 30, -1);
BSONObjBuilder builder;
metadata.writeToMetadata(&builder);
@@ -2409,7 +2409,7 @@ TEST_F(CatalogManagerReplSetTest, ReadAfterOpTimeFindThenCmd) {
ASSERT_EQUALS(kReplSecondaryOkMetadata, request.metadata);
checkReadConcern(request.cmdObj, highestOpTime.getTimestamp(), highestOpTime.getTerm());
- ReplSetMetadata metadata(10, repl::OpTime(), newOpTime, 100, 30, -1);
+ ReplSetMetadata metadata(10, repl::OpTime(), newOpTime, 100, OID(), 30, -1);
BSONObjBuilder builder;
metadata.writeToMetadata(&builder);
@@ -2468,7 +2468,7 @@ TEST_F(CatalogManagerReplSetTest, ReadAfterOpTimeCmdThenFind) {
ASSERT_EQ(string("dummy"), request.cmdObj.firstElementFieldName());
checkReadConcern(request.cmdObj, highestOpTime.getTimestamp(), highestOpTime.getTerm());
- ReplSetMetadata metadata(10, repl::OpTime(), newOpTime, 100, 30, -1);
+ ReplSetMetadata metadata(10, repl::OpTime(), newOpTime, 100, OID(), 30, -1);
BSONObjBuilder builder;
metadata.writeToMetadata(&builder);