-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
mongoimport and mongorestore both support the --stopOnError (SOE) and --maintainInsertionOrder (MIO) options. In both tools, their behavior is inconsistent.
In mongorestore:
- SOE behaves as expected
- MIO is almost entirely ignored (it limits the number of goroutines streaming the input documents, but they're actually sent to the server in an unordered bulk write)
In mongoimport:
- see this doc for an overview of all the behavior
These tools should be fixed to have consistent and expected behavior when using these options, even in combination.
A proposal: SOE and MIO should both result in an ordered bulk write. If a write error occurs when one of them is specified, we MUST return a non-zero exit code if SOE is specified. We may want to return 0 if only MIO is specified, however.
Another option: implement MIO as a series of single inserts (or ordered bulk inserts), stopping on error iff SOE is specified. This would decouple the not-so-apparent relationship between the two options but also result in many more round trips to the server.
In either case, MIO does differ from SOE in that it needs to limit the number of workers consuming the input to guarantee order. I don't think SOE needs to guarantee order of consumption, but it does need to use ordered bulk writes for error reporting purposes.
- depends on
-
TOOLS-2251 Technical Design: handling stopOnError and maintainInsertionOrder options
- Closed
- is duplicated by
-
TOOLS-2010 mongoimport may report incorrect number of imported documents
- Closed
-
TOOLS-2270 Implement "Handling stopOnError and maintainInsertionOrder options" design
- Closed
-
TOOLS-1111 set Unordered() on bulk writes when --continueOnError is set and --maintainInsertionOrder is not set.
- Closed
- is related to
-
TOOLS-2111 mongorestore should retry insert commands in the face of network errors
- Closed
- related to
-
TOOLS-2296 mongoimport reports documents imported despite failure with authorization error
- Closed