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

Updates/deletes on sharded collections shouldn't affect orphan documents

    XMLWordPrintable

    Details

    • Operating System:
      ALL
    • Case:

      Description

      Multi-updates and multi-deletes on sharded collections affect orphan documents, and are counted in WriteResult / getLastError stats. Writes to sharded collections should not affect orphan documents.

      Affects all currently-released versions.

      var st = new ShardingTest({shards:2});
      assert.commandWorked(st.getDB("admin").runCommand({enableSharding: "test"}));
      assert.commandWorked(st.getDB("admin").runCommand({shardCollection: "test.foo", key: {_id: "hashed"}}));
      assert.writeOK((new Mongo("localhost:30000")).getDB("test").foo.insert({_id:0}));
      assert.writeOK((new Mongo("localhost:30001")).getDB("test").foo.insert({_id:0}));
      var res = st.getDB("test").foo.update({}, {$set: {a: 1}}, {multi: true});
      assert.writeOK(res);
      assert.eq(1, res.nMatched); // fails with [1] != [2]
      res = st.getDB("test").foo.remove({});
      assert.eq(1, res.nRemoved); // fails with [1] != [2]
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              backlog-server-sharding Backlog - Sharding Team
              Reporter:
              jason.rassi Jason Rassi
              Participants:
              Votes:
              2 Vote for this issue
              Watchers:
              30 Start watching this issue

                Dates

                Created:
                Updated: