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

Mechanism for setting consistency during query

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Optimization

      TL;DR: create some macros/change the API to facilitate this, and/or ban loading of feature flags/query knobs happening multiple times during query lifetime. See below for motivation.

      A common source of problems when adding a new feature flag is that the FCV changes (e.g. on an upgrade/downgrade passthrough suite) during query planning, which results in consecutive feature flag checks via load() being different at different points during planning, which can result in invalid behaviour.

      A similar issue which does not get detected by passthrough testing is query knob values changing during query optimization. We don't have any tests for this (typically a query knob is configured once at the start of a test for some specific test-only reason, and our test coverage for various values of query knobs is limited); however, given that in extreme cases users may need to configure knobs themselves, it would be best if we redesigned how we access query knobs to avoid the possibility of a similar race condition.

      The workaround for query feature flags is to cache the feature flag on the expression context (example); however, this is not widely known/ well-documented- and it may not interact correctly with situations where we have multiple expression contexts (e.g. a sub-pipeline in $lookup/$unionWith).

      We should ensure query knobs and feature flags used for query planning are always retrieved only once during a query's lifetime & cached on the expression context (or similar).

            Assignee:
            Unassigned Unassigned
            Reporter:
            alya.berciu@mongodb.com Alya Berciu
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated: