mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-01 13:45:53 +00:00
The queue reader currently uses two buffers, a `_queue` that the producer pushes fragments into and its internal `_buffer` where these fragments eventually end up being served to the consumer from. This double buffering is not necessary. Change the reader to allow the producer to push fragments directly into the internal `_buffer`. This complicates the code a little bit, as the producer logic of `seastar::queue` has to be folded into the queue reader. On the other hand this introduces proper memory consumption management, as well as reduces the amount of consumed memory and eliminates the possibility of outside code mangling with the queue. Another big advantage of the change is that there is now an explicit way to communicate the EOS condition, no need to push a disengaged `mutation_fragment_opt`. The producer of the queue reader now pushes the fragments into the reader via an opaque `queue_reader_handle` object, which has the producer methods of `seastar::queue`. Existing users of queue readers are refactored to use the new interface. Since the code is more complex now, unit tests are added as well.
25 KiB
25 KiB