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

Commands should check for a collection before looking up a view

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 3.3.12
    • Querying
    • None
    • Fully Compatible
    • ALL
    • Hide

      repro.js

      assert.writeOK(db.collection.insert( { x: 1 } ));
      assert.writeOK(db.system.views.insert( { _id: "bad", pipeline: "bad" } ));
      assert.commandWorked(db.collection.reIndex());
      

      The output:

      2016-08-17T22:21:45.942-0400 E QUERY    [thread1] Error: command failed: {
              "ok" : 0,
              "errmsg" : "found invalid view definition { _id: \"bad\", pipeline: \"bad\" } while reading 'test.system.views'",
              "code" : 182
      } : undefined :
      _getErrorWithCode@src/mongo/shell/utils.js:25:13
      doassert@src/mongo/shell/assert.js:13:14
      assert.commandWorked@src/mongo/shell/assert.js:264:5
      

      Show
      repro.js assert.writeOK(db.collection.insert( { x: 1 } )); assert.writeOK(db.system.views.insert( { _id: "bad" , pipeline: "bad" } )); assert.commandWorked(db.collection.reIndex()); The output: 2016-08-17T22:21:45.942-0400 E QUERY [thread1] Error: command failed: { "ok" : 0, "errmsg" : "found invalid view definition { _id: \"bad\", pipeline: \"bad\" } while reading 'test.system.views'", "code" : 182 } : undefined : _getErrorWithCode@src/mongo/shell/utils.js:25:13 doassert@src/mongo/shell/assert.js:13:14 assert.commandWorked@src/mongo/shell/assert.js:264:5
    • Integration 2016-08-29
    • 0

    Description

      Commands that operate on collection namespaces should only call ViewCatalog::lookup() if Database::getCollection() returns nullptr. This avoids an unnecessary failure if a command is run on a valid collection namespace but the system.views collection contains an invalid view definition.

      In addition, we should probably not access the ViewCatalog if the namespace is virtualized.

      Attachments

        Issue Links

          Activity

            People

              kyle.suarez@mongodb.com Kyle Suarez
              kyle.suarez@mongodb.com Kyle Suarez
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: