Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-12820

copydb fails via mongos

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.6.0-rc2
    • Affects Version/s: 2.6.0-rc0
    • Component/s: Sharding
    • None
    • Major Change
    • ALL
    • Hide

      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.

      Show
      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.
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

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

            Assignee:
            sverch Shaun Verch (Inactive)
            Reporter:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: