Uploaded image for project: 'MongoDB Database Tools'
  1. MongoDB Database Tools
  2. TOOLS-7

mongodump through mongos won't dump collections not on primary shard

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.0.0
    • Affects Version/s: Legacy C++ Implementation
    • Component/s: mongodump
    • Labels:
      None
    • Server Tools 14 (5/13/16), Server Tools 15 (6/3/16), Server Tools 16 (6/24/16)

      Related to SERVER-4232

      If the collection does not live on the primary shard, mongodump won't dump the collection.

      mongos> db.system.namespaces.find()
      { "name" : "test.system.indexes" }
      { "name" : "test.system.profile", "options" : { "capped" : true, "size" : 1048576 } }
      mongos> 
      bye
      $ mongodump --port 27020 -d test -c foo 
      connected to: 127.0.0.1:27020
      Thu Nov  7 10:18:10.875 DATABASE: test	 to 	dump/test
      $ ls -la dump/test/
      total 0
      drwxr-xr-x  2 joannac  staff   68  7 Nov 10:17 .
      drwxr-xr-x  3 joannac  staff  102  7 Nov 10:17 ..
      $ mongodump --port 27020 -d test
      connected to: 127.0.0.1:27020
      Thu Nov  7 10:32:52.016 DATABASE: test	 to 	dump/test
      Thu Nov  7 10:32:52.017 	test.system.indexes to dump/test/system.indexes.bson
      Thu Nov  7 10:32:52.017 		 0 objects
      Thu Nov  7 10:32:52.017 	test.system.profile to dump/test/system.profile.bson
      Thu Nov  7 10:32:52.027 		 1232 objects
      Thu Nov  7 10:32:52.029 	Metadata for test.system.profile to dump/test/system.profile.metadata.json
      

      mongoexport of the collection works:

      $ mongoexport --port 27020 -d test -c foo
      connected to: 127.0.0.1:27020
      { "_id" : { "$oid" : "5279b9e2972221f9a6cf650b" }, "a" : 1 }
      exported 1 records
      

      but mongoexport of the system.indexes doesn't

      $ mongoexport --port 27020 -d test -c system.indexes
      connected to: 127.0.0.1:27020
      exported 0 records
      

      This is now more than just a cosmetic problem (SERVER-4232 was just about show collections not showing the collection)

            Assignee:
            mikeo@mongodb.com Michael O'Brien
            Reporter:
            joanna.cheng@mongodb.com Joanna Cheng
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: