[SERVER-7534] mongorestore incorrectly ignores w=1, the default Created: 01/Nov/12  Updated: 26/Oct/15  Resolved: 29/Nov/12

Status: Closed
Project: Core Server
Component/s: Tools
Affects Version/s: None
Fix Version/s: 2.3.2

Type: Bug Priority: Major - P3
Reporter: James Pharaoh Assignee: Shaun Verch
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by DOCS-821 Update default write concern for mong... Closed
Related
is related to SERVER-8472 mongorestore GLE default accidently c... Closed
Operating System: ALL
Participants:

 Description   

Running mongorestore with no --w option, or using a version before it was introduced, works a lot faster than if I introduce --w 2. This feels wrong to me, the default behaviour, as per the docs, is to assume w=1:

http://docs.mongodb.org/manual/reference/mongorestore/

Looking at the source code, I can see that the member variable _w is set to the --w argument, and that it defaults to 1. But the code is ignoring this if the value is one, for example:

// wait for insert to propagate to "w" nodes (doesn't warn if w used without replset)
if ( _w > 1 )

{ conn().getLastErrorDetailed(false, false, _w); }

The check should surely be if (_w > 0), the getLastError command still needs to run if w=1!

The same happens in a few other places in the source code for mongorestore.

I don't have time to play with this much more right now. We could simply fix it but it's going to slow things down. A better option would be to change the default to w=0 and update the documentation.



 Comments   
Comment by auto [ 29/Nov/12 ]

Author:

{u'date': u'2012-11-28T21:50:48Z', u'email': u'shaun.verch@10gen.com', u'name': u'Shaun Verch'}

Message: SERVER-7534 mongorestore set default w=0 and call getLastError for w>0
Branch: master
https://github.com/mongodb/mongo/commit/1c0474f0c088d3c16704331c445f0365fb8ab96c

Comment by Ian Whalen (Inactive) [ 27/Nov/12 ]

the default should be zero and the check should be if w>0.

docs should also be updated.

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