Skip to content

return_initial #3579

Closed
Closed

Description

@mlucy

We never implemented a return_initial optarg. Currently point changefeeds and limit changefeeds always do return_initial, and other feeds never do. I think that's probably the desired default behavior.

It would be too much work to support return_initial on range changefeeds before the release, but we could offer the option to disable it on changefeeds where it's enabled by default. @coffeemug, @danielmewes, do you think this is worth doing?

Activity

  1. self-assigned this
    on Jan 15, 2015
  2. added this to the milestone on Jan 15, 2015
  3. danielmewes commented on Jan 15, 2015

    @danielmewes
    Member

    I wouldn't worry about this for 1.16. Moving to subsequent.

  4. modified the milestones: subsequent, on Jan 15, 2015
  5. coffeemug commented on Jan 16, 2015

    @coffeemug
    Contributor

    Agree with @danielmewes. I do think that once 1.16 is out, return_initial and/or persistent/restartable feeds will be the next order of business for changefeeds.

  6. modified the milestones: , subsequent, 2.1 on Feb 3, 2015
  7. Timer commented on Mar 17, 2015

    @Timer

    I would be interested in seeing this implemented.

  8. danielmewes commented on Mar 18, 2015

    @danielmewes
    Member

    @Timer @mlucy is working on the full version of this (including return_initial for range changefeeds). Will ship in 2.1 (after 2.0).

  9. Timer commented on Mar 18, 2015

    @Timer

    Sounds good, thanks for the update @danielmewes!

  10. mlucy commented on May 7, 2015

    @mlucy
    MemberAuthor

    This is in next, but may not make it into 2.1. When we're sure where we're scheduling it we should open a docs issue. (Re-assigning to @danielmewes to handle scheduling.)

  11. removed their assignment
    on May 7, 2015
  12. 31 remaining items

  13. jasonkuhrt commented on Jun 17, 2015

    @jasonkuhrt

    👍

  14. Slava commented on Jun 30, 2015

    @Slava

    commenting to register my interest in this issue publicly, as well as subscribe for further updates

  15. ccorcos commented on Jul 1, 2015

    @ccorcos

    +1

  16. danielcompton commented on Aug 11, 2015

    @danielcompton
    Contributor

    When this feature is added, will it dissolve the differences between 'point' changefeeds and other changefeeds?

  17. mlucy commented on Aug 11, 2015

    @mlucy
    MemberAuthor

    @danielcompton -- yes, the interface should be the same.

  18. stellanhaglund commented on Sep 7, 2015

    @stellanhaglund

    This seems very promising, I guess the 2.2 release is months away?

  19. mlucy commented on Sep 7, 2015

    @mlucy
    MemberAuthor

    @stellanhaglund -- we don't have a release date yet, but we just released 2.1 and historically releases have been 1-3 months apart.

  20. assigned and unassigned on Oct 8, 2015
  21. neonrust commented on Oct 19, 2015

    @neonrust

    Question: would the initial state stream be possible to sort?
    In my system I want to return the documents in the same order they arrived, so for the consumer it will be received as if it was live (just faster!).
    Currently I do a current-value query (sorted by modify time) and a changes() query in a thread each and serialize the output from those threads so they're emitted externally in "initial-then-changes"-order. This is a somewhat cumbersome solution (and notably slower). Having changes() natively return initial state first is a great win for this use case. However, there is the sorting issue...

  22. danielmewes commented on Oct 19, 2015

    @danielmewes
    Member

    @tatsujin1 If you just do an orderBy({index: ...}).changes({includeInitial: true}), changes will not necessarily arrive after all initial results, but you can start seeing some changes before you have received all initial results.

    There are two work-arounds:

    • If you also specify {includeStates: true}, you will receive a special document {state: "ready"} once all initial results (plus possibly a few changes) have been transmitted. If you delay rendering in your application until you see that document, you get essentially the desired behavior where the first view that's rendered represents the initial results at the time of the ready document, and from that point on you receive changes to it. Note that at no point you will see a change for a document that you haven't seen the initial result for yet.
    • If you attach a limit to the query, i.e. table.orderBy({index: ...}).limit(...), I believe you will get the behavior you describe where all initial results will be transmitted first, followed by any updates.

    The reason for why unlimited changefeeds with include_initial can send changes before they've sent all initial results is for memory consumption. If we had to somehow keep track of all changes until we're done sending all initial results, that would mean that we would need to use an unbounded amount of memory (depending on the number of changes happening during the time where we stream the initial results).

  23. neonrust commented on Oct 20, 2015

    @neonrust

    Thanks for the thorough response!

    That changes arrive amongst initial state documents is not a problem; the two sets are simple to serialize in application code. Hmm... come to think of it, I'm not sure that is strictly required. :) (especially as the initial is sent first, as you mentioned)

    Sorting the initial state is something I need, however; the inter-document arrival order has meaning in my case, e.g. A then B means X; B then A means Y.

    But hey, I hadn't thought of using an indexed .order_by()! As it is required to be first in the query chain I thought it would be too slow to "sort the entire data set", but I tried it now and it is surprisingly fast! :)

    Yeah, I know of the state documents, but since I'm doing the initial+changes queries manually it's not currently used, but they of course will be once this feature is in use. If the initial+changes sets need to be serialized that is...

  24. mlucy commented on Oct 20, 2015

    @mlucy
    MemberAuthor

    This is in next, but it still needs more testing (I'll create another issue for that shortly). Should be released in 2.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions