Use first node when the primary is undefined in RunQueryStats hook

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Major - P3
    • 8.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Integration
    • Fully Compatible
    • 200
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The primary can be undefined during topology discovery, e.g. during an election. This will cause the RunQueryStats hook to fail here because we directly use the primary here.

      https://github.com/10gen/mongo/blob/d93a8e99d098a24e04a4bf89a2170e80aa49b364/jstests/hooks/query_integration/run_query_stats.js#L96

      We should check if the primary exists, and if it doesn't we should fall back to using the first node, because this is a similar pattern to what we do in shard_fixture.js: https://github.com/10gen/mongo/blob/d93a8e99d098a24e04a4bf89a2170e80aa49b364/jstests/concurrency/fsm_libs/shard_fixture.js#L63-L68 

            Assignee:
            Erin Liang
            Reporter:
            Erin Liang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: