Track partial results for shard-level errors in query stats

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Integration
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Sub-ticket for SERVER-87657.
       
      Handle sharded reads with allowPartialResults:true for find and aggregate. Do not record swallowed shard errors in queryStats.errors. Instead, add a partialResultsReturned counter to the query-stats entry.
       
      partialResultsReturned is already collected at every point the router writes query stats, so no new plumbing is needed to get the value: * find first batch: cluster_find.cpp:461

      • aggregate first batch: cluster_aggregation_planner.cpp:596
      • getMore: cluster_find.cpp:1230

      Thread this counter through QueryStatsSnapshot -> updateStatistics -> QueryStatsEntry, the same way SERVER-131923 added new metrics.
       
      Also add high-verbosity logging to surface all shard-level failures are currently suppressed, which will require changes to preserve and expose that information for logging. There are multiple sites where logging will need to be added: * CursorEstablisher::_canSkipForPartialResults()

      • AsyncResultsMerger::RemoteCursorData::cleanUpFailedBatch()

      Open Question: For mongos cursors, decide whether the counter tracks batches that returned partial results or just the whole operation. Seems like it would make sense to just collect it per operation, the same way execCount is incremented once per operation (not batch) for non-change stream cursors.
       
      Change stream cursors are out of scope: allowPartialResults:true is rejected for them outright (lite_parsed_pipeline.cpp:184-187), as it is for $out/$merge and search stages.

            Assignee:
            Kritika Singh (Inactive)
            Reporter:
            Kritika Singh (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: