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

shell aggregation with $OUT has inconsistent writeConcern handling

    • Query Execution
    • ALL
    • Hide
      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"}])
      
      Show
      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" }])

      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.

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            james.wahlin@mongodb.com James Wahlin
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: