Skip to content

Changefeed redundancy #2953

Closed
Closed

Description

@dminkovsky

I'm in the process of using r.changes() to implement some important functionality in my app. My problem is that I'm seeing a single point of failure here. If the process that's reading a changefeed fails and disconnects from Rethink, further changes will be discarded until the process comes back up (it is my understanding the Rethink only buffers changes internally while a process is connected and tailing that buffer).

Are there plans to address this issue in the design of changefeeds? Am I looking at something incorrectly?

Thank you.

Activity

  1. deontologician commented on Aug 24, 2014

    @deontologician
    Contributor

    I talked with @coffeemug about this while working with some of the mq stuff. It seems like it'd be nice to have a way to name the changefeeds and have their buffers persist on the server. One of the difficulties that would need to be solved is that the buffers are held on the query server you connected to previously. So if you happened to connect to another query server the second time, there's no way to get at the buffered changes.

    From what I recall, this is "something that feels like it needs to happen", but there are some technical aspects that need to be thought out for it to work in a clustered environment.

  2. neumino commented on Aug 25, 2014

    @neumino
    Member

    @dminkovsky -- what's the use case behind your question?
    In case your app fail, can you reset the state of what you are looking for?

    For example, suppose that you want to show the last 10 messages, you can do in JavaScript:

    var messages = [];
    r.table("messages").orderBy({index: r.desc("time")}).limit(10).run(conn).then(function(result) {
       messages = result;
       var feed = r.table("messages").changes().run(conn)
       feed.each(function(change) {
          messages.shift();
          messages.push(change.new_val);
          // broadcast messages
       })
    })
    

    So you can kill your app and restart it, and messages will still contain what you want.

  3. dminkovsky commented on Aug 25, 2014

    @dminkovsky
    Author

    Hi @neumino. I am using changefeeds for several things:

    • I am listening to content changes so I can push them to Elasticsearch. My content is rather normalized in Rethink, so change-listening process denormalizes that content into a representation useful for text indexing and querying, and ships off to ES.
    • I am also listening to content changes in order to generate activity feeds. Again, this has to do with the querying the data set in Rethink in its normalized form. I need a denormalized intermediate representation of the user-relevant changes as a step between data and activity feed.
    • And finally, the kicker: change events seem like a good time for certain cache invalidation.

    Thanks for the example above. I can't see that practically working out for me though. Having to depend on that kind of backtracking in the event of missed/lost change events severely limits the type of problems to which I can apply changefeeds.

    Basically, take my three use cases above and let the first be least mission critical and the third most mission critical. To the first, least mission-critical I could apply the backtrack heuristic to impute missed changes. This is particularly simple because pushing data to ES is practically idempotent.

    For the second and third use case, though, I would be much more reluctant to apply any sort of forensic/heuristic approach to backtrack a set of missed changes. Just this weekend, for example, my phone and tablet were lit up for hours with weeks old Twitter notifications being replayed in duplicate and even triplicate. I eventually disabled notifications. It was really annoying and I wouldn't want to do that to my users. At least not, potentially, systemically.

    The named changefeeds mentioned by @deontologician above and, I think, @mlucy on IRC would be one solution. My main purpose here, though, is to kick off or formalize an existing discussion because I've been thinking about this issue for quite some time, and have begun implementing with changefeeds. But this whole time I'm still thinking, "and what if this process goes down..."?

  4. added this to the subsequent milestone on Aug 25, 2014
  5. coffeemug commented on Aug 25, 2014

    @coffeemug
    Contributor

    We discussed the API for this a little bit, and the way to implement this is to send an opaque token for a change back to the client. The client can then pass the token back to the server and get all the changes that happened since that token.

    This is definitely something that needs to happen, though unfortunately I don't have an ETA on this since it's a non-trivial technical effort.

  6. barkerja commented on Sep 2, 2014

    @barkerja

    Personally, I would love to see a plugin system (very similar to that of Elasticsearch with the rivers) that would allow things like dumping the change feed directly into an AMPQ without the need for any sort of middleware. This would give the level of redundancy and scalability most (me included) are looking for in something like a change feed.

  7. coffeemug commented on Sep 3, 2014

    @coffeemug
    Contributor

    @barkerja -- that makes sense, thanks. We'll think about it carefully and see what we can do.

  8. thelinuxlich commented on Oct 10, 2014

    @thelinuxlich

    +1 for this

  9. wojons commented on Oct 12, 2014

    @wojons
    Contributor

    @coffeemug I think another way then some sort of token is a key that i can use when connecting with a changefeed.

    r.table().changes({"name":"helloworld"}).run(function() {})

    this way there can be some black magic under the hood so if i reconnect the cluster can find anyne that was keeping track of my changes and will figure out a way to move the changes to the new server i am connecting to and then continy the feed from there and then there should be some sort of timeout and then there is the 100k max before it starts droping things this couldwork out okay.

  10. danielmewes commented on Oct 13, 2014

    @danielmewes
    Member

    @wojons Interesting. I think that can be though of as an extension of the thing described above (#2953 (comment)), just that the servers keep the token in some sort of name-indexed directory, instead of the clients keeping their own tokens.

  11. wojons commented on Oct 13, 2014

    @wojons
    Contributor

    i think that if the client does specf it then it should be auto generated i have a ticket for disbuted change feeds where the user settign it could be useful in that case.

  12. modified the milestones: 2.1, subsequent on Feb 3, 2015
  13. danielmewes commented on Apr 24, 2015

    @danielmewes
    Member

    Discussion about this feature has moved to #3471.

  14. modified the milestones: duplicate, 2.1 on Apr 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions