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

shell bulk API sends unordered bulks highly unoptimized

    XMLWordPrintableJSON

Details

    • Fully Compatible

    Description

      When creating an unordered bulk operation containing operations of different kinds they are not compiled into bigger batches but simply sent in the order they arrive.

      For example the sequence:

      insert()
      update() 
      insert()
      update()
      insert()

      would be sent in 5 unique batches each containing one operation instead of two larger ones.

      var batch = coll.initializeUnorderedBulkOp();
      for (var i=0;i<5001;i++) {
      batch.insert({_id:i});
      batch.find({c:i}).removeOne();
      }
      result = batch.execute();

      would result in 10000 commands being sent to the server instead of the necessary 10. Most users probably won't encounter this but it's not pretty. Essentially the unordered implementation behaves like the ordered except that execution does not terminate on server errors.

      Attachments

        Activity

          People

            backlog-server-platform DO NOT USE - Backlog - Platform Team
            andreas.nilsson Andreas Nilsson
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: