[SERVER-15318] copydb should not use exhaust flag when used against mongos Created: 18/Sep/14  Updated: 11/Jul/16  Resolved: 25/Nov/14

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 2.6.4, 2.7.4
Fix Version/s: 2.6.6, 2.8.0-rc2

Type: Bug Priority: Major - P3
Reporter: Bernie Hackett Assignee: Randolph Tan
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-12750 mongos shouldn't accept initial query... Closed
related to SERVER-2627 Mongos should support QueryOption_Exh... Closed
Operating System: ALL
Backport Completed:
Participants:

 Description   

This seems to have crept into 2.7.x. I'm not sure which version yet but it's likely related to SERVER-12750. If so the problem might also exist in 2.6.4.

mongos> use foo
switched to db foo
mongos> db.bar.insert({foo: 'bar'})
WriteResult({ "nInserted" : 1 })
mongos> use admin
switched to db admin
mongos> db.runCommand({copydb: 1, fromdb: 'foo', todb: 'foo1'})
{ "ok" : 1 }
mongos> db.runCommand({copydb: 1, fromdb: 'foo', todb: 'foo2', fromhost: 'localhost:27017'})
{
	"errmsg" : "exception: nextSafe(): { $err: \"the 'exhaust' query option is invalid for mongos queries: foo.bar { query: {}, $snapshot: true }\", code: 18526 }",
	"code" : 13106,
	"ok" : 0
}

Buildinfo:

mongos> db.runCommand('buildInfo')
{
	"version" : "2.7.7-pre-",
	"gitVersion" : "ccacca83853931e2d03c8670c1745dfac515e119 modules: subscription",
	"OpenSSLVersion" : "OpenSSL 1.0.1i 6 Aug 2014",
	"sysInfo" : "Linux devbox 3.16.1-gentoo #1 SMP PREEMPT Thu Aug 14 08:35:28 PDT 2014 x86_64 BOOST_LIB_VERSION=1_49",
	"loaderFlags" : "-fPIC -pthread -Wl,-z,now -rdynamic -Wl,-E",
	"compilerFlags" : "-Wnon-virtual-dtor -Woverloaded-virtual -std=c++11 -fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -pipe -Werror -O3 -Wno-unused-local-typedefs -Wno-unused-function -Wno-deprecated-declarations -Wno-unused-but-set-variable -fno-builtin-memcmp -std=c99",
	"allocator" : "tcmalloc",
	"versionArray" : [
		2,
		7,
		7,
		-100
	],
	"javascriptEngine" : "V8",
	"bits" : 64,
	"debug" : false,
	"maxBsonObjectSize" : 16777216,
	"ok" : 1
}



 Comments   
Comment by Githook User [ 26/Nov/14 ]

Author:

{u'username': u'renctan', u'name': u'Randolph Tan', u'email': u'randolph@10gen.com'}

Message: SERVER-15318 copydb should not use exhaust flag when used against mongos

Fix test for v2.6
Branch: v2.6
https://github.com/mongodb/mongo/commit/b85c4e1ab64c7b99f8c6f3cb70ba2e73004dea96

Comment by Githook User [ 25/Nov/14 ]

Author:

{u'username': u'renctan', u'name': u'Randolph Tan', u'email': u'randolph@10gen.com'}

Message: SERVER-15318 copydb should not use exhaust flag when used against mongos

(cherry picked from commit 8deddb065c6124f31346d5f96efe8734da98d125)

Conflicts:
src/mongo/db/dbcommands_generic.cpp
src/mongo/s/commands_public.cpp
Branch: v2.6
https://github.com/mongodb/mongo/commit/8cbb64b0bc8180079e2247143ae16f8d83bb3a00

Comment by Githook User [ 25/Nov/14 ]

Author:

{u'username': u'renctan', u'name': u'Randolph Tan', u'email': u'randolph@10gen.com'}

Message: SERVER-15318 copydb should not use exhaust flag when used against mongos
Branch: master
https://github.com/mongodb/mongo/commit/8deddb065c6124f31346d5f96efe8734da98d125

Comment by Bernie Hackett [ 18/Sep/14 ]

Confirmed this problem appeared in 2.6.4 and 2.7.4.

mongos> use foo
switched to db foo
mongos> db.bar.insert({foo: 'bar'})
WriteResult({ "nInserted" : 1 })
mongos> use admin
switched to db admin
mongos> db.runCommand({copydb: 1, fromdb: 'foo', todb: 'foo2', fromhost: 'localhost:27017'})
{ "ok" : 1 }
mongos> db.version()
2.6.3
 
mongos> db.runCommand({copydb: 1, fromdb: 'foo', todb: 'foo3', fromhost: 'localhost:27017'})
{
	"errmsg" : "exception: nextSafe(): { $err: \"the 'exhaust' query option is invalid for mongos queries: foo.bar { query: {}, $snapshot: true }\", code: 18526 }",
	"code" : 13106,
	"ok" : 0
}
mongos> db.version()
2.6.4
 
mongos> db.runCommand({copydb: 1, fromdb: 'foo', todb: 'foo4', fromhost: 'localhost:27017'})
{ "ok" : 1 }
mongos> db.version()
2.7.3
 
> db.runCommand({copydb: 1, fromdb: 'foo', todb: 'foo5', fromhost: 'localhost:27017'})
{
	"errmsg" : "exception: nextSafe(): { $err: \"the 'exhaust' query option is invalid for mongos queries: foo.bar { query: {}, $snapshot: true }\", code: 18526 }",
	"code" : 13106,
	"ok" : 0
}
> db.version()
2.7.4

Comment by Bernie Hackett [ 18/Sep/14 ]

The issue here appears to be that "fromhost" in my example is the mongos instance. So mongos is opening an exhaust cursor against itself?

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