[SERVER-7259] mongodump output to stdout broken Created: 04/Oct/12  Updated: 11/Jul/16  Resolved: 07/Nov/12

Status: Closed
Project: Core Server
Component/s: Tools
Affects Version/s: 2.2.0
Fix Version/s: 2.2.2, 2.3.1

Type: Bug Priority: Major - P3
Reporter: Stephen Lee Assignee: Spencer Brody (Inactive)
Resolution: Done Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Zip Archive migrations.zip    
Issue Links:
Depends
is depended on by TOOLS-24 Write test for mongodump output to st... Closed
Related
is related to TOOLS-153 Add a way to test tools' output to st... Closed
Operating System: ALL
Participants:

 Description   

# mongorestore --port 30001
connected to: 127.0.0.1:30001
Thu Oct  4 14:32:37 dump/test/migrations_2_0_7.bson
Thu Oct  4 14:32:37 	going into namespace [test.migrations_2_0_7]
Thu Oct  4 14:32:37 dump/test/migrations_2_0_7.metadata.json not found. Skipping.
309 objects found
Thu Oct  4 14:32:37 dump/test/migrations_2_2_0.bson
Thu Oct  4 14:32:37 	going into namespace [test.migrations_2_2_0]
Thu Oct  4 14:32:37 dump/test/migrations_2_2_0.metadata.json not found. Skipping.
assertion: 10264 invalid object size: 544565332

Within the attachment, migrations.zip contains two .bson files: one dumped using mongodump v2.0.7 and the other using mongodump v2.2.0.



 Comments   
Comment by auto [ 07/Nov/12 ]

Author:

{u'date': u'2012-11-06T22:14:02Z', u'email': u'spencer@10gen.com', u'name': u'Spencer T Brody'}

Message: SERVER-7259 Fix mongodump output to stdout by removing log line and making sure stdout is flushed

Conflicts:
src/mongo/tools/tool.cpp
Branch: v2.2
https://github.com/mongodb/mongo/commit/f96289dd395b6030429189ed06687c4be0b54c40

Comment by Spencer Brody (Inactive) [ 07/Nov/12 ]

Fix verified by manual testing. Created SERVER-7584 and SERVER-7585 for making sure this gets an automated test.

Comment by auto [ 07/Nov/12 ]

Author:

{u'date': u'2012-11-06T22:14:02Z', u'email': u'spencer@10gen.com', u'name': u'Spencer T Brody'}

Message: SERVER-7259 Fix mongodump output to stdout by removing log line and making sure stdout is flushed
Branch: master
https://github.com/mongodb/mongo/commit/614722b43ff61edfa7d17085d8b0711d32dded31

Comment by Spencer Brody (Inactive) [ 23/Oct/12 ]

I have reproduced the issue.
I suspect the problem to be due to the log() statement "doing snapshot query" which gets outputted to stdout and corrupts the BSON output being sent to stdout when running with "-o -".

Comment by Stephen Lee [ 23/Oct/12 ]

Steps to reproduce:

  1. mongorestore dump/test/migrations_2_0_7.bson (to either a v2.0.7 or v2.2.0 mongod)
  2. mongodump -d <DB> -c 'migrations_2_0_7' -o - > migrations_2_0_7.bson (using the v2.0.7 mongodump)
  3. mongodump -d <DB> -c 'migrations_2_0_7' -o - > migrations_2_2_0.bson (using the v2.2.0 mongodump)
  4. Try either mongorestore or bsondump on migrations_2_0_7.bson (should work for either v2.0.7 or v2.2.0)
  5. Try either mongorestore or bsondump on migrations_2_0_7.bson (should NOT work for either v2.0.7 or v2.2.0)

I believe the bug is in v2.2.0 mongodump's output to STDOUT because mongodump v2.2.0 seems to work fine if used w/o -o, hence standard "dump" subdirectory, or -o <SUBDIR_NAMED_SOMETHING_OTHER_THAN_DUMP>.

Comment by Spencer Brody (Inactive) [ 22/Oct/12 ]

Can you try re-running the mongodump with 2.2 and attach the output of the mongodump process along with the mongod logs from the server being dumped?

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