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

Delete does not adhere to Eventsourced API #551

Open
nvollmar opened this issue Jun 30, 2021 · 1 comment
Open

Delete does not adhere to Eventsourced API #551

nvollmar opened this issue Jun 30, 2021 · 1 comment

Comments

@nvollmar
Copy link
Contributor

nvollmar commented Jun 30, 2021

Versions used

akka-persistence-jdbc version: 5.0.1

Expected Behavior

Scala doc of deleteMessages specifies

Permanently deletes all persistent messages with sequence numbers less than or equal toSequenceNr.

Actual Behavior

Events less than the specified toSequenceNr are deleted only - query still returns last event that should also have been deleted.

Reproducible Test Case

See DeleteTest in #550

@nvollmar
Copy link
Contributor Author

nvollmar commented Jul 1, 2021

I did some investigation, and adding

.filter(!_.deleted)

to

private def _messagesQuery(
persistenceId: Rep[String],
fromSequenceNr: Rep[Long],
toSequenceNr: Rep[Long],
max: ConstColumn[Long]) =
baseTableQuery()
.filter(_.persistenceId === persistenceId)
.filter(_.sequenceNumber >= fromSequenceNr)
.filter(_.sequenceNumber <= toSequenceNr)
.sortBy(_.sequenceNumber.asc)
.take(max)

would fix the test

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

1 participant