summaryrefslogtreecommitdiff
path: root/src/mongo/s/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/s/client')
-rw-r--r--src/mongo/s/client/parallel.cpp42
-rw-r--r--src/mongo/s/client/shard_connection.cpp12
-rw-r--r--src/mongo/s/client/shard_connection.h2
-rw-r--r--src/mongo/s/client/version_manager.cpp2
4 files changed, 30 insertions, 28 deletions
diff --git a/src/mongo/s/client/parallel.cpp b/src/mongo/s/client/parallel.cpp
index 7903b2c48e5..3320e4517b7 100644
--- a/src/mongo/s/client/parallel.cpp
+++ b/src/mongo/s/client/parallel.cpp
@@ -198,7 +198,7 @@ ParallelSortClusteredCursor::~ParallelSortClusteredCursor() {
}
delete[] _cursors;
- _cursors = 0;
+ _cursors = nullptr;
// Clear out our metadata after removing legacy cursor data
_cursorMap.clear();
@@ -224,11 +224,11 @@ void ParallelSortClusteredCursor::init(OperationContext* opCtx) {
void ParallelSortClusteredCursor::_finishCons() {
_numServers = _servers.size();
_lastFrom = 0;
- _cursors = 0;
+ _cursors = nullptr;
if (!_qSpec.isEmpty()) {
_needToSkip = _qSpec.ntoskip();
- _cursors = 0;
+ _cursors = nullptr;
_sortKey = _qSpec.sort();
_fields = _qSpec.fields();
}
@@ -552,8 +552,9 @@ void ParallelSortClusteredCursor::startInit(OperationContext* opCtx) {
isCommand() ? 1 : 0, // nToReturn (0 if query indicates multi)
0, // nToSkip
// Does this need to be a ptr?
- _qSpec.fields().isEmpty() ? 0 : _qSpec.fieldsData(), // fieldsToReturn
- _qSpec.options(), // options
+ _qSpec.fields().isEmpty() ? nullptr
+ : _qSpec.fieldsData(), // fieldsToReturn
+ _qSpec.options(), // options
// NtoReturn is weird.
// If zero, it means use default size, so we do that for all cursors
// If positive, it's the batch size (we don't want this cursor limiting
@@ -579,9 +580,10 @@ void ParallelSortClusteredCursor::startInit(OperationContext* opCtx) {
_qSpec.ntoreturn(), // nToReturn
_qSpec.ntoskip(), // nToSkip
// Does this need to be a ptr?
- _qSpec.fields().isEmpty() ? 0 : _qSpec.fieldsData(), // fieldsToReturn
- _qSpec.options(), // options
- 0)); // batchSize
+ _qSpec.fields().isEmpty() ? nullptr
+ : _qSpec.fieldsData(), // fieldsToReturn
+ _qSpec.options(), // options
+ 0)); // batchSize
}
}
@@ -1005,25 +1007,25 @@ void ParallelSortClusteredCursor::_oldInit(OperationContext* opCtx) {
new DBClientCursor(conns[i]->get(),
NamespaceString(_ns),
_query,
- 0, // nToReturn
- 0, // nToSkip
- _fields.isEmpty() ? 0 : &_fields, // fieldsToReturn
+ 0, // nToReturn
+ 0, // nToSkip
+ _fields.isEmpty() ? nullptr : &_fields, // fieldsToReturn
_options,
_batchSize == 0 ? 0 : _batchSize + _needToSkip // batchSize
),
- NULL);
+ nullptr);
try {
_cursors[i].get()->initLazy(!firstPass);
} catch (NetworkException& e) {
socketExs.push_back(e.what() + errLoc);
- _cursors[i].reset(NULL, NULL);
+ _cursors[i].reset(nullptr, nullptr);
conns[i]->done();
if (!returnPartial)
break;
} catch (std::exception& e) {
otherExs.push_back(e.what() + errLoc);
- _cursors[i].reset(NULL, NULL);
+ _cursors[i].reset(nullptr, nullptr);
conns[i]->done();
break;
}
@@ -1051,7 +1053,7 @@ void ParallelSortClusteredCursor::_oldInit(OperationContext* opCtx) {
if (!_cursors[i].get()->initLazyFinish(retry)) {
warning() << "invalid result from " << conns[i]->getHost()
<< (retry ? ", retrying" : "");
- _cursors[i].reset(NULL, NULL);
+ _cursors[i].reset(nullptr, nullptr);
if (!retry) {
socketExs.push_back(str::stream() << "error querying server: "
@@ -1071,17 +1073,17 @@ void ParallelSortClusteredCursor::_oldInit(OperationContext* opCtx) {
staleConfigExs.push_back(
(string) "stale config detected when receiving response for " + e.toString() +
errLoc);
- _cursors[i].reset(NULL, NULL);
+ _cursors[i].reset(nullptr, nullptr);
conns[i]->done();
continue;
} catch (NetworkException& e) {
socketExs.push_back(e.what() + errLoc);
- _cursors[i].reset(NULL, NULL);
+ _cursors[i].reset(nullptr, nullptr);
conns[i]->done();
continue;
} catch (std::exception& e) {
otherExs.push_back(e.what() + errLoc);
- _cursors[i].reset(NULL, NULL);
+ _cursors[i].reset(nullptr, nullptr);
conns[i]->done();
continue;
}
@@ -1100,12 +1102,12 @@ void ParallelSortClusteredCursor::_oldInit(OperationContext* opCtx) {
staleConfigExs.push_back((string) "stale config detected for " + e.toString() +
errLoc);
- _cursors[i].reset(NULL, NULL);
+ _cursors[i].reset(nullptr, nullptr);
conns[i]->done();
continue;
} catch (std::exception& e) {
otherExs.push_back(e.what() + errLoc);
- _cursors[i].reset(NULL, NULL);
+ _cursors[i].reset(nullptr, nullptr);
conns[i]->done();
continue;
}
diff --git a/src/mongo/s/client/shard_connection.cpp b/src/mongo/s/client/shard_connection.cpp
index e5698ef5f69..2cc44c44a1f 100644
--- a/src/mongo/s/client/shard_connection.cpp
+++ b/src/mongo/s/client/shard_connection.cpp
@@ -127,7 +127,7 @@ public:
std::unique_ptr<DBClientBase> c;
if (s->avail) {
c.reset(s->avail);
- s->avail = 0;
+ s->avail = nullptr;
// May throw an exception
shardConnectionPool.onHandedOut(c.get());
@@ -162,7 +162,7 @@ public:
release(addr, ss->avail);
}
- ss->avail = 0;
+ ss->avail = nullptr;
}
if (fromDestructor) {
@@ -181,7 +181,7 @@ public:
const bool isConnGood = shardConnectionPool.isConnectionGood(addr, conn);
- if (s->avail != NULL) {
+ if (s->avail != nullptr) {
warning() << "Detected additional sharded connection in the "
<< "thread local pool for " << addr;
@@ -193,7 +193,7 @@ public:
if (!isConnGood) {
delete s->avail;
- s->avail = NULL;
+ s->avail = nullptr;
}
// Let the internal pool handle the bad connection, this can also
@@ -268,7 +268,7 @@ public:
*/
void clearPool() {
for (HostMap::iterator iter = _hosts.begin(); iter != _hosts.end(); ++iter) {
- if (iter->second->avail != NULL) {
+ if (iter->second->avail != nullptr) {
delete iter->second->avail;
}
delete iter->second;
@@ -443,7 +443,7 @@ void ShardConnection::kill() {
delete _conn;
}
- _conn = 0;
+ _conn = nullptr;
_finishedInit = true;
}
}
diff --git a/src/mongo/s/client/shard_connection.h b/src/mongo/s/client/shard_connection.h
index 2b28aff0e18..c23c03964bb 100644
--- a/src/mongo/s/client/shard_connection.h
+++ b/src/mongo/s/client/shard_connection.h
@@ -110,7 +110,7 @@ public:
}
bool ok() const {
- return _conn != NULL;
+ return _conn != nullptr;
}
/** reports all thread local connections on this instance */
diff --git a/src/mongo/s/client/version_manager.cpp b/src/mongo/s/client/version_manager.cpp
index 75c235d6cc6..f1cdfbc5e6b 100644
--- a/src/mongo/s/client/version_manager.cpp
+++ b/src/mongo/s/client/version_manager.cpp
@@ -196,7 +196,7 @@ bool initShardVersionEmptyNS(OperationContext* opCtx, DBClientBase* conn_in) {
"",
Grid::get(opCtx)->shardRegistry()->getConfigServerConnectionString(),
ChunkVersion(),
- NULL,
+ nullptr,
true,
result);