summaryrefslogtreecommitdiff
path: root/src/mongo/db/cursor_manager.cpp
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2018-02-04 09:01:03 -0500
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2018-02-14 17:12:44 -0500
commite5e8dde676b585f5620608e95e93b9da295890c5 (patch)
tree15682c345e91499c4a4818214e881d3ffab00d08 /src/mongo/db/cursor_manager.cpp
parent4d18e6908acc852c77e97df0bf169c442a9bb306 (diff)
downloadmongo-e5e8dde676b585f5620608e95e93b9da295890c5.tar.gz
SERVER-32367 Clean up the AutoGet* suite of classes
* Get rid of AutoGetCollectionOrViewForReadCommand * Get rid of constructors accepting Lock::DBLock * Always check for shard version, unless the namespace represents a view
Diffstat (limited to 'src/mongo/db/cursor_manager.cpp')
-rw-r--r--src/mongo/db/cursor_manager.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mongo/db/cursor_manager.cpp b/src/mongo/db/cursor_manager.cpp
index 061a5a59cc5..418a1265b95 100644
--- a/src/mongo/db/cursor_manager.cpp
+++ b/src/mongo/db/cursor_manager.cpp
@@ -261,14 +261,14 @@ std::size_t GlobalCursorIdCache::timeoutCursors(OperationContext* opCtx, Date_t
// For each collection, time out its cursors under the collection lock (to prevent the
// collection from going away during the erase).
- for (unsigned i = 0; i < todo.size(); i++) {
- AutoGetCollectionOrViewForReadCommand ctx(opCtx, NamespaceString(todo[i]));
+ for (const auto& nsTodo : todo) {
+ AutoGetCollectionForReadCommand ctx(opCtx, nsTodo);
if (!ctx.getDb()) {
continue;
}
- Collection* collection = ctx.getCollection();
- if (collection == NULL) {
+ Collection* const collection = ctx.getCollection();
+ if (!collection) {
continue;
}
@@ -277,6 +277,7 @@ std::size_t GlobalCursorIdCache::timeoutCursors(OperationContext* opCtx, Date_t
return totalTimedOut;
}
+
} // namespace
template <typename Visitor>