During initial sync, you must apply updates as updates and upserts as upserts, since it is possible that an in-place update will move a document backwards and cause the cloner to miss it. We need to detect this situation on the secondary. However, during normal replication, we need all updates to be upserts. Consider the situation where the oplog is replayed (possibly due to a server crash). If an update and subsequent delete are played and then replyed, the reply will hit an error on the update because the document will not exist. Converting the update to an upsert will allow oplog application to proceed; while it may result in an incomplete document, this document will be deleted soon afterward.
…ouble free on failed yield recovery.
Change the regular expression used to parse the Digest line sent in the HTTP GET headers for authentication so that whitespace following a comma is optional (and can be other than a single space if it appears).
This reverts commit a30fbf1. This change appears to have broken clean shutdown in many cases (presumably because I skip a call to exitCleanly if a shutdown is already in progress).
Stay running while the Windows Service Control Manager makes its various callbacks and return from any callbacks we are in before we exit with ::_exit( EXIT_CLEAN ). This lets the SCM close the pipe itself before we go away, so it doesn't see us "end" it.
…ult system allocator library. Pass --allocator=tcmalloc (default on Linux) or --allocator=system (default elsewhere) to control which allocator is used, and --use-system-tcmalloc to use the system- installed tcmalloc instead of the one in the mongo source tree if you use --allocator=tcmalloc.