Details
Description
During Couchbase Lite testing today we found a regression where the ToDoLite app displays incorrect items in a list after deleting an item. (https://github.com/couchbase/couchbase-lite-ios/issues/1370). I've tracked the cause to a bug in fdb_iterator, where it returns a document that's outside the requested key range.
To reproduce:
1. Check out couchbase-lite-ios, branch "fix/iterator_fail_1370"
2. Run unit test -[ViewTests test25_ToDoLiteTaskListQuery]
3. Test will log warnings and fail.
In ForestDB terms, the steps to reproduce are something like:
1. Create documents with keys A, B
2. Create an iterator with minKey=B, maxKey=Bzz
3. Call fdb_iterator_seek_to_max
4. Call fdb_iterator_get
--> Correctly returns doc B
5. Delete doc B
6. Repeat steps 2-4
--> Incorrectly returns doc A; I expected fdb_iterator_get to return FDB_RESULT_ITERATOR_FAIL since there is nothing to enumerate
(I haven't verified that a test this simple using only ForestDB APIs would reproduce the issue. The Couchbase Lite test uses higher level APIs but should result in ForestDB calls similar to these.)
Attachments
Issue Links
- blocks
-
MB-19612 4.5.1 Minor Release
- Closed
For Gerrit Dashboard: MB-20196 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
65974,6 | MB-20196: Validate iterator seek range for deleted keys | master | forestdb | Status: MERGED | +2 | +1 |
65977,1 | [BP] MB-20196: Validate iterator seek range for deleted keys | stable | forestdb | Status: ABANDONED | 0 | 0 |
65978,2 | [BP] MB-20196: Validate iterator seek range for deleted keys | watson | forestdb | Status: MERGED | +2 | +1 |
65984,2 | Merge remote-tracking branch 'couchbase/watson' into stable | stable | forestdb | Status: MERGED | +2 | +1 |