[SERVER-12820] copydb fails via mongos Created: 21/Feb/14  Updated: 11/Jul/16  Resolved: 11/Mar/14

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 2.6.0-rc0
Fix Version/s: 2.6.0-rc2

Type: Bug Priority: Major - P3
Reporter: A. Jesse Jiryu Davis Assignee: Shaun Verch
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Major Change
Operating System: ALL
Steps To Reproduce:

Set up a sharded cluster of two replica sets, and call copydb on mongos:

var rsOpts = { oplogSize: 10 };
var st = new ShardingTest({shards : 1,
                           mongos : 1,
                           rs: rsOpts,
                           verbose : 0});
 
var mongos = st.s;
var test1 = mongos.getDB('test1');
var test2 = mongos.getDB('test2');
 
test1.getCollection('test').insert({foo: 'bar'});
jsTestLog('Test document on source db:');
printjson(test1.getCollection('test').findOne());
jsTestLog('copydb');
var result = mongos.getDB('admin').copyDatabase('test1', 'test2');
printjson(result);
assert.eq(result.ok, 1.0);
jsTestLog('Test document on destination db:');
printjson(test2.getCollection('test').findOne());

With mongod 2.4.9, the database is copied and copydb returns "ok": 1. With mongod
2.6.0-rc0 / hash 3779bf41, we get:

{
	"ok" : 0,
	"errmsg" : "couldn't connect to server shard1/localhost:4002,localhost:4003 (shard1/localhost:4002,localhost), connection attempt failed",
	"$gleStats" : {
		"lastOpTime" : Timestamp(0, 0),
		"electionId" : ObjectId("530758b3c9aea15f7b4c58bb")
	}
}

The fault seems to be mongod's, since copydb works with old
mongod and new mongos. copydb always works if the shards aren't replica sets.

Participants:

 Description   

"copydb" from mongos fails if the shards are replica sets running latest mongod.



 Comments   
Comment by Githook User [ 11/Mar/14 ]

Author:

{u'username': u'Zarkantho', u'name': u'Shaun Verch', u'email': u'shaun.verch@10gen.com'}

Message: SERVER-12820 Added jstest for various possible copydb command uses
Branch: master
https://github.com/mongodb/mongo/commit/6816eddd30a0015f1eadb1bb48dff2f10cac187c

Comment by Githook User [ 11/Mar/14 ]

Author:

{u'username': u'Zarkantho', u'name': u'Shaun Verch', u'email': u'shaun.verch@10gen.com'}

Message: SERVER-12820 Parse connection string to handle replica set connections in copydb command
Branch: master
https://github.com/mongodb/mongo/commit/8ff46a852e18f41161a0061d3dd810fd2468d535

Comment by Githook User [ 05/Mar/14 ]

Author:

{u'username': u'monkey101', u'name': u'Dan Pasette', u'email': u'dan@10gen.com'}

Message: Revert "SERVER-12820 Parse connection string to handle replica set connections in copydb command"

This reverts commit db6f4c6227581996ecba987be21912ed0824592c.
Branch: master
https://github.com/mongodb/mongo/commit/52fbcfdd6d40b5d53210a11fa3e2596a34c84fe7

Comment by Githook User [ 04/Mar/14 ]

Author:

{u'username': u'Zarkantho', u'name': u'Shaun Verch', u'email': u'shaun.verch@10gen.com'}

Message: SERVER-12820 Parse connection string to handle replica set connections in copydb command
Branch: master
https://github.com/mongodb/mongo/commit/db6f4c6227581996ecba987be21912ed0824592c

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