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

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.3.12
    • Component/s: Querying
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Steps To Reproduce:
      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
    • Sprint:
      Integration 2016-08-29
    • Linked BF Score:
      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

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

                Dates

                • Created:
                  Updated:
                  Resolved: