Hi,

I recently noticed the sort order in MongoMissingLastRevSeeker on _modified. The query sorts descending. I think this may be a problem given the isolation guarantees provides by MongoDB. See also discussion in OAK-4535.

In particular, I'm thinking of the following behaviour mentioned in the MongoDB documentation: "Reads may miss matching documents that are updated during the course of the read operation."

This happens when a query scans an index and a matching document is concurrently updated and moves from the front of the cursor to the part of the index that was already scanned. In this case MongoDB will not return the document even if it matched the query before and after the update.

Given the query in MongoMissingLastRevSeeker, it is quite likely MongoDB will scan the _modified index from (currently) newest to specified startTime. While doing this, a document may get updated, its index entry jumps over the cursor and becomes the newest entry in the index.

A can't really think of a reason why the sort order must be descending in MongoMissingLastRevSeeker. The base class doesn't specify a specific order.

Does anyone remember why this sort order is in place?

Regards
 Marcel

Reply via email to