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 )
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.
- is related to
-
SERVER-8472 mongorestore GLE default accidently changed from fire-and-forget to w:1
- Closed