deadlines and interrupts should be respected during explain() in extensions

XMLWordPrintableJSON

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

      When search extensions generate the explain response, they must issue a query directly against mongot. It's possible that when generating the explain output, that the query will exceed the maxTimeMs deadline, or that an interrupt occurs.

      In the legacy $vectorSearch implementation, the explain output is generated using a promise/future to wait for the mongot results. This process also checks for interrupts and ensure the deadline has not been exceeded. Unfortunately, the current state of the extensions API only provides a way for the extension to check for interrupts and deadlines via the QueryExecutionContext, which is only provided to the extension during get_next().

      In https://jira.mongodb.org/browse/SERVER-116461, we propagate the remaining deadline maxTimeMs to the extension, so it can be sent directly to mongot to prevent runaway queries.

      As part of this ticket, we should create a QueryExecutionContext and provide it to
      MongoExtensionLogicalAggStageVTable::explain function, as well as the MongoExtensionExecAggStageVTable::explain function. 

      It should be possible to create a QueryExecutionContext at the call sites, since the OpCtx is generally available on the ExpCtx() that is provided to DocumentSourceExtensionOptimizable.

            Assignee:
            Santiago Roche
            Reporter:
            Santiago Roche
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: