[SERVER-4651] incorrect options getting passed by sharded explain() Created: 09/Jan/12  Updated: 11/Jul/16  Resolved: 19/Nov/12

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 2.0.1
Fix Version/s: 2.2.0

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

Issue Links:
Related
related to SERVER-4605 explain() needs to better handle vers... Closed
Operating System: ALL
Participants:

 Description   

Seems as if the mongos explain() options handling for batchSize is incorrect - TailableCursor option seems to be set instead.

https://groups.google.com/group/mongodb-user/browse_thread/thread/160c672605614b5e

MongoDB shell version: 2.0.1
connecting to: localhost:27018/offerStore
mongos> db.offer.count({shopId: 205640});
166031
mongos> var count = 0;
mongos> var cursor = db.offer.find({shopId: 205640}).batchSize(1000);
mongos> while(cursor.hasNext()){cursor.next(); count++;}
2317
mongos> db.offer.find({shopId: 205640}).batchSize(1000).explain()
Mon Jan  9 14:46:09 uncaught exception: error: {
        "$err" : "could not initialize cursor across all shards because : no
ts field in query @ offerStoreDE2/s197:27018,s209:27018,s198:27018 ::
and :: no ts field in query @ offerStoreDE3/
s117:27018,s129:27018,s118:27018 :: and :: no ts field in query @
offerstore/s142:27018,s144:27018,s143:27018",
        "code" : 14827
}
 
mongos> db.offer.count({shopId: 205640});
166031
 
Here are the router logs (level 6):
http://pastebin.com/raw.php?i=UbUBdTqf 



 Comments   
Comment by Kay Agahd [ 19/Nov/12 ]

I confirm, updating to 2.2.0 seems to solve the issue.
I just replayed the session and it worked as expected:

mongos> db.offer.count({shopId: 205640})
131032
mongos> var count = 0;
mongos> var cursor = db.offer.find({shopId: 205640}).batchSize(1000);
mongos> while(cursor.hasNext()){cursor.next(); count++;}
131031
mongos> db.offer.find({shopId: 205640}).batchSize(1000).explain()
{
	"clusteredType" : "ParallelSort",
	"shards" : {
		"offerStoreDE2/s127:27018,s131:27018,s136:27018" : [
			{
				"cursor" : "BtreeCursor shopId_1_merchantId_1",
				"isMultiKey" : false,
				"n" : 50699,
				"nscannedObjects" : 50699,
				"nscanned" : 50699,
				"nscannedObjectsAllPlans" : 50699,
				"nscannedAllPlans" : 50699,
				"scanAndOrder" : false,
				"indexOnly" : false,
				"nYields" : 217,
				"nChunkSkips" : 0,
				"millis" : 480,
				"indexBounds" : {
					"shopId" : [
						[
							205640,
							205640
						]
					],
					"merchantId" : [
						[
							{
								"$minElement" : 1
							},
							{
								"$maxElement" : 1
							}
						]
					]
				},
				"server" : "s136:27018"
			}
		],
		"offerStoreDE3/s117:27018,s124:27018,s129:27018" : [
			{
				"cursor" : "BtreeCursor shopId_1_merchantId_1",
				"isMultiKey" : false,
				"n" : 77002,
				"nscannedObjects" : 77002,
				"nscanned" : 77002,
				"nscannedObjectsAllPlans" : 77002,
				"nscannedAllPlans" : 77002,
				"scanAndOrder" : false,
				"indexOnly" : false,
				"nYields" : 596,
				"nChunkSkips" : 0,
				"millis" : 422,
				"indexBounds" : {
					"shopId" : [
						[
							205640,
							205640
						]
					],
					"merchantId" : [
						[
							{
								"$minElement" : 1
							},
							{
								"$maxElement" : 1
							}
						]
					]
				},
				"server" : "s129:27018"
			}
		],
		"offerStoreDE4/s115:27018,s125:27018,s132:27018" : [
			{
				"cursor" : "BtreeCursor shopId_1_merchantId_1",
				"isMultiKey" : false,
				"n" : 3331,
				"nscannedObjects" : 3331,
				"nscanned" : 3331,
				"nscannedObjectsAllPlans" : 3331,
				"nscannedAllPlans" : 3331,
				"scanAndOrder" : false,
				"indexOnly" : false,
				"nYields" : 17,
				"nChunkSkips" : 0,
				"millis" : 40,
				"indexBounds" : {
					"shopId" : [
						[
							205640,
							205640
						]
					],
					"merchantId" : [
						[
							{
								"$minElement" : 1
							},
							{
								"$maxElement" : 1
							}
						]
					]
				},
				"server" : "s125:27018"
			}
		]
	},
	"cursor" : "BtreeCursor shopId_1_merchantId_1",
	"n" : 131032,
	"nChunkSkips" : 0,
	"nYields" : 830,
	"nscanned" : 131032,
	"nscannedAllPlans" : 131032,
	"nscannedObjects" : 131032,
	"nscannedObjectsAllPlans" : 131032,
	"millisShardTotal" : 942,
	"millisShardAvg" : 314,
	"numQueries" : 3,
	"numShards" : 3,
	"millis" : 484
}

Comment by Daniel Pasette (Inactive) [ 19/Nov/12 ]

Could not reproduce, but reporter in the GG thread said that upgrading to 2.2.0 fixed this issue.

Comment by Greg Studer [ 10/Jan/12 ]

May also be related :

http://www.google.com/url?sa=D&q=http://groups.google.com/group/mongodb-user/browse_thread/thread/6b5f8bb97510707b&usg=AFQjCNFJynIAIB4KfThmFIwg0ckUTyFktg

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