CouchDB
  1. CouchDB
  2. COUCHDB-1065

couch_db_updater calls couch_key_tree incorrectly

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0.3, 1.1, 1.2
    • Component/s: Database Core
    • Labels:
      None
    • Skill Level:
      Regular Contributors Level (Easy to Medium)

      Description

      couch_db_updater at line 123 calls couch_key_tree:map_leafs( fun(RevInfo) -..... incorrectly. The function needs to have two arguments.

      This is readily seen by creating two small dbs with a doc in each having the same id, replicating one to the other and then calling
      _purge

      1. couchdb_1065_v2.patch
        2 kB
        Randall Leeds
      2. couchdb_1065.patch
        2 kB
        Randall Leeds

        Activity

        Hide
        Adam Kocoloski added a comment -

        Wow. So _purge only works when all revisions of a document are purged, right? Otherwise it must crash. Good find Bob.

        Show
        Adam Kocoloski added a comment - Wow. So _purge only works when all revisions of a document are purged, right? Otherwise it must crash. Good find Bob.
        Hide
        Jan Lehnardt added a comment -

        Is there a patch for this?

        Show
        Jan Lehnardt added a comment - Is there a patch for this?
        Hide
        Jan Lehnardt added a comment -

        http://friendpaste.com/4pVKqLvWQEl7PJIZ9EXDMe tests the behaviour, trying to purge either rev causes a 500, purging both works.

        Show
        Jan Lehnardt added a comment - http://friendpaste.com/4pVKqLvWQEl7PJIZ9EXDMe tests the behaviour, trying to purge either rev causes a 500, purging both works.
        Hide
        Randall Leeds added a comment -

        Here's a patch which includes the tests posted by Jan.

        The fun passed to map_leafs/2 was taking the wrong parameters and also expecting #rev_info records as they are in the by_seq_btree but the key tree being mapped here is the by_id_btree whose rev_tree values are just a tuple

        {IsDeleted, BodyPointer, UpdateSeq}

        .

        Show
        Randall Leeds added a comment - Here's a patch which includes the tests posted by Jan. The fun passed to map_leafs/2 was taking the wrong parameters and also expecting #rev_info records as they are in the by_seq_btree but the key tree being mapped here is the by_id_btree whose rev_tree values are just a tuple {IsDeleted, BodyPointer, UpdateSeq} .
        Hide
        Randall Leeds added a comment -

        Whoops. Another version that doesn't introduce an unused variable.

        Show
        Randall Leeds added a comment - Whoops. Another version that doesn't introduce an unused variable.
        Hide
        Jan Lehnardt added a comment -

        Applied, thanks.

        Show
        Jan Lehnardt added a comment - Applied, thanks.

          People

          • Assignee:
            Unassigned
            Reporter:
            Bob Dionne
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development