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

Deadlock with WiredTiger LSM

    XMLWordPrintableJSON

Details

    • Fully Compatible
    • ALL
    • Hide

      This repro script is equivalent in functionality to the FSM-based workload, agg_sort_external.js (which at this time of writing has yet to be merged into the master branch), in the concurrency test suite.

      load('jstests/libs/parallelTester.js');
       
      var getStringOfLength = (function() {
          var cache = {};
          return function(size) {
      	if (!cache[size]) {
      	    cache[size] = new Array(size + 1).join('x');
      	}
      	return cache[size];
          };
      })();
       
      var makeDoc = function(doc, size) {
          doc.padding = '';
          var paddingLength = size - Object.bsonsize(doc);
          doc.padding = getStringOfLength(paddingLength);
          return doc;
      };
       
      var main = function(tid) {
          var prefix = 'out_agg_sort_external';
          while (true) {
      	var toCollName = prefix + tid;
      	var cursor = db.source.aggregate([
      	    { $match: { flag: true } },
      	    { $sort: { rand: 1 } },
      	    { $out: toCollName }
      	], {
      	    allowDiskUse: true
      	});
      	assert.eq(0, cursor.itcount());
      	assert.eq(db.source.find().itcount() / 2, db[toCollName].find().itcount());
          }
      };
       
      var KB = 1024;
      var MB = KB * KB;
      var numDocs = 24 * KB;
      var docSize = 12 * KB;
       
      assert.lte(100 * MB, numDocs * docSize / 2);
      // insert enough documents until we exceed the 100MB in-memory aggregation limit
       
      var bulk = db.source.initializeUnorderedBulkOp();
      for (var i = 0; i < numDocs; ++i) {
          bulk.insert(makeDoc({
      	flag: i % 2 ? true : false,
      	rand: Random.rand()
          }, docSize));
      }
      var res = bulk.execute();
      assert.writeOK(res);
      assert.eq(numDocs, res.nInserted);
       
      var numThreads = 10;
      i = 0;
      for (; i < numThreads - 1; ++i) {
          var t = new ScopedThread(main, i);
          t.start();
      }
       
      main(i);

      Show
      This repro script is equivalent in functionality to the FSM-based workload, agg_sort_external.js (which at this time of writing has yet to be merged into the master branch), in the concurrency test suite. load('jstests/libs/parallelTester.js');   var getStringOfLength = (function() { var cache = {}; return function(size) { if (!cache[size]) { cache[size] = new Array(size + 1).join('x'); } return cache[size]; }; })();   var makeDoc = function(doc, size) { doc.padding = ''; var paddingLength = size - Object.bsonsize(doc); doc.padding = getStringOfLength(paddingLength); return doc; };   var main = function(tid) { var prefix = 'out_agg_sort_external'; while (true) { var toCollName = prefix + tid; var cursor = db.source.aggregate([ { $match: { flag: true } }, { $sort: { rand: 1 } }, { $out: toCollName } ], { allowDiskUse: true }); assert.eq(0, cursor.itcount()); assert.eq(db.source.find().itcount() / 2, db[toCollName].find().itcount()); } };   var KB = 1024; var MB = KB * KB; var numDocs = 24 * KB; var docSize = 12 * KB;   assert.lte(100 * MB, numDocs * docSize / 2); // insert enough documents until we exceed the 100MB in-memory aggregation limit   var bulk = db.source.initializeUnorderedBulkOp(); for (var i = 0; i < numDocs; ++i) { bulk.insert(makeDoc({ flag: i % 2 ? true : false, rand: Random.rand() }, docSize)); } var res = bulk.execute(); assert.writeOK(res); assert.eq(numDocs, res.nInserted);   var numThreads = 10; i = 0; for (; i < numThreads - 1; ++i) { var t = new ScopedThread(main, i); t.start(); }   main(i);

    Description

      mongod seems to deadlock after a while when run using the WiredTiger LSM engine.
      mongod was started with:
      ./mongod --port 29999 --dbpath /data/db_wt/ --storageEngine wiredTiger --wiredTigerCollectionConfigString type=lsm
      and then I ran:
      ./mongo repro.js
      See repro script above.

      Attachments

        Activity

          People

            kaloian.manassiev@mongodb.com Kaloian Manassiev
            daniel.alabi@10gen.com Daniel Alabi
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: