-
Type: Improvement
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Querying
-
None
-
QuInt E (01/11/16)
"Snapshot" queries (queries using a unique index) can miss records if there are concurrent updates that move the records being queried (even if they don't modify the query keys). It would be useful if this could be improved so that snapshot queries were guaranteed to return all records that existed for the lifetime of the query (neither inserted nor deleted during the query).
Reproduce as follows:
function repro() { // insert 5 records db.c.drop() for (var i=0; i<5; i++) db.c.insert({_id:i, x:[]}) // start query, fetch first batch of 2 cursor = db.c.find().snapshot().batchSize(2) print('got', cursor.next()._id) // server cursor is now pointing to {_id:2} waiting for our getmore // so let's update in a way that requires the {_id:2} record to move db.c.update({_id:2}, {$push: {x:0}}) // use our cursor to get the rest; note that {_id:2} is omitted while (cursor.hasNext()) print('got', cursor.next()._id) }
- duplicates
-
SERVER-17635 Improve SortedDataInterface::Cursor API
- Closed
- is duplicated by
-
SERVER-17174 Updates can fail to find document during high concurrency
- Closed
- is related to
-
SERVER-14766 Indexed queries should not miss documents where neither the queried nor indexed fields change during the life of the query.
- Closed
-
SERVER-21403 $snapshot can return duplicates on 3.2 in the case of an MMAPv1 document move
- Closed
-
SERVER-13992 UpdateTicket should handle record moves
- Closed
-
SERVER-700 Overwrite index key rather than delete/reinsert if new value would end up in the same place
- Closed
- related to
-
TOOLS-9 mongodump --forceTableScan --oplog needs to handle docs moving backwards
- Closed
-
DRIVERS-180 Docs and driver API refs inconsistent on $snapshot
- Closed