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

Create setParameter to make all aggregations which require merging select the primary shard as the merger

    • Fully Compatible
    • v3.4, v3.2
    • Query 2016-12-12

      Starting with MongoDB 3.2.0, aggregations which require a merging shard randomly select a merger amongst the shards participating in the query. This behavior was introduced under SERVER-18925 in order to help evenly distribute query load. In many situations this behavior is helpful, but it can have drawbacks. For example, when additional shards take on a merging role, more intra-cluster connections are required, which in turn requires additional resources. Therefore, we should introduce a setParameter on mongos called internalQueryAlwaysMergeOnPrimaryShard which can be used to disable random merger selection. The parameter's value is false by default. When configured to true, all aggregations which require a merging shard will merge on the primary shard. Pipelines which do not split into a shards part and merger part are not affected.

      The parameter can be set on the command line when starting mongos or via a config file. To set it using the shell, connect to mongos and run the following:

      db.adminCommand({setParameter: 1, internalQueryAlwaysMergeOnPrimaryShard: true});

      Note that this parameter is for mongos only; attempting to set it against a mongod will result in an error:

      > db.adminCommand({setParameter: 1, internalQueryAlwaysMergeOnPrimaryShard: true});
      	"ok" : 0,
      	"errmsg" : "attempted to set unrecognized parameter [internalQueryAlwaysMergeOnPrimaryShard], use help:true to see options "

            david.storch@mongodb.com David Storch
            david.storch@mongodb.com David Storch
            0 Vote for this issue
            3 Start watching this issue