summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog/collection_info_cache_impl.cpp
diff options
context:
space:
mode:
authorsamontea <merciers.merciers@gmail.com>2019-07-11 11:28:07 -0400
committersamontea <merciers.merciers@gmail.com>2019-07-12 11:53:57 -0400
commita8a8fabb17e9700aab633a67b24fe6147290bb92 (patch)
tree6c3f617f3afad7e2363af59607de3e56146dcc8c /src/mongo/db/catalog/collection_info_cache_impl.cpp
parenta4b8e4e0549ebfffebb545459d34ee4faa4f1521 (diff)
downloadmongo-a8a8fabb17e9700aab633a67b24fe6147290bb92.tar.gz
SERVER-40755 Expose statistics which indicate how many collection scans have executed
Diffstat (limited to 'src/mongo/db/catalog/collection_info_cache_impl.cpp')
-rw-r--r--src/mongo/db/catalog/collection_info_cache_impl.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mongo/db/catalog/collection_info_cache_impl.cpp b/src/mongo/db/catalog/collection_info_cache_impl.cpp
index bf4866b750a..b79def3cd04 100644
--- a/src/mongo/db/catalog/collection_info_cache_impl.cpp
+++ b/src/mongo/db/catalog/collection_info_cache_impl.cpp
@@ -38,6 +38,7 @@
#include "mongo/db/catalog/collection.h"
#include "mongo/db/catalog/index_catalog.h"
#include "mongo/db/concurrency/d_concurrency.h"
+#include "mongo/db/curop_metrics.h"
#include "mongo/db/fts/fts_spec.h"
#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/index/wildcard_access_method.h"
@@ -162,7 +163,11 @@ void CollectionInfoCacheImpl::computeIndexKeys(OperationContext* opCtx) {
}
void CollectionInfoCacheImpl::notifyOfQuery(OperationContext* opCtx,
- const std::set<std::string>& indexesUsed) {
+ const PlanSummaryStats& summaryStats) {
+ _indexUsageTracker.recordCollectionScans(summaryStats.collectionScans);
+ _indexUsageTracker.recordCollectionScansNonTailable(summaryStats.collectionScansNonTailable);
+
+ const auto& indexesUsed = summaryStats.indexesUsed;
// Record indexes used to fulfill query.
for (auto it = indexesUsed.begin(); it != indexesUsed.end(); ++it) {
// This index should still exist, since the PlanExecutor would have been killed if the
@@ -263,4 +268,9 @@ void CollectionInfoCacheImpl::setNs(NamespaceString ns) {
}
}
+CollectionIndexUsageTracker::CollectionScanStats CollectionInfoCacheImpl::getCollectionScanStats()
+ const {
+ return _indexUsageTracker.getCollectionScanStats();
+}
+
} // namespace mongo