Uploaded image for project: 'CouchDB'
  1. CouchDB
  2. COUCHDB-1398

improve view filtering in changes

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 1.3, 2.0.0
    • None
    • View Server Support
    • Committers Level (Medium to Hard)

    Description

      Improve the native view filter `_view` support by really using view index. This patches add following features

      • small refactoring: create the couch_httpd_changes modules, to put all the changes http support in its own module instead having it in couch_httpd_db.
      • add the `view_updated` event when a view index is updated : {view_updated,
        Unknown macro: {DbName, IndexName}

        }

      • start the feed using results in the view index instead of all the db index
      • only react on view index changes.

      For now next changes are still get using the couch_db:changes_since function and passing the map function to the results. It could be improved if we had a by_seq btree in the view index too. Other way may be to skip a number of the documents already processed. Not sure it would be faster. Thoughts ?

      The branch couch_view_changes in my repo contains preliminary support:

      https://github.com/benoitc/couchdb/tree/couch_view_changes

      Diff:
      https://github.com/benoitc/couchdb/compare/master...couch_view_changes

      To use it, use the native filter named _view which take the parameter view=DesignName/Viewname

      eg:

      http://server/db/_changes?feed=continuous&heartbeat=true&filter=_view&view=DesignName/SomeView

      It has also an interresting side effect: on each db updates the view index refresh is triggered so view updates are triggered. Maybe we could introduce an optionnal parameter to not trigger them though?

      Attachments

        1. 0001-white-spaces.patch
          1.0 kB
          Benoit Chesneau
        2. 0002-initial-step-move-the-code-from-couch_httpd_db-to-co.patch
          11 kB
          Benoit Chesneau
        3. 0003-fix-indent.patch
          0.9 kB
          Benoit Chesneau
        4. 0004-This-wrapper-is-useless-somehow-split-the-code-in-a-.patch
          3 kB
          Benoit Chesneau
        5. 0005-add-view_updated-event.patch
          1 kB
          Benoit Chesneau
        6. 0006-immprove-view-filter.patch
          10 kB
          Benoit Chesneau
        7. 0007-useless-info.patch
          0.8 kB
          Benoit Chesneau
        8. 0008-whitespaces.patch
          2 kB
          Benoit Chesneau
        9. 0009-handle-native-filters-in-views.patch
          2 kB
          Benoit Chesneau

        Activity

          People

            Unassigned Unassigned
            benoitc Benoit Chesneau
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: