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

Accessing cursor with pending data after forcing system.namespaces record move may cause crash

    • Fully Compatible
    • ALL
    • v3.4, v3.2, v3.0
    • Hide
          let dbInvalidName = 'system_namespaces_invalidations';
          let dbInvalid = db.getSiblingDB(dbInvalidName);
          let num_collections = 3;
          dbInvalid.dropDatabase();
          for (let i = 0; i < num_collections; i++) {
              assert.commandWorked(dbInvalid.createCollection('coll' + i.toString()));
          }
          let cmd = {find: 'system.namespaces'};
          Object.extend(cmd, {batchSize: 3, showRecordId: true});
          let res = dbInvalid.runCommand(cmd);
          assert.commandWorked(res, 'could not run ' + tojson(cmd));
          printjson(res);
          let cursor = new DBCommandCursor(dbInvalid.getMongo(), res);
          let errMsg =
              'expected more data from command ' + tojson(cmd) + ', with result ' + tojson(res);
          assert(cursor.hasNext(), errMsg);
          let coll = dbInvalid['coll1'];
          let modCmd ={collMod: 'coll1', validator: { $or:
              [
              { phone: { $type: "string" } },
              { email: { $regex: /@mongodb\.com$/ } },
              { status: { $in: [ "Unknown", "Incomplete" ] } },
              { address: { $type: "string" } },
              { ssn: { $type: "string" } },
              { favoriteBook: { $type: "string" } },
              { favoriteColor: { $type: "string" } },
              { favoriteBeverage: { $type: "string" } },
              { favoriteDay: { $type: "string" } },
              { favoriteFood: { $type: "string" } },
              { favoriteSport: { $type: "string" } },
              { favoriteMovie: { $type: "string" } },
              { favoriteShow: { $type: "string" } }
              ]
          }};
          assert.commandWorked(dbInvalid.runCommand(modCmd));
          assert.gt(cursor.itcount(), 0, errMsg);
      
      Show
      let dbInvalidName = 'system_namespaces_invalidations' ; let dbInvalid = db.getSiblingDB(dbInvalidName); let num_collections = 3; dbInvalid.dropDatabase(); for (let i = 0; i < num_collections; i++) { assert.commandWorked(dbInvalid.createCollection( 'coll' + i.toString())); } let cmd = {find: 'system.namespaces' }; Object .extend(cmd, {batchSize: 3, showRecordId: true }); let res = dbInvalid.runCommand(cmd); assert.commandWorked(res, 'could not run ' + tojson(cmd)); printjson(res); let cursor = new DBCommandCursor(dbInvalid.getMongo(), res); let errMsg = 'expected more data from command ' + tojson(cmd) + ', with result ' + tojson(res); assert(cursor.hasNext(), errMsg); let coll = dbInvalid[ 'coll1' ]; let modCmd ={collMod: 'coll1' , validator: { $or: [ { phone: { $type: "string" } }, { email: { $regex: /@mongodb\.com$/ } }, { status: { $ in : [ "Unknown" , "Incomplete" ] } }, { address: { $type: "string" } }, { ssn: { $type: "string" } }, { favoriteBook: { $type: "string" } }, { favoriteColor: { $type: "string" } }, { favoriteBeverage: { $type: "string" } }, { favoriteDay: { $type: "string" } }, { favoriteFood: { $type: "string" } }, { favoriteSport: { $type: "string" } }, { favoriteMovie: { $type: "string" } }, { favoriteShow: { $type: "string" } } ] }}; assert.commandWorked(dbInvalid.runCommand(modCmd)); assert.gt(cursor.itcount(), 0, errMsg);
    • Storage 2017-03-06

      Another example of SERVER-27199, we do not invalidate the old record ID for a system.namespaces record that needs to be moved to a larger space. Executing the steps to reproduce may cause a crash.

            Assignee:
            maria.vankeulen@mongodb.com Maria van Keulen
            Reporter:
            maria.vankeulen@mongodb.com Maria van Keulen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: