You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by Marcel Reutegger <mr...@adobe.com> on 2017/05/04 09:45:08 UTC

Sort order in MongoMissingLastRevSeeker

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

Re: Sort order in MongoMissingLastRevSeeker

Posted by Chetan Mehrotra <ch...@gmail.com>.
On Thu, May 4, 2017 at 3:15 PM, Marcel Reutegger <mr...@adobe.com> wrote:
> A can't really think of a reason why the sort order must be descending in
> MongoMissingLastRevSeeker.

I also do not remember. I think it should be fine to drop the sort criteria.

Chetan Mehrotra