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

Read preference for an explain routed through mongos does not work on 3.0 for explain-of-count and explain-of-group

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.0.0
    • Component/s: Querying, Sharding
    • Labels:
      None
    • Query
    • ALL
    • Hide

      The attached test, explain_read_pref.js, demonstrates the issue. It is a slightly modified version of the test in the master branch (jstests/sharding/explain_read_pref.js).

      Show
      The attached test, explain_read_pref.js, demonstrates the issue. It is a slightly modified version of the test in the master branch (jstests/sharding/explain_read_pref.js).

      In 3.0, the host targeting logic on mongos only works for the explain command if explaining a find operation. If an explain of a count or group operation is routed through mongos with a read preference, the read preference is ignored. As a result, these explains are always delivered to the primary node, even for read preferences like "secondary" or "secondaryPreferred".

      This has already been fixed in the 3.1.8 development version under SERVER-19341. Therefore, the issue only affects the 3.0 branch. (It does not affect 2.6 or previous versions because find was the only explainable operation in these versions.)

        1. explain_read_pref.js
          5 kB
          David Storch

            Assignee:
            backlog-server-query Backlog - Query Team (Inactive)
            Reporter:
            david.storch@mongodb.com David Storch
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: