Support recording errors in query stats for queries that reference $$CLUSTER_TIME

    • 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

      SERVER-131924 began recording query stats entries for reads that error. This introduced a new class of stored shapes: shapes from queries that can never succeed on the node that recorded them. One that was exposed: $$CLUSTER_TIME on a standalone. 

      For an aggregate, the following flow is taken: command referencing $$CLUSTER_TIME while being on a standalone parses successes -> runs registerRequest() so key is live -> throws 10071200 in initializeReferencedSystemVariables(). Because the key is live, the errored shape is recorded. When $queryStats is called later, toDocument throws the same code when it hits initializeReferencedSystemVariables() on this path:

      toDocument-> computeQueryStatsKey
          -> AggCmdShape::appendCmdSpecificShapeComponents
          -> pipeline_factory::makePipeline
          -> finalizePipeline -> initializeReferencedSystemVariables()

      Current workaround: This error code was added to the exclusion list in query_stats_stage.cpp:235.

      Github thread: https://github.com/10gen/mongo/pull/59526#discussion_r3684942180

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

              Created:
              Updated: