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

Index creation may be allowed to start on a collection in drop-pending state

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.3.2
    • Affects Version/s: None
    • Component/s: Storage
    • None
    • Fully Compatible
    • ALL
    • Hide
      'use strict';
      
      var $config = (function() {
          var data = {
              prefix: 'create_collection'
          };
      
          var states = (function() {
              function init(db, collName) {
                  this.num = 0;
              }
      
              function dropAndCreate(db, collName) {
                  db[collName].drop();
                  assertAlways.commandWorked(db[collName].insert({x:1}));
              }
      
              function createIndex(db, collName){
                  db[collName].createIndex({x:1});
                  db[collName].dropIndex({x:1});
              }
      
              return {init: init, dropAndCreate: dropAndCreate, createIndex: createIndex};
          })();
      
          var transitions = {init: {dropAndCreate: 0.5, createIndex: 0.5},
              dropAndCreate: {dropAndCreate: 0.5, createIndex: 0.5},
              createIndex: {dropAndCreate: 0.5, createIndex: 0.5}};
      
          return {
              threadCount: 10,
              iterations: 20,
              data: data,
              states: states,
              transitions: transitions,
          };
      })();
      
      Show
      'use strict' ; var $config = ( function () { var data = { prefix: 'create_collection' }; var states = ( function () { function init(db, collName) { this .num = 0; } function dropAndCreate(db, collName) { db[collName].drop(); assertAlways.commandWorked(db[collName].insert({x:1})); } function createIndex(db, collName){ db[collName].createIndex({x:1}); db[collName].dropIndex({x:1}); } return {init: init, dropAndCreate: dropAndCreate, createIndex: createIndex}; })(); var transitions = {init: {dropAndCreate: 0.5, createIndex: 0.5}, dropAndCreate: {dropAndCreate: 0.5, createIndex: 0.5}, createIndex: {dropAndCreate: 0.5, createIndex: 0.5}}; return { threadCount: 10, iterations: 20, data: data, states: states, transitions: transitions, }; })();
    • Execution Team 2019-12-02
    • 38

      When we run a createIndexes command, we will look up the UUID of the specified collection under a lock here. We release this lock, however, and later on we will look up the namespace for the collection here, which is the namespace we use later on in the index creation operation. It is possible that a 'drop' command has been called during the time we released our locks, and it could have renamed the collection to a "drop pending" namespace, if we are still using the old two phase collection drop implementation (used when EMRC=false). When we look up the namespace, we will then be looking up the drop pending namespace. It seems that we shouldn't allow a collection drop to interleave with a createIndexes command like this.

            Assignee:
            benety.goh@mongodb.com Benety Goh
            Reporter:
            william.schultz@mongodb.com William Schultz (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: