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

mongodump dumps a collection with capped in metadata when it's not (anymore)

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.2.2
    • Component/s: None
    • None
    • Environment:
      Linux 2.6.32-279.14.1.el6.x86_64 #1 SMP
    • Fully Compatible
    • ALL
    • Hide

      Simple instructions:

      # mongo
      MongoDB shell version: 2.2.2
      connecting to: test
      > db.createCollection('test', { capped: true, size: 100000 });
      { "ok" : 1 }
      > db.test.isCapped()
      true
      
      # mongodump --db test -c test
      connected to: 127.0.0.1
      Wed Jan 30 12:44:26 DATABASE: test	 to 	dump/test
      Wed Jan 30 12:44:26 	test.test to dump/test/test.bson
      Wed Jan 30 12:44:26 		 0 objects
      Wed Jan 30 12:44:26 	Metadata for test.test to dump/test/test.metadata.json
      
      # cat dump/test/test.metadata.json 
      { "options" : { "create" : "test", "capped" : true, "size" : 100000 }, "indexes" : [ { "v" : 1, "key" : { "_id" : 1 }, "ns" : "test.test", "name" : "_id_" } ] }
      
      # mongo
      MongoDB shell version: 2.2.2
      connecting to: test
      > db.test.drop()
      true
      > db.createCollection('test')
      { "ok" : 1 }
      > db.test.isCapped()
      false
      
      # rm -rf dump
      # mongodump --db test -c test
      connected to: 127.0.0.1
      Wed Jan 30 12:45:33 DATABASE: test	 to 	dump/test
      Wed Jan 30 12:45:33 	test.test to dump/test/test.bson
      Wed Jan 30 12:45:33 		 0 objects
      Wed Jan 30 12:45:33 	Metadata for test.test to dump/test/test.metadata.json
      
      # cat dump/test/test.metadata.json 
      { "options" : { "create" : "test", "capped" : { "$undefined" : true }, "size" : { "$undefined" : true } }, "indexes" : [ { "v" : 1, "key" : { "_id" : 1 }, "ns" : "test.test", "name" : "_id_" } ] }
      
      Show
      Simple instructions: # mongo MongoDB shell version: 2.2.2 connecting to: test > db.createCollection( 'test' , { capped: true , size: 100000 }); { "ok" : 1 } > db.test.isCapped() true # mongodump --db test -c test connected to: 127.0.0.1 Wed Jan 30 12:44:26 DATABASE: test to dump/test Wed Jan 30 12:44:26 test.test to dump/test/test.bson Wed Jan 30 12:44:26 0 objects Wed Jan 30 12:44:26 Metadata for test.test to dump/test/test.metadata.json # cat dump/test/test.metadata.json { "options" : { "create" : "test" , "capped" : true , "size" : 100000 }, "indexes" : [ { "v" : 1, "key" : { "_id" : 1 }, "ns" : "test.test" , "name" : "_id_" } ] } # mongo MongoDB shell version: 2.2.2 connecting to: test > db.test.drop() true > db.createCollection( 'test' ) { "ok" : 1 } > db.test.isCapped() false # rm -rf dump # mongodump --db test -c test connected to: 127.0.0.1 Wed Jan 30 12:45:33 DATABASE: test to dump/test Wed Jan 30 12:45:33 test.test to dump/test/test.bson Wed Jan 30 12:45:33 0 objects Wed Jan 30 12:45:33 Metadata for test.test to dump/test/test.metadata.json # cat dump/test/test.metadata.json { "options" : { "create" : "test" , "capped" : { "$undefined" : true }, "size" : { "$undefined" : true } }, "indexes" : [ { "v" : 1, "key" : { "_id" : 1 }, "ns" : "test.test" , "name" : "_id_" } ] }

      Mongodump seems to dump a collection with capped metadata in collection.metadata.json. The collection was previously capped, but was dropped and recreated as uncapped. This will cause an error when mongorestoring the collection.

            Assignee:
            Unassigned Unassigned
            Reporter:
            rosmo Taneli Leppä
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: