Skip to content
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

Dropping pubsub event in the logs #520

Open
xeppaka opened this issue Feb 8, 2024 · 4 comments
Open

Dropping pubsub event in the logs #520

xeppaka opened this issue Feb 8, 2024 · 4 comments

Comments

@xeppaka
Copy link

xeppaka commented Feb 8, 2024

Description is here: https://discuss.lightbend.com/t/akka-persistence-r2dbc-pubsub-event-dropped/10619

Versions used

akka-persistence-r2dbc 1.5.2

Akka version: 2.9.1

Expected Behavior

Event is processed by projection right after pubsub event is received.

Actual Behavior

Event is processed by projection with a delay.

Relevant logs

https://discuss.lightbend.com/t/akka-persistence-r2dbc-pubsub-event-dropped/10619

@patriknw
Copy link
Member

patriknw commented Feb 9, 2024

I started to look at this, but it is not as easy as first thought. This was introduced in #345 and the reason is important for correctness.

I thought we could track that no events at all have arrived and therefore safely accept the incoming event because of the idle situation. However, then when second event arrives we are in the same situation until the backtracking event arrives. We don't know for how long we could just continue accepting pubsub events because then we could violate the reason for the "to far ahead" check.

This only happens if there are no events at all for a duration longer than the backtracking window, so it should be a rare situation. Increasing the backtracking window could be a way to mitigate it for a low throughput system. Pubsub should only be seen as an optimization, not a replacement for the refresh interval. There can always be situations where the latency goes up to the refresh interval.

With that conclusion I don't think we can do anything about this, unless someone has a brilliant suggestion?

@xeppaka
Copy link
Author

xeppaka commented Feb 10, 2024

Hmm, I thought that pubsub is used just to trigger the standard query to DB for a new events (I mean that no event is sent via pubsub). So maybe we can trigger this query in case "too far ahead" check is positive (the one that is done with refresh-interval period)?

@patriknw
Copy link
Member

Hmm, I thought that pubsub is used just to trigger the standard query to DB for a new events

No, that's the Cassandra plugin. For r2dbc we send the events and they are processed without addition query if sequence numbers and such line up with expectations.

So maybe we can trigger this query in case "too far ahead" check is positive

That might work as a fallback. I'll take a look at if we can trigger more frequent query based on that.

@xeppaka
Copy link
Author

xeppaka commented Feb 12, 2024

That might work as a fallback. I'll take a look at if we can trigger more frequent query based on that.

That would be nice, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants