itsjunetime commented on code in PR #6612:
URL: https://github.com/apache/arrow-rs/pull/6612#discussion_r1821265417
##########
parquet/src/arrow/async_reader/store.rs:
##########
@@ -180,10 +231,69 @@ mod tests {
let err = e.to_string();
assert!(
err.contains("not found: No such file or directory (os
error 2)"),
- "{}",
- err
+ "{err}",
);
}
}
}
+
+ #[tokio::test]
+ // We need to mark this with the `target_has_atomic` because the
spawned_tasks_count() fn is
+ // only available for that cfg
+ async fn test_runtime_is_used() {
+ let num_actions = Arc::new(AtomicUsize::new(0));
+
+ let (a1, a2) = (num_actions.clone(), num_actions.clone());
+ let rt = tokio::runtime::Builder::new_multi_thread()
+ .on_thread_park(move || {
Review Comment:
I think all this assumes is that there are wait points where threads get
parked to wait for IO and that this runtime's threads aren't saturated. I
assume that if they were saturated with tasks, the threads would never be
parked as they would be continually polling other tasks, but I think it's safe
to assume that if a runtime is only working on one task, and that task has to
do IO, the main thread of that runtime is going to be parked at some point to
wait for IO.
It's a janky test, I just couldn't think of a better way to determine that
the runtime was definitely being used when we used `ParquetObjectReader` as an
`AsyncFileReader` without assuming a lot more about how the `spawn` function
should work.
--
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]