-
Notifications
You must be signed in to change notification settings - Fork 36
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
Streams - keep track of first offset and timestamp per segment #817
Conversation
Cool! |
Yeah, probably! I don't think it will make a huge difference, since the number of segments won't be super big. But can give it a try 👍 Yes, it should always be sorted. We only add larger offsets and delete the smallest. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good feature!
Could theoretically build an index over timestamps too, right?
Yes, should be possible to do pretty much the same way for timestamps I think. I'll give it a try! |
be026db
to
eb8bcb4
Compare
…gment when looking up by offset
Co-authored-by: Carl Hörberg <carl@84codes.com>
Co-authored-by: Carl Hörberg <carl@84codes.com>
Co-authored-by: Carl Hörberg <carl@84codes.com>
Co-authored-by: Carl Hörberg <carl@84codes.com>
c9cf24a
to
a8883b1
Compare
WHAT is this pull request doing?
Saves a hash with the first offset for each segment, greatly reducing the time (and memory used) to find a message by offset.
Does the same for timestamps.
Tests done by getting a message by a random offset 10 times in a stream with 10M messages.
main:
this branch:
HOW can this pull request be tested?
Existing specs in
stream_queue_spec.cr
should cover this pretty well.