Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-20196

Iterator disobeys maxKey after doc deletion

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Blocker
    • 4.5.1, 5.0.0
    • master
    • forestdb
    • None
    • Untriaged
    • MacOSX 64-bit
    • Unknown
    • ForestDB: Oct 17 - Nov 4

    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

          For Gerrit Dashboard: MB-20196
          # Subject Branch Project Status CR V

          Activity

            People

              jens Jens Alfke
              jens Jens Alfke
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty