xxchan commented on code in PR #1323: URL: https://github.com/apache/iceberg-rust/pull/1323#discussion_r2087020351
########## crates/iceberg/src/delete_file_index.rs: ########## @@ -193,26 +199,3 @@ impl PopulatedDeleteFileIndex { results } } - -/// Future for the `DeleteFileIndex::get_deletes_for_data_file` method -pub(crate) struct DeletesForDataFile<'a> { - state: Arc<RwLock<DeleteFileIndexState>>, - data_file: &'a DataFile, - seq_num: Option<i64>, -} - -impl Future for DeletesForDataFile<'_> { - type Output = Result<Vec<FileScanTaskDeleteFile>>; - - fn poll(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Self::Output> { - match self.state.try_read() { - Ok(guard) => match guard.deref() { - DeleteFileIndexState::Populated(idx) => Poll::Ready(Ok( - idx.get_deletes_for_data_file(self.data_file, self.seq_num) - )), - _ => Poll::Pending, - }, - Err(err) => Poll::Ready(Err(Error::new(ErrorKind::Unexpected, err.to_string()))), Review Comment: We have 2 possible problems here: 1. `try_read` returns `TryLockError::WouldBlock`, which should not be an error, but `Pending`. 2. More severely, we don't have any `Waker` set, so once `Pending`, the future will sleep forever. Therefore, I think it's better to replace manual `Future` implementation with other sync primitives. -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org