Weston Pace created ARROW-11943:
-----------------------------------
Summary: [C++] Create specialized queue for serial readahead
Key: ARROW-11943
URL: https://issues.apache.org/jira/browse/ARROW-11943
Project: Apache Arrow
Issue Type: Improvement
Components: C++
Reporter: Weston Pace
Follow-up from ARROW-11590.
The current serial readahead implementation is a little confusing.
Problem 1:
The readahead operator is keeping track of the queue size instead of the queue.
This is because the queue is intended more for either the "fill up queue then
spin until free" case or the "fill up queue and then drop on the floor" case
and not the "fill up queue and then stop reading values" case.
In particular, ProducerConsumerQueue::Write should return true if the write
filled up the queue and ProducerConsumerQueue::Read should return true if the
read made space in an otherwise empty queue. This would need to be
atomic/thread-safe so every true returned from a ::Write should be paired
exactly 1:1 with a true-returning ::Read
Problem 2:
Serial readahead's writes follow a write slot to queue, get value, put value in
slot pattern. Currently this uses a shared_ptr. This could probably be
changed to use util::optional if we created a BackPtr function in the queue.
These two changes would simplify the serial readahead logic and help keep the
code organized.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)