[SERVER-27304] Create setParameter to make all aggregations which require merging select the primary shard as the merger Created: 06/Dec/16  Updated: 05/Apr/17  Resolved: 06/Dec/16

Status: Closed
Project: Core Server
Component/s: Aggregation Framework, Querying
Affects Version/s: None
Fix Version/s: 3.2.12, 3.4.2, 3.5.1

Type: Task Priority: Major - P3
Reporter: David Storch Assignee: David Storch
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
is related to SERVER-24815 Merging aggregation pipeline strategy... Backlog
is related to SERVER-18925 Merging part of aggregation pipeline ... Closed
Backwards Compatibility: Fully Compatible
Backport Requested:
v3.4, v3.2
Sprint: Query 2016-12-12
Participants:

 Description   

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 "
}



 Comments   
Comment by Githook User [ 21/Dec/16 ]

Author:

{u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}

Message: SERVER-27304 add internalQueryAlwaysMergeOnPrimaryShard setParameter

When set to true on a mongos, aggregation queries routed to
that mongos which require a merging shard will always select
the primary shard as the merger. Set to false by default,
which means that the merging shard is chosen at random
amongst nodes participating in answering the aggregation
query.

(cherry picked from commit 3f54fef03fdd7bd787a57387b84d298c9dd0222d)

Conflicts:
src/mongo/s/commands/cluster_aggregate.cpp
Branch: v3.2
https://github.com/mongodb/mongo/commit/2cfb3e0bdc46deb7ad4546cce529b6084cc9d922

Comment by Githook User [ 21/Dec/16 ]

Author:

{u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}

Message: SERVER-27304 add internalQueryAlwaysMergeOnPrimaryShard setParameter

When set to true on a mongos, aggregation queries routed to
that mongos which require a merging shard will always select
the primary shard as the merger. Set to false by default,
which means that the merging shard is chosen at random
amongst nodes participating in answering the aggregation
query.

(cherry picked from commit 3f54fef03fdd7bd787a57387b84d298c9dd0222d)
Branch: v3.4
https://github.com/mongodb/mongo/commit/28ea046556896e5654cfd38a3d84608668c96dce

Comment by Githook User [ 06/Dec/16 ]

Author:

{u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}

Message: SERVER-27304 add internalQueryAlwaysMergeOnPrimaryShard setParameter

When set to true on a mongos, aggregation queries routed to
that mongos which require a merging shard will always select
the primary shard as the merger. Set to false by default,
which means that the merging shard is chosen at random
amongst nodes participating in answering the aggregation
query.
Branch: master
https://github.com/mongodb/mongo/commit/3f54fef03fdd7bd787a57387b84d298c9dd0222d

Generated at Thu Feb 08 04:14:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.