summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/repl')
-rw-r--r--src/mongo/db/repl/idempotency_test_fixture.cpp4
-rw-r--r--src/mongo/db/repl/isself.cpp12
-rw-r--r--src/mongo/db/repl/oplog.cpp6
-rw-r--r--src/mongo/db/repl/oplogreader.cpp2
-rw-r--r--src/mongo/db/repl/oplogreader.h4
-rw-r--r--src/mongo/db/repl/repl_set_commands.cpp4
-rw-r--r--src/mongo/db/repl/repl_set_config.cpp4
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl.cpp2
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl_test.cpp13
-rw-r--r--src/mongo/db/repl/replication_info.cpp2
-rw-r--r--src/mongo/db/repl/rollback_source_impl.cpp6
-rw-r--r--src/mongo/db/repl/rs_rollback.cpp6
-rw-r--r--src/mongo/db/repl/topology_coordinator.cpp2
-rw-r--r--src/mongo/db/repl/vote_requester_test.cpp2
14 files changed, 36 insertions, 33 deletions
diff --git a/src/mongo/db/repl/idempotency_test_fixture.cpp b/src/mongo/db/repl/idempotency_test_fixture.cpp
index 63c769e58be..6a5fe64ba4a 100644
--- a/src/mongo/db/repl/idempotency_test_fixture.cpp
+++ b/src/mongo/db/repl/idempotency_test_fixture.cpp
@@ -550,13 +550,13 @@ std::string IdempotencyTest::computeDataHash(Collection* collection) {
PlanExecutor::NO_YIELD,
InternalPlanner::FORWARD,
InternalPlanner::IXSCAN_FETCH);
- ASSERT(NULL != exec.get());
+ ASSERT(nullptr != exec.get());
md5_state_t st;
md5_init(&st);
PlanExecutor::ExecState state;
BSONObj obj;
- while (PlanExecutor::ADVANCED == (state = exec->getNext(&obj, NULL))) {
+ while (PlanExecutor::ADVANCED == (state = exec->getNext(&obj, nullptr))) {
obj = this->canonicalizeDocumentForDataHash(obj);
md5_append(&st, (const md5_byte_t*)obj.objdata(), obj.objsize());
}
diff --git a/src/mongo/db/repl/isself.cpp b/src/mongo/db/repl/isself.cpp
index a78298933fd..f864cbb13de 100644
--- a/src/mongo/db/repl/isself.cpp
+++ b/src/mongo/db/repl/isself.cpp
@@ -107,7 +107,7 @@ std::string stringifyError(int code) {
std::vector<std::string> getAddrsForHost(const std::string& iporhost,
const int port,
const bool ipv6enabled) {
- addrinfo* addrs = NULL;
+ addrinfo* addrs = nullptr;
addrinfo hints = {0};
hints.ai_socktype = SOCK_STREAM;
hints.ai_family = (ipv6enabled ? AF_UNSPEC : AF_INET);
@@ -126,13 +126,13 @@ std::vector<std::string> getAddrsForHost(const std::string& iporhost,
ON_BLOCK_EXIT([&] { freeaddrinfo(addrs); });
- for (addrinfo* addr = addrs; addr != NULL; addr = addr->ai_next) {
+ for (addrinfo* addr = addrs; addr != nullptr; addr = addr->ai_next) {
int family = addr->ai_family;
char host[NI_MAXHOST];
if (family == AF_INET || family == AF_INET6) {
err = getnameinfo(
- addr->ai_addr, addr->ai_addrlen, host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST);
+ addr->ai_addr, addr->ai_addrlen, host, NI_MAXHOST, nullptr, 0, NI_NUMERICHOST);
if (err) {
warning() << "getnameinfo() failed: " << stringifyError(err) << std::endl;
continue;
@@ -235,8 +235,8 @@ std::vector<std::string> getBoundAddrs(const bool ipv6enabled) {
ON_BLOCK_EXIT([&] { freeifaddrs(addrs); });
// based on example code from linux getifaddrs manpage
- for (ifaddrs* addr = addrs; addr != NULL; addr = addr->ifa_next) {
- if (addr->ifa_addr == NULL)
+ for (ifaddrs* addr = addrs; addr != nullptr; addr = addr->ifa_next) {
+ if (addr->ifa_addr == nullptr)
continue;
int family = addr->ifa_addr->sa_family;
char host[NI_MAXHOST];
@@ -247,7 +247,7 @@ std::vector<std::string> getBoundAddrs(const bool ipv6enabled) {
(family == AF_INET ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6)),
host,
NI_MAXHOST,
- NULL,
+ nullptr,
0,
NI_NUMERICHOST);
if (err) {
diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp
index e628976f83c..0f1d20a7ef7 100644
--- a/src/mongo/db/repl/oplog.cpp
+++ b/src/mongo/db/repl/oplog.cpp
@@ -608,7 +608,7 @@ std::vector<OpTime> logInsertOps(OperationContext* opCtx,
nss,
uuid,
begin[i].doc,
- NULL,
+ nullptr,
fromMigrate,
insertStatementOplogSlot,
wallClockTime,
@@ -1683,7 +1683,7 @@ Status applyOperation_inlock(OperationContext* opCtx,
// such as an updateCriteria of the form
// { _id:..., { x : {$size:...} }
// thus this is not ideal.
- if (collection == NULL ||
+ if (collection == nullptr ||
(indexCatalog->haveIdIndex(opCtx) &&
Helpers::findById(opCtx, collection, updateCriteria).isNull()) ||
// capped collections won't have an _id index
@@ -1980,7 +1980,7 @@ void initTimestampFromOplog(OperationContext* opCtx, const NamespaceString& oplo
DBDirectClient c(opCtx);
static const BSONObj reverseNaturalObj = BSON("$natural" << -1);
BSONObj lastOp =
- c.findOne(oplogNss.ns(), Query().sort(reverseNaturalObj), NULL, QueryOption_SlaveOk);
+ c.findOne(oplogNss.ns(), Query().sort(reverseNaturalObj), nullptr, QueryOption_SlaveOk);
if (!lastOp.isEmpty()) {
LOG(1) << "replSet setting last Timestamp";
diff --git a/src/mongo/db/repl/oplogreader.cpp b/src/mongo/db/repl/oplogreader.cpp
index 5be1c01ecfc..17811adcf9a 100644
--- a/src/mongo/db/repl/oplogreader.cpp
+++ b/src/mongo/db/repl/oplogreader.cpp
@@ -75,7 +75,7 @@ OplogReader::OplogReader() {
}
bool OplogReader::connect(const HostAndPort& host) {
- if (conn() == NULL || _host != host) {
+ if (conn() == nullptr || _host != host) {
resetConnection();
_conn = std::shared_ptr<DBClientConnection>(
new DBClientConnection(false, durationCount<Seconds>(kSocketTimeout)));
diff --git a/src/mongo/db/repl/oplogreader.h b/src/mongo/db/repl/oplogreader.h
index 10abc580087..dca256bf871 100644
--- a/src/mongo/db/repl/oplogreader.h
+++ b/src/mongo/db/repl/oplogreader.h
@@ -73,7 +73,7 @@ public:
return _conn.get();
}
BSONObj findOne(const char* ns, const Query& q) {
- return conn()->findOne(ns, q, 0, QueryOption_SlaveOk);
+ return conn()->findOne(ns, q, nullptr, QueryOption_SlaveOk);
}
BSONObj findOneByUUID(const std::string& db, UUID uuid, const BSONObj& filter) {
// Note that the findOneByUUID() function of DBClient passes SlaveOK to the client.
@@ -91,7 +91,7 @@ public:
void tailCheck();
bool haveCursor() {
- return cursor.get() != 0;
+ return cursor.get() != nullptr;
}
void tailingQuery(const char* ns, const BSONObj& query);
diff --git a/src/mongo/db/repl/repl_set_commands.cpp b/src/mongo/db/repl/repl_set_commands.cpp
index a38d510fd5a..c7b3c3ec3d2 100644
--- a/src/mongo/db/repl/repl_set_commands.cpp
+++ b/src/mongo/db/repl/repl_set_commands.cpp
@@ -248,14 +248,14 @@ void parseReplSetSeedList(ReplicationCoordinatorExternalState* externalState,
*setname = p;
}
- if (slash == 0) {
+ if (slash == nullptr) {
return;
}
p = slash + 1;
while (1) {
const char* comma = strchr(p, ',');
- if (comma == 0) {
+ if (comma == nullptr) {
comma = strchr(p, 0);
}
if (p == comma) {
diff --git a/src/mongo/db/repl/repl_set_config.cpp b/src/mongo/db/repl/repl_set_config.cpp
index a3f27decf09..371ec2b7e87 100644
--- a/src/mongo/db/repl/repl_set_config.cpp
+++ b/src/mongo/db/repl/repl_set_config.cpp
@@ -742,7 +742,7 @@ const MemberConfig* ReplSetConfig::findMemberByID(int id) const {
return &(*it);
}
}
- return NULL;
+ return nullptr;
}
int ReplSetConfig::findMemberIndexByHostAndPort(const HostAndPort& hap) const {
@@ -770,7 +770,7 @@ int ReplSetConfig::findMemberIndexByConfigId(long long configId) const {
const MemberConfig* ReplSetConfig::findMemberByHostAndPort(const HostAndPort& hap) const {
int idx = findMemberIndexByHostAndPort(hap);
- return idx != -1 ? &getMemberAt(idx) : NULL;
+ return idx != -1 ? &getMemberAt(idx) : nullptr;
}
Milliseconds ReplSetConfig::getHeartbeatInterval() const {
diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp
index b963d5c9849..f97ebb90f04 100644
--- a/src/mongo/db/repl/replication_coordinator_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl.cpp
@@ -2359,7 +2359,7 @@ Status ReplicationCoordinatorImpl::processReplSetGetStatus(
_topCoord->prepareStatusResponse(
TopologyCoordinator::ReplSetStatusArgs{
_replExecutor->now(),
- static_cast<unsigned>(time(0) - serverGlobalParams.started),
+ static_cast<unsigned>(time(nullptr) - serverGlobalParams.started),
_getCurrentCommittedSnapshotOpTimeAndWallTime_inlock(),
initialSyncProgress,
_storage->getLastStableCheckpointTimestampDeprecated(_service),
diff --git a/src/mongo/db/repl/replication_coordinator_impl_test.cpp b/src/mongo/db/repl/replication_coordinator_impl_test.cpp
index 448504218b4..ee096286774 100644
--- a/src/mongo/db/repl/replication_coordinator_impl_test.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl_test.cpp
@@ -3364,7 +3364,7 @@ TEST_F(ReplCoordTest, DoNotProcessSelfWhenUpdatePositionContainsInfoAboutSelf) {
<< UpdatePositionArgs::kAppliedWallTimeFieldName
<< Date_t() + Seconds(time2.getSecs()))))));
- ASSERT_OK(getReplCoord()->processReplSetUpdatePosition(args, 0));
+ ASSERT_OK(getReplCoord()->processReplSetUpdatePosition(args, nullptr));
ASSERT_EQUALS(ErrorCodes::WriteConcernFailed,
getReplCoord()->awaitReplication(opCtx.get(), time2, writeConcern).status);
}
@@ -3488,7 +3488,8 @@ TEST_F(ReplCoordTest, DoNotProcessUpdatePositionOfMembersWhoseIdsAreNotInTheConf
auto opCtx = makeOperationContext();
- ASSERT_EQUALS(ErrorCodes::NodeNotFound, getReplCoord()->processReplSetUpdatePosition(args, 0));
+ ASSERT_EQUALS(ErrorCodes::NodeNotFound,
+ getReplCoord()->processReplSetUpdatePosition(args, nullptr));
ASSERT_EQUALS(ErrorCodes::WriteConcernFailed,
getReplCoord()->awaitReplication(opCtx.get(), time2, writeConcern).status);
}
@@ -3565,7 +3566,7 @@ TEST_F(ReplCoordTest,
auto opCtx = makeOperationContext();
- ASSERT_OK(getReplCoord()->processReplSetUpdatePosition(args, 0));
+ ASSERT_OK(getReplCoord()->processReplSetUpdatePosition(args, nullptr));
ASSERT_OK(getReplCoord()->awaitReplication(opCtx.get(), time2, writeConcern).status);
writeConcern.wNumNodes = 3;
@@ -6122,7 +6123,7 @@ TEST_F(ReplCoordTest, StepDownWhenHandleLivenessTimeoutMarksAMajorityOfVotingNod
<< UpdatePositionArgs::kDurableWallTimeFieldName
<< Date_t() + Seconds(startingOpTime.getSecs()))))));
- ASSERT_OK(getReplCoord()->processReplSetUpdatePosition(args, 0));
+ ASSERT_OK(getReplCoord()->processReplSetUpdatePosition(args, nullptr));
// Become PRIMARY.
simulateSuccessfulV1Election();
@@ -6161,7 +6162,7 @@ TEST_F(ReplCoordTest, StepDownWhenHandleLivenessTimeoutMarksAMajorityOfVotingNod
const Date_t startDate = getNet()->now();
getNet()->enterNetwork();
getNet()->runUntil(startDate + Milliseconds(100));
- ASSERT_OK(getReplCoord()->processReplSetUpdatePosition(args1, 0));
+ ASSERT_OK(getReplCoord()->processReplSetUpdatePosition(args1, nullptr));
// Confirm that the node remains PRIMARY after the other two nodes are marked DOWN.
getNet()->runUntil(startDate + Milliseconds(2080));
@@ -6212,7 +6213,7 @@ TEST_F(ReplCoordTest, StepDownWhenHandleLivenessTimeoutMarksAMajorityOfVotingNod
<< startingOpTime.toBSON()
<< UpdatePositionArgs::kAppliedWallTimeFieldName
<< Date_t() + Seconds(startingOpTime.getSecs()))))));
- ASSERT_OK(getReplCoord()->processReplSetUpdatePosition(args2, 0));
+ ASSERT_OK(getReplCoord()->processReplSetUpdatePosition(args2, nullptr));
hbArgs.setSetName("mySet");
hbArgs.setConfigVersion(2);
diff --git a/src/mongo/db/repl/replication_info.cpp b/src/mongo/db/repl/replication_info.cpp
index e3f26e73513..701b6411d6a 100644
--- a/src/mongo/db/repl/replication_info.cpp
+++ b/src/mongo/db/repl/replication_info.cpp
@@ -101,7 +101,7 @@ void appendReplicationInfo(OperationContext* opCtx, BSONObjBuilder& result, int
opCtx, localSources.ns(), ctx.getCollection(), PlanExecutor::NO_YIELD);
BSONObj obj;
PlanExecutor::ExecState state;
- while (PlanExecutor::ADVANCED == (state = exec->getNext(&obj, NULL))) {
+ while (PlanExecutor::ADVANCED == (state = exec->getNext(&obj, nullptr))) {
src.push_back(obj.getOwned());
}
diff --git a/src/mongo/db/repl/rollback_source_impl.cpp b/src/mongo/db/repl/rollback_source_impl.cpp
index 26a9240bbc8..aecd404f865 100644
--- a/src/mongo/db/repl/rollback_source_impl.cpp
+++ b/src/mongo/db/repl/rollback_source_impl.cpp
@@ -67,11 +67,13 @@ int RollbackSourceImpl::getRollbackId() const {
BSONObj RollbackSourceImpl::getLastOperation() const {
const Query query = Query().sort(BSON("$natural" << -1));
- return _getConnection()->findOne(_collectionName, query, 0, QueryOption_SlaveOk);
+ return _getConnection()->findOne(_collectionName, query, nullptr, QueryOption_SlaveOk);
}
BSONObj RollbackSourceImpl::findOne(const NamespaceString& nss, const BSONObj& filter) const {
- return _getConnection()->findOne(nss.toString(), filter, NULL, QueryOption_SlaveOk).getOwned();
+ return _getConnection()
+ ->findOne(nss.toString(), filter, nullptr, QueryOption_SlaveOk)
+ .getOwned();
}
std::pair<BSONObj, NamespaceString> RollbackSourceImpl::findOneByUUID(const std::string& db,
diff --git a/src/mongo/db/repl/rs_rollback.cpp b/src/mongo/db/repl/rs_rollback.cpp
index e2fc2bcdb23..26491c2728d 100644
--- a/src/mongo/db/repl/rs_rollback.cpp
+++ b/src/mongo/db/repl/rs_rollback.cpp
@@ -793,7 +793,7 @@ void dropCollection(OperationContext* opCtx,
opCtx, nss.toString(), collection, PlanExecutor::YIELD_AUTO);
BSONObj curObj;
PlanExecutor::ExecState execState;
- while (PlanExecutor::ADVANCED == (execState = exec->getNext(&curObj, NULL))) {
+ while (PlanExecutor::ADVANCED == (execState = exec->getNext(&curObj, nullptr))) {
auto status = removeSaver.goingToDelete(curObj);
if (!status.isOK()) {
severe() << "Rolling back createCollection on " << nss
@@ -1319,7 +1319,7 @@ void rollback_internal::syncFixUp(OperationContext* opCtx,
log() << "Deleting and updating documents to roll back insert, update and remove "
"operations";
unsigned deletes = 0, updates = 0;
- time_t lastProgressUpdate = time(0);
+ time_t lastProgressUpdate = time(nullptr);
time_t progressUpdateGap = 10;
for (const auto& nsAndGoodVersionsByDocID : goodVersions) {
@@ -1345,7 +1345,7 @@ void rollback_internal::syncFixUp(OperationContext* opCtx,
const auto& goodVersionsByDocID = nsAndGoodVersionsByDocID.second;
for (const auto& idAndDoc : goodVersionsByDocID) {
- time_t now = time(0);
+ time_t now = time(nullptr);
if (now - lastProgressUpdate > progressUpdateGap) {
log() << deletes << " delete and " << updates
<< " update operations processed out of " << goodVersions.size()
diff --git a/src/mongo/db/repl/topology_coordinator.cpp b/src/mongo/db/repl/topology_coordinator.cpp
index 7300fdc17cb..ffcf36c57be 100644
--- a/src/mongo/db/repl/topology_coordinator.cpp
+++ b/src/mongo/db/repl/topology_coordinator.cpp
@@ -1409,7 +1409,7 @@ void TopologyCoordinator::setCurrentPrimary_forTest(int primaryIndex,
const MemberConfig* TopologyCoordinator::_currentPrimaryMember() const {
if (_currentPrimaryIndex == -1)
- return NULL;
+ return nullptr;
return &(_rsConfig.getMemberAt(_currentPrimaryIndex));
}
diff --git a/src/mongo/db/repl/vote_requester_test.cpp b/src/mongo/db/repl/vote_requester_test.cpp
index 97e5736cd76..4fc8382bf4a 100644
--- a/src/mongo/db/repl/vote_requester_test.cpp
+++ b/src/mongo/db/repl/vote_requester_test.cpp
@@ -98,7 +98,7 @@ public:
}
virtual void tearDown() {
- _requester.reset(NULL);
+ _requester.reset(nullptr);
}
protected: