Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: HTTP Interface
    • Labels:
      None
    • Skill Level:
      Committers Level (Medium to Hard)

      Description

      Add a global version of _changes to allow monitoring of changes to all databases. It does not need to include details of the change as clients of this interface must track update sequences for each database anyway.

      1. db_changes4.patch
        10 kB
        Benoit Chesneau
      2. db_changes3.patch
        9 kB
        Benoit Chesneau
      3. db_changes2.patch
        9 kB
        Benoit Chesneau
      4. db_changes.patch
        5 kB
        Benoit Chesneau
      5. global_changes.patch
        2 kB
        Robert Newson
      6. global_changes.patch
        1 kB
        Robert Newson

        Issue Links

          Activity

          Hide
          Nick Wood added a comment -

          Thanks! I ended up using an update notification. Working great.

          Show
          Nick Wood added a comment - Thanks! I ended up using an update notification. Working great.
          Hide
          Benoit Chesneau added a comment -
          Show
          Benoit Chesneau added a comment - Nick Wood would that works for you : https://github.com/refuge/couch_dbupdates ?
          Hide
          Robert Newson added a comment -

          Yes, register for the db_updated notification. When you get one, open the changes feed to that database, emit the changes since the last time, close it, rinse, repeat.

          Show
          Robert Newson added a comment - Yes, register for the db_updated notification. When you get one, open the changes feed to that database, emit the changes since the last time, close it, rinse, repeat.
          Hide
          Nick Wood added a comment -

          Just tried getting this patch to work on 1.2.1 and am in a little over my head. Is there a better way to accomplish change notifications across all databases without having to monitor multiple (thousands) of _changes feeds?

          Show
          Nick Wood added a comment - Just tried getting this patch to work on 1.2.1 and am in a little over my head. Is there a better way to accomplish change notifications across all databases without having to monitor multiple (thousands) of _changes feeds?
          Hide
          Chris Stockton added a comment -

          Any plans for implementing this in the near future?

          Show
          Chris Stockton added a comment - Any plans for implementing this in the near future?
          Hide
          Timothy Smith added a comment -

          I agree with Benoit; I have a use case that would benefit a lot from notifications for db creation and deletion.

          Show
          Timothy Smith added a comment - I agree with Benoit; I have a use case that would benefit a lot from notifications for db creation and deletion.
          Hide
          Benoit Chesneau added a comment -

          I woud like to refresh this ticket.

          It's useful sometimes to have global db changes (db created, deleted) for external apps without using intenal update notififier and also more powerfull than diffing _all_dbs results. Ex of usages :

          • monitoring dbs (and add db monitored on the fly)
          • start replication on creation
            ...

          Anything against ?

          Show
          Benoit Chesneau added a comment - I woud like to refresh this ticket. It's useful sometimes to have global db changes (db created, deleted) for external apps without using intenal update notififier and also more powerfull than diffing _all_dbs results. Ex of usages : monitoring dbs (and add db monitored on the fly) start replication on creation ... Anything against ?
          Hide
          Benoit Chesneau added a comment -

          I forgot to handle deleted event. This patch add support for this. Also we make sure we get all events notified.

          Show
          Benoit Chesneau added a comment - I forgot to handle deleted event. This patch add support for this. Also we make sure we get all events notified.
          Hide
          Benoit Chesneau added a comment -

          following jan suggestion renamed keep_sending_changes to keep_sending_dbs_changes to avoid confusion with couch_httpd_db:keep_sending_changes. Also removed 2 useless debug messages.

          Show
          Benoit Chesneau added a comment - following jan suggestion renamed keep_sending_changes to keep_sending_dbs_changes to avoid confusion with couch_httpd_db:keep_sending_changes. Also removed 2 useless debug messages.
          Hide
          Benoit Chesneau added a comment -

          updated patch with tests and fix for line changes (prepend by "\n" when needed).

          Show
          Benoit Chesneau added a comment - updated patch with tests and fix for line changes (prepend by "\n" when needed).
          Hide
          Benoit Chesneau added a comment -

          new patch for global change handler. It manage longpolling and continuous (set feed=continuous, default is longpoll).

          Each change send a line

          {"type": "typeofchange", "db": "nameof db", "seq": "updated seq in db"}

          you could also do jsonp.

          Show
          Benoit Chesneau added a comment - new patch for global change handler. It manage longpolling and continuous (set feed=continuous, default is longpoll). Each change send a line {"type": "typeofchange", "db": "nameof db", "seq": "updated seq in db"} you could also do jsonp.
          Hide
          Robert Newson added a comment -


          Updated patch, never exits but does send type and db.

          Show
          Robert Newson added a comment - Updated patch, never exits but does send type and db.
          Hide
          eric casteleijn added a comment - - edited

          I would really like to have a global _changes feed, as I anticipate having a lot of databases to deal with in a similar manner. One question though: Is it impossible, or inefficient to include more details of the changes? I would really like to at least optionally have the same information available as the per db _changes feed exposes.

          Show
          eric casteleijn added a comment - - edited I would really like to have a global _changes feed, as I anticipate having a lot of databases to deal with in a similar manner. One question though: Is it impossible, or inefficient to include more details of the changes? I would really like to at least optionally have the same information available as the per db _changes feed exposes.
          Hide
          Robert Newson added a comment -

          Hook it up with;

          [httpd_global_handlers]
          _changes =

          {couch_httpd_misc_handlers, handle_changes_req}
          Show
          Robert Newson added a comment - Hook it up with; [httpd_global_handlers] _changes = {couch_httpd_misc_handlers, handle_changes_req}
          Hide
          Robert Newson added a comment -

          Write a JSON line whenever a database changes as;

          {"db":"DB_NAME"}
          Show
          Robert Newson added a comment - Write a JSON line whenever a database changes as; {"db":"DB_NAME"}

            People

            • Assignee:
              Unassigned
              Reporter:
              Robert Newson
            • Votes:
              4 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development