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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 3.6.0
    • 3.6.2, 3.7.1
    • Aggregation Framework
    • None
    • Fully Compatible
    • ALL
    • v3.6
    • 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:
    • 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

              bernard.gorman@mongodb.com Bernard Gorman
              kyle.suarez@mongodb.com Kyle Suarez
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: