[SERVER-25680] Commands should check for a collection before looking up a view Created: 18/Aug/16  Updated: 02/Sep/16  Resolved: 24/Aug/16

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: 3.3.12

Type: Bug Priority: Major - P3
Reporter: Kyle Suarez Assignee: Kyle Suarez
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-25723 don't terminate in presence of invali... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

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
Participants:
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.



 Comments   
Comment by Githook User [ 24/Aug/16 ]

Author:

{u'username': u'ksuarz', u'name': u'Kyle Suarez', u'email': u'kyle.suarez@mongodb.com'}

Message: SERVER-25680 Don't check for view if collection exists
Branch: master
https://github.com/mongodb/mongo/commit/74cdf9440f23bf3a88f1baafa18d07bbb755f322

Generated at Thu Feb 08 04:09:52 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.