[SERVER-17134] shell aggregation with $OUT has inconsistent writeConcern handling Created: 30/Jan/15  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: Aggregation Framework, Shell
Affects Version/s: 2.6.7, 3.0.0-rc7
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: James Wahlin Assignee: Backlog - Query Execution
Resolution: Unresolved Votes: 0
Labels: query-44-grooming, usability
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Assigned Teams:
Query Execution
Operating System: ALL
Steps To Reproduce:

db.dropDatabase();
db.test.insert({_id: 1});
 
var nMembers = rs.conf().members.length;
var writeConcern = {w: (nMembers+1), wtimeout: 1000};
db.setWriteConcern(writeConcern);
 
// The following should time out waiting for writeConcern to be fulfilled but does not.
db.test.aggregate([{"$project": {_id: 1}}, {"$match": {_id: 1}}, {"$out": "test2"}])
 
// Under 2.6.7 rs.conf().settings.getLastErrorDefaults is respected for $OUT
// Under 3.0.0-rc7 this setting is not respected for $OUT
var conf = rs.conf();
conf.settings = {};
conf.settings.getLastErrorDefaults = writeConcern;
rs.reconfig(conf);
db.test.aggregate([{"$project": {_id: 1}}, {"$match": {_id: 1}}, {"$out": "test3"}])

Participants:

 Description   

When performing an aggregation via mongo shell with $OUT specified, write concern is handled in an inconsistent manner.

  • Write concern change via db.setWriteConcern() or db.coll.setWriteConcern() is ignored for $OUT
  • Write concern change via the settings.getLastErrorDefaults replica set config is respected under 2.6.7
  • Write concern change via the settings.getLastErrorDefaults replica set config is not respected under 3.0.0-rc7

My expectation would be that both the setWriteConcern() method and the getLastErrorDefaults setting would be respected for $OUT, with setWriteConcern() taking precedence.


Generated at Thu Feb 08 03:43:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.