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

Aggregation text search returns text score even if it wasn't requested when targeting multiple shards in a sharded cluster

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 3.6.0
    • Fix Version/s: 3.6.2, 3.7.1
    • Component/s: Aggregation Framework
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v3.6
    • Steps To Reproduce:
      Hide

      I think the easiest way is to try running existing tests: first, apply this patch to run with multiple shards:

      diff --git a/buildscripts/resmokeconfig/suites/aggregation_sharded_collections_passthrough.yml b/buildscripts/resmokeconfig/suites/aggregation_sharded_collections_passthrough.yml
      index de8b568eee..68b988f909 100644
      --- a/buildscripts/resmokeconfig/suites/aggregation_sharded_collections_passthrough.yml
      +++ b/buildscripts/resmokeconfig/suites/aggregation_sharded_collections_passthrough.yml
      @@ -48,6 +48,7 @@ executor:
           n: 20
         fixture:
           class: ShardedClusterFixture
      +    num_shards: 2
           mongos_options:
             set_parameters:
               enableTestCommands: 1
      

      and then run

      $ python2 buildscripts/resmoke.py --suites aggregation_sharded_collections_passthrough jstests/aggregation/bugs/server11675.js
      

      With this patch applied, I can't reproduce the failure locally:

      diff --git a/buildscripts/resmokeconfig/suites/aggregation_sharded_collections_passthrough.yml b/buildscripts/resmokeconfig/suites/aggregation_sharded_collections_passthrough.yml                                                            
      index de8b568eee..1b2963cd71 100644
      --- a/buildscripts/resmokeconfig/suites/aggregation_sharded_collections_passthrough.yml
      +++ b/buildscripts/resmokeconfig/suites/aggregation_sharded_collections_passthrough.yml
      @@ -48,9 +48,11 @@ executor:
           n: 20
         fixture:
           class: ShardedClusterFixture
      +    num_shards: 2
           mongos_options:
             set_parameters:
               enableTestCommands: 1
      +        internalQueryProhibitMergingOnMongoS: 1
           mongod_options:
             nopreallocj: ''
             set_parameters:
      

      Show
      I think the easiest way is to try running existing tests: first, apply this patch to run with multiple shards: diff --git a/buildscripts/resmokeconfig/suites/aggregation_sharded_collections_passthrough.yml b/buildscripts/resmokeconfig/suites/aggregation_sharded_collections_passthrough.yml index de8b568eee..68b988f909 100644 --- a/buildscripts/resmokeconfig/suites/aggregation_sharded_collections_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/aggregation_sharded_collections_passthrough.yml @@ -48,6 +48,7 @@ executor: n: 20 fixture: class: ShardedClusterFixture + num_shards: 2 mongos_options: set_parameters: enableTestCommands: 1 and then run $ python2 buildscripts/resmoke.py --suites aggregation_sharded_collections_passthrough jstests/aggregation/bugs/server11675.js With this patch applied, I can't reproduce the failure locally: diff --git a/buildscripts/resmokeconfig/suites/aggregation_sharded_collections_passthrough.yml b/buildscripts/resmokeconfig/suites/aggregation_sharded_collections_passthrough.yml index de8b568eee..1b2963cd71 100644 --- a/buildscripts/resmokeconfig/suites/aggregation_sharded_collections_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/aggregation_sharded_collections_passthrough.yml @@ -48,9 +48,11 @@ executor: n: 20 fixture: class: ShardedClusterFixture + num_shards: 2 mongos_options: set_parameters: enableTestCommands: 1 + internalQueryProhibitMergingOnMongoS: 1 mongod_options: nopreallocj: '' set_parameters:
    • Sprint:
      Query 2017-12-18, Query 2018-01-01

      Description

      As part of SERVER-31785, I noticed that an aggregation like

      db.coll.aggregate({$match: {$text: {$search: "foo"}}});
      

      will return the text score even though it hasn't been requested. This seems like a bug, as it differs from the behavior of the find command, which does not return the text score. Interestingly, this only occurs when the query targets multiple shards in the cluster. If I add a predicate on the shard key and target one shard, the text score is not included.

      Charlie Swanson noted that this might be related to the change in SERVER-22760, which allows merging on mongos for certain pipelines. I've confirmed that this doesn't reproduce when setting internalQueryProhibitMergingOnMongoS, so we should investigate the mongos merging logic.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bernard.gorman Bernard Gorman
              Reporter:
              kyle.suarez Kyle Suarez
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: