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

mongod startup should gracefully handle invalid view definitions

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 3.3.12
    • None
    • Storage
    • Fully Compatible
    • ALL
    • Hide

      python buildscripts/resmoke.py --executor=no_server bad_view.js
      

      bad_view.js

      var dbpath = MongoRunner.dataPath;
      resetDbpath(dbpath);
       
      var options = {
          dbpath: dbpath,
          noCleanData: true,
          setParameter: "enableViews=1",
      };
      var conn = MongoRunner.runMongod(options);
      assert.neq(null, conn, "mongod failed to start up with options: " + tojson(options));
       
      // Insert directly into the system.views collection to bypass the validation that the
      // "create" command performs.
      assert.writeOK(conn.getDB("test").system.views.insert({pipeline: "bad type"}));
       
      // Try to restart the mongod.
      MongoRunner.stopMongod(conn);
      conn = MongoRunner.runMongod(options);
      assert.neq(null, conn, "mongod failed to start up with options: " + tojson(options));
      

      Output

      [js_test:bad_view] 2016-08-08T17:05:23.381-0400 d20011| 2016-08-08T17:05:23.380-0400 I STORAGE  [initandlisten] exception in initAndListen: 182 invalid view definitions reading 'test.system.views', terminating
      ...
      [js_test:bad_view] 2016-08-08T17:05:23.523-0400 2016-08-08T17:05:23.522-0400 E QUERY    [thread1] Error: [null] != [null] are equal : mongod failed to start up with options: {
      [js_test:bad_view] 2016-08-08T17:05:23.523-0400   "dbpath" : "/data/db/job0/mongorunner/",
      [js_test:bad_view] 2016-08-08T17:05:23.524-0400   "noCleanData" : true,
      [js_test:bad_view] 2016-08-08T17:05:23.524-0400   "setParameter" : "enableViews=1"
      [js_test:bad_view] 2016-08-08T17:05:23.524-0400 } :
      [js_test:bad_view] 2016-08-08T17:05:23.524-0400 doassert@src/mongo/shell/assert.js:15:14
      [js_test:bad_view] 2016-08-08T17:05:23.524-0400 assert.neq@src/mongo/shell/assert.js:128:5
      [js_test:bad_view] 2016-08-08T17:05:23.525-0400 @bad_view.js:20:1
      [js_test:bad_view] 2016-08-08T17:05:23.525-0400 failed to load: bad_view.js
      

      Show
      python buildscripts/resmoke.py --executor=no_server bad_view.js bad_view.js var dbpath = MongoRunner.dataPath; resetDbpath(dbpath);   var options = { dbpath: dbpath, noCleanData: true , setParameter: "enableViews=1" , }; var conn = MongoRunner.runMongod(options); assert.neq( null , conn, "mongod failed to start up with options: " + tojson(options));   // Insert directly into the system.views collection to bypass the validation that the // "create" command performs. assert.writeOK(conn.getDB( "test" ).system.views.insert({pipeline: "bad type" }));   // Try to restart the mongod. MongoRunner.stopMongod(conn); conn = MongoRunner.runMongod(options); assert.neq( null , conn, "mongod failed to start up with options: " + tojson(options)); Output [js_test:bad_view] 2016-08-08T17:05:23.381-0400 d20011| 2016-08-08T17:05:23.380-0400 I STORAGE [initandlisten] exception in initAndListen: 182 invalid view definitions reading 'test.system.views', terminating ... [js_test:bad_view] 2016-08-08T17:05:23.523-0400 2016-08-08T17:05:23.522-0400 E QUERY [thread1] Error: [null] != [null] are equal : mongod failed to start up with options: { [js_test:bad_view] 2016-08-08T17:05:23.523-0400 "dbpath" : "/data/db/job0/mongorunner/", [js_test:bad_view] 2016-08-08T17:05:23.524-0400 "noCleanData" : true, [js_test:bad_view] 2016-08-08T17:05:23.524-0400 "setParameter" : "enableViews=1" [js_test:bad_view] 2016-08-08T17:05:23.524-0400 } : [js_test:bad_view] 2016-08-08T17:05:23.524-0400 doassert@src/mongo/shell/assert.js:15:14 [js_test:bad_view] 2016-08-08T17:05:23.524-0400 assert.neq@src/mongo/shell/assert.js:128:5 [js_test:bad_view] 2016-08-08T17:05:23.525-0400 @bad_view.js:20:1 [js_test:bad_view] 2016-08-08T17:05:23.525-0400 failed to load: bad_view.js
    • Integration 2016-08-29

    Description

      The current behavior is for mongod to fail to start. This is unacceptable because it doesn't allow for any user remediation to drop invalid view definitions.

      Attachments

        Activity

          People

            kyle.suarez@mongodb.com Kyle Suarez
            max.hirschhorn@mongodb.com Max Hirschhorn
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: