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

TestKit for Persistence Query #28519

Open
patriknw opened this issue Jan 24, 2020 · 6 comments
Open

TestKit for Persistence Query #28519

patriknw opened this issue Jan 24, 2020 · 6 comments
Labels
1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted t:persistence-query

Comments

@patriknw
Copy link
Member

First step would be to add query support to the new memory journal #26825

Not sure we need much more since ordinary Streams testkit can be used, but we can discuss ideas.

@patriknw patriknw added 1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted t:persistence-query labels Jan 24, 2020
@manonthegithub
Copy link
Contributor

manonthegithub commented Apr 18, 2020

@patriknw I am a bit confused of what is expected.
Do you mean that the testkit should allow users to test if persisted events contain needed information and can be queried by particular type of PersistenceQuery?

Then I think that just implementing support of PersistenceQuery for the new memory journal should be enough. Then users would be able to do their checks obtaining ReadJournal instance.

@patriknw
Copy link
Member Author

The idea is that the new memory journal would implement the queries, such as eventsByPersistenceId and eventsByTag. You can look at the leveldb journal for inspiration.

@manonthegithub
Copy link
Contributor

Ok great, I already started, looks like its almost working from the box :)

@manonthegithub
Copy link
Contributor

There is no way of showing that the event was removed when you use for example eventsByPersistenceId which return infinite Source, the same with persistence ids. Is that as expected?

@manonthegithub
Copy link
Contributor

@patriknw one more thing... in current implementation of the testkit the highest sequence number is preserved separately by each persistence id, so for each persistence id they start from 0. When we do persistence query by tag (which may get events with different persistence ids), the ordering by sequence number may give several events with the same seq number. Is that also expected?

@patriknw
Copy link
Member Author

The ordering for eventsByTag is only promised per persistenceId so they arrive in seqNr order, but best if you sort them by timestamp so that events for different persistenceId are interleaved.

If you keep PersistentRepr around in the journal you can use the PersistentRepr.timestamp field. You have to set the timestamp when writing. That is also the timestamp that should be included in EventEnvelope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted t:persistence-query
Projects
None yet
Development

No branches or pull requests

2 participants