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

Cancel DBCommand after finish reading events by PersistenceId #5311

Merged
merged 1 commit into from
Oct 13, 2021

Conversation

jarlrasm
Copy link
Contributor

When loading events by PersistenceId the DbCommand will continue reading data until all events from the query is loaded even after max is reached. This can be prevented by calling Cancel() on the command before the reader is disposed.

@Aaronontheweb
Copy link
Member

When loading events by PersistenceId the DbCommand will continue reading data until all events from the query is loaded even after max is reached

Are you sure about that? After the max gets reached on the loop it looks like we stop making ReadAsync calls - is there something I'm missing here?

cc @ismaelhamed

@jarlrasm
Copy link
Contributor Author

When loading events by PersistenceId the DbCommand will continue reading data until all events from the query is loaded even after max is reached

Are you sure about that? After the max gets reached on the loop it looks like we stop making ReadAsync calls - is there something I'm missing here?

cc @ismaelhamed

The disposal of the reader will block until the entire select is finished, even if we don't do any more ReadAsync. I have a PersistenceId with 16 million rows(don't ask why..) and it blocks for 50-ish minutes.

@Aaronontheweb
Copy link
Member

Ah, so even though we're done calling ReadAsync the cursor inside SQL is still waiting?

@Aaronontheweb Aaronontheweb added akka-persistence-sql-common Akka.Persistence.Sql.Common perf labels Oct 13, 2021
@Aaronontheweb Aaronontheweb added this to the 1.4.28 milestone Oct 13, 2021
@jarlrasm
Copy link
Contributor Author

Ah, so even though we're done calling ReadAsync the cursor inside SQL is still waiting?

Yes, exactly.

@Aaronontheweb Aaronontheweb merged commit 0ea1fab into akkadotnet:dev Oct 13, 2021
@Aaronontheweb
Copy link
Member

Done - thanks for bringing this to our attention. We just released Akka.NET v1.4.27 on Monday but we're doing smaller releases more frequently; you can expect v1.4.28 to ship in the next 1-2 weeks.

If you need this fix sooner it will be available in tonight's nightly: https://getakka.net/community/getting-access-to-nightly-builds.html - gets shipped around midnight UTC

This was referenced Nov 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
akka-persistence-sql-common Akka.Persistence.Sql.Common perf
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants