Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-89439

Collect execution metrics for explain queries in the query stats key

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Integration
    • QI 2024-05-27, QI 2024-06-10, QI 2024-06-24

      While working on SERVER-87634 an issue came up with over-reporting metrics in lookup_query_stats.js. This seems to be caused by the curOp metrics block inside of collectQueryStats(). In the jstest, there are 5 tests being run, each one running a query with a different scan, and then runs explain with every verbosity. The second test's assertion for curScannedObjects fails, regardless of what order the tests are being run. Thus, to avoid over-reporting right now we collect directly with collectQueryStatsMongod instead of collectQueryStats() so that we can skip curOp->debug().setPlanSummaryMetrics() and CurOp::setEndOfOpMetrics(). To reproduce the issue, replace

      collectQueryStatsMongod(opCtx, expCtx, std::move(curOp->debug().queryStatsInfo.key));

       inside of _runAggregate() with

      collectQueryStats(opCtx, expCtx, explainExecutor, nullptr);

      compile, and then run 

      buildscripts/resmoke.py run --suites=aggregation jstests/aggregation/sources/lookup/lookup_query_stats.js  --additionalFeatureFlags=featureFlagQueryStats

            Assignee:
            Unassigned Unassigned
            Reporter:
            mariano.shaar@mongodb.com Mariano Shaar
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: