-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a method to ShapeStream to abort long poll + reconnect + emit a new up-to-date with latest LSN #2216
Comments
I still don't understand how this is helpful. A live request is guaranteed to get sent data as soon as it exists. A non live request has longer caching headers so a response might there might even be further behind the tip of the stream... I think a slight buffering (which we test in the wild to collect say 99.99% of associated stream updates) after receiving a new message along with resilience against missing messages (e.g. a join fails temporarily) seems better? |
@KyleAMathews I'm trying to find a way to integrate this into D2. Each stream needs to send a frontier message that gives a lower bound of the versions that it may send in future. This lower bound is then used by the
Whenever you use a This PR in the d2ts repo (electric-sql/d2ts#11) has an working Electric -> D2 adapter, and an example that:
You are correct that a timeout could work in theory. However, if we simulate a frontier based on a timeout, and then receive a late message, without changing its version ( If we want to offer any guarantee (as we could if we use D2, it's what it's designed for) when joining streams, we need a way to assert the lower bound of LSN/Version that a stream could receive at a point in time so that we can inject a frontier. There is an alternative, and that is to decide not to offer these guarantees, DBSP for example does away with all the versioning stuff, it is assumed that messages are receved in order, and at the correct time. We could either build a DBSP implementation or take the D2 ts lib and strip out all version/ordering stuff. There is a route to doing that, and it makes it simpler. But the downside is we loos the ability to offer the transactional guarantee. |
So what you really want is every stream to output on every transaction whether it has a change or not? Would this also solve it? |
That would also work, but on a busy database that's a lot of transactions. You could easily the long polling just becoming an endless loop of reconnects. It ends up being a higher overhead than just aborting and reconnecting from the client side. |
Right sure — just conceptually that's the goal. Just making sure I understand. |
Related to #2215, we will need something like a
.refresh()
method in ShapeStream that can be called to abort the current long poll, reconnect withlive=false
, and therefor emit a newup-to-date
.There is some nuance, as this call only wants to be made during long polling - I think it's a no-op when there is no active long poll.
Further apis can wrap this to create "aligned" streams, calling the
refresh
method on sibling streams when they receive an update and a timeout threshold has been exceeded without an up-to-date on the other streams.The text was updated successfully, but these errors were encountered: