[SERVER-21302] Possible to run COLSCAN with --notablescan if there is no query specified Created: 05/Nov/15  Updated: 05/Nov/15  Resolved: 05/Nov/15

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

Type: Bug Priority: Minor - P4
Reporter: Attila Tozser Assignee: David Storch
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-2222 notablescan mode neglects to fail som... Backlog
Operating System: ALL
Steps To Reproduce:

MongoDB shell version: 3.2.0-rc0
connecting to: bmx10201:30001/test
Server has startup warnings: 
2015-11-05T12:41:17.080+0000 I CONTROL  [initandlisten] 
2015-11-05T12:41:17.080+0000 I CONTROL  [initandlisten] ** WARNING: You are running on a NUMA machine.
2015-11-05T12:41:17.080+0000 I CONTROL  [initandlisten] **          We suggest launching mongod like this to avoid performance problems:
2015-11-05T12:41:17.080+0000 I CONTROL  [initandlisten] **              numactl --interleave=all mongod [other options]
2015-11-05T12:41:17.080+0000 I CONTROL  [initandlisten] 
2015-11-05T12:41:17.080+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2015-11-05T12:41:17.080+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2015-11-05T12:41:17.080+0000 I CONTROL  [initandlisten] 
MongoDB Enterprise M32_TST_SHARD0:PRIMARY> 
MongoDB Enterprise M32_TST_SHARD0:PRIMARY> 
MongoDB Enterprise M32_TST_SHARD0:PRIMARY> 
MongoDB Enterprise M32_TST_SHARD0:PRIMARY> db.getSiblingDB("admin").runCommand( { setParameter: 1, notablescan: 1 } )
{ "was" : false, "ok" : 1 }
MongoDB Enterprise M32_TST_SHARD0:PRIMARY> 
MongoDB Enterprise M32_TST_SHARD0:PRIMARY> 
MongoDB Enterprise M32_TST_SHARD0:PRIMARY> 
MongoDB Enterprise M32_TST_SHARD0:PRIMARY> 
MongoDB Enterprise M32_TST_SHARD0:PRIMARY> use test
switched to db test
MongoDB Enterprise M32_TST_SHARD0:PRIMARY> db.createCollection("a")
{ "ok" : 1 }
MongoDB Enterprise M32_TST_SHARD0:PRIMARY> 
MongoDB Enterprise M32_TST_SHARD0:PRIMARY> 
MongoDB Enterprise M32_TST_SHARD0:PRIMARY> 
MongoDB Enterprise M32_TST_SHARD0:PRIMARY> for(var i=0;i++<10000;){db.a.insert({b:i});}
WriteResult({ "nInserted" : 1 })
MongoDB Enterprise M32_TST_SHARD0:PRIMARY> 
MongoDB Enterprise M32_TST_SHARD0:PRIMARY> 
MongoDB Enterprise M32_TST_SHARD0:PRIMARY> 
MongoDB Enterprise M32_TST_SHARD0:PRIMARY> db.a.find()
{ "_id" : ObjectId("563b57861c2396459464a8ff"), "b" : 1 }
{ "_id" : ObjectId("563b57861c2396459464a900"), "b" : 2 }
{ "_id" : ObjectId("563b57861c2396459464a901"), "b" : 3 }
{ "_id" : ObjectId("563b57861c2396459464a902"), "b" : 4 }
{ "_id" : ObjectId("563b57861c2396459464a903"), "b" : 5 }
{ "_id" : ObjectId("563b57861c2396459464a904"), "b" : 6 }
{ "_id" : ObjectId("563b57861c2396459464a905"), "b" : 7 }
{ "_id" : ObjectId("563b57861c2396459464a906"), "b" : 8 }
{ "_id" : ObjectId("563b57861c2396459464a907"), "b" : 9 }
{ "_id" : ObjectId("563b57861c2396459464a908"), "b" : 10 }
{ "_id" : ObjectId("563b57861c2396459464a909"), "b" : 11 }
{ "_id" : ObjectId("563b57861c2396459464a90a"), "b" : 12 }
{ "_id" : ObjectId("563b57861c2396459464a90b"), "b" : 13 }
{ "_id" : ObjectId("563b57861c2396459464a90c"), "b" : 14 }
{ "_id" : ObjectId("563b57861c2396459464a90d"), "b" : 15 }
{ "_id" : ObjectId("563b57861c2396459464a90e"), "b" : 16 }
{ "_id" : ObjectId("563b57861c2396459464a90f"), "b" : 17 }
{ "_id" : ObjectId("563b57861c2396459464a910"), "b" : 18 }
{ "_id" : ObjectId("563b57861c2396459464a911"), "b" : 19 }
{ "_id" : ObjectId("563b57861c2396459464a912"), "b" : 20 }
Type "it" for more
MongoDB Enterprise M32_TST_SHARD0:PRIMARY> 
MongoDB Enterprise M32_TST_SHARD0:PRIMARY> 
MongoDB Enterprise M32_TST_SHARD0:PRIMARY> 
MongoDB Enterprise M32_TST_SHARD0:PRIMARY> db.a.find({a:1})
Error: error: {
	"waitedMS" : NumberLong(0),
	"ok" : 0,
	"errmsg" : "error processing query: ns=test.aTree: a == 1.0\nSort: {}\nProj: {}\n No query solutions",
	"code" : 2
}
MongoDB Enterprise M32_TST_SHARD0:PRIMARY> 
MongoDB Enterprise M32_TST_SHARD0:PRIMARY> 
MongoDB Enterprise M32_TST_SHARD0:PRIMARY> db.a.find().explain()
{
	"waitedMS" : NumberLong(0),
	"queryPlanner" : {
		"plannerVersion" : 1,
		"namespace" : "test.a",
		"indexFilterSet" : false,
		"parsedQuery" : {
			"$and" : [ ]
		},
		"winningPlan" : {
			"stage" : "COLLSCAN",
			"filter" : {
				"$and" : [ ]
			},
			"direction" : "forward"
		},
		"rejectedPlans" : [ ]
	},
	"serverInfo" : {
		"host" : "bmx10201",
		"port" : 30001,
		"version" : "3.2.0-rc0",
		"gitVersion" : "bf28bd20fa507c4d8cc5919dfbbe87b7750ae8b0"
	},
	"ok" : 1
}
MongoDB Enterprise M32_TST_SHARD0:PRIMARY> 

Participants:

 Description   

Notablescan is omitted when there is no query specified for find or remove



 Comments   
Comment by David Storch [ 05/Nov/15 ]

Hi atozser,

Thanks for filing this issue. I have identified this as a duplicate of SERVER-2222, and will be closing the ticket as such. Note that commit 417ba0f0ce30e intentionally introduced this behavior in 2009 in development version 1.7. Although this is long-standing behavior of the --notablescan option, SERVER-2222 is also a long-standing open proposal to change the behavior. Specifically, the proposal is to eliminate the special case of allowing a COLLSCAN plan when there is no query predicate, even if the --notablescan flag is set.

Let me know if you have any further questions.

Best,
Dave

Comment by Ramon Fernandez Marina [ 05/Nov/15 ]

This behavior is present in all the latest stable releases as well (2.4.14, 2.6.11, 3.0.7), so I wonder if it's by design.

Generated at Thu Feb 08 03:56:55 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.