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

Concurrent mapReduces with same replacement collection fail with WT

    XMLWordPrintable

    Details

    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      Run this script against mongod --storageEngine=wiredTiger:

      'use strict';
       
      load('jstests/libs/parallelTester.js');
       
      function client() {
       
          function mapper() {
              emit(this.key, 1);
          }
       
          function reducer() {
              return {};
          }
       
          while (true) {
              var options = {
                  out: {replace: 'bar'}
              };
       
              db.foo.mapReduce(mapper, reducer, options);
          }
      }
       
      db.foo.drop();
       
      var bulk = db.foo.initializeUnorderedBulkOp();
      for (var i = 0; i < 3000; i++) {
          bulk.insert({i: i, key: Random.randInt()});
      }
      bulk.execute();
       
      var threads = [];
      for (var i = 0; i < 7; i++) {
          var t = new ScopedThread(client);
          threads.push(t);
          t.start();
      }
       
      threads.forEach(function(t) {
          t.join();
      });

      Show
      Run this script against mongod --storageEngine=wiredTiger : 'use strict';   load('jstests/libs/parallelTester.js');   function client() {   function mapper() { emit(this.key, 1); }   function reducer() { return {}; }   while (true) { var options = { out: {replace: 'bar'} };   db.foo.mapReduce(mapper, reducer, options); } }   db.foo.drop();   var bulk = db.foo.initializeUnorderedBulkOp(); for (var i = 0; i < 3000; i++) { bulk.insert({i: i, key: Random.randInt()}); } bulk.execute();   var threads = []; for (var i = 0; i < 7; i++) { var t = new ScopedThread(client); threads.push(t); t.start(); }   threads.forEach(function(t) { t.join(); });

      Description

      Concurrent mapReduce operations that specify the same replacement collection can fail with "target namespace exists" errors when using WiredTiger. The same error is seemingly not reproducible with mmapv1.

      I wouldn't expect a mapReduce operation with a 'replace' action to fail due to an existing namespace.

      Error message:

      Error: map reduce failed:{
      	"errmsg" : "exception: rename failed: { ok: 0.0, errmsg: \"target namespace exists\" }",
      	"code" : 10076,
      	"ok" : 0
      }


      Version: b766e395167dc27

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              kaloian.manassiev Kaloian Manassiev
              Reporter:
              kamran.khan Kamran K.
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              11 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: