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

Chunk Iterator API in osiris_log #150

Closed
kjnilsson opened this issue Oct 17, 2023 · 1 comment
Closed

Chunk Iterator API in osiris_log #150

kjnilsson opened this issue Oct 17, 2023 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@kjnilsson
Copy link
Contributor

kjnilsson commented Oct 17, 2023

Is your feature request related to a problem? Please describe.

Some uses of osiris_log offset readers may not want to read the entire chunk in one go as may not be able to deliver all messages to the consumer at once (e.g. consuming AMQP 0.9.1 clients whose consumer prefetch is reached or AMQP 1.0 clients who ran out of link credits). To avoid having to keep data in memory we could implement an iterator API that returns a bit of state that you then iterate over and it will read each entry in the chunk on demand.

Describe the solution you'd like

New functions in osiris_log

This finds the next readable chunk and returns an opaque iterator state.
-spec next_chunk_iterator(state()) -> {ok, chunk_iterator()} | {end_of_stream, state()} | {error, term()}

This gets the next entry or end of chunk.
-spec iterator_next(chunk_iterator()) -> end_of_chunk | {chunk_iterator() | Entry :: {offset(), binary()}}

This is optional and can return information about the iterator such as number of entries left etc.
-spec iterator_info(chunk_iterator()) -> map().

The iterator should handle uncompressed sub batches.

Describe alternatives you've considered

No response

Additional context

Because the entire chunk payload is never present in memory at the same time we are not able to perform the CRC check on the entries in the chunk.

This may result in an increase of pread sys calls so we may want to try to implement some kind of readahead inside the chunk iterator state.

@kjnilsson kjnilsson added the enhancement New feature or request label Oct 17, 2023
@kjnilsson
Copy link
Contributor Author

Closed in #151

@michaelklishin michaelklishin added this to the 1.7.0 milestone Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants