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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: Legacy C++ Implementation
    • Fix Version/s: 3.0.0
    • Component/s: mongodump
    • Labels:
      None

      Description

      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)

        Attachments

          Activity

            People

            • Assignee:
              mpobrien Michael O'Brien
              Reporter:
              joanna.cheng Joanna Cheng
            • Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: