westonpace commented on a change in pull request #12662:
URL: https://github.com/apache/arrow/pull/12662#discussion_r832681496



##########
File path: cpp/src/arrow/util/async_generator.h
##########
@@ -775,6 +791,7 @@ class ReadaheadGenerator {
     if (state_->finished.load()) {
       state_->readahead_queue.push(AsyncGeneratorEnd<T>());
     } else {
+      state_->num_running.fetch_add(1);

Review comment:
       The comparison with `1` is a little misleading.  `fetch_sub` returns the 
value before the modification so we are testing whether we were the one to set 
it to 0.
   
   `max_readahead + 1` seems right to me.  `max_readahead` is the number of 
"extra spots" so if a user asks for 1 item and they have 4 readahead we need to 
start 5 requests, one to go straight to the caller and the other 4 to fill up 
the readahead spots.
   
   Why does `num_running` seem like the wrong name?  If this is, for example, 
file readahead, and num_running is 5 then we are reading from 5 different files.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to