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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.0.15, 3.2.13, 3.4.3, 3.5.4
    • Component/s: MMAPv1
    • Labels:
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v3.4, v3.2, v3.0
    • Steps To Reproduce:
      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);
    • Sprint:
      Storage 2017-03-06

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: