This is an automated email from the ASF dual-hosted git repository. github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-3697-eeb1e41f959589347ac98a0575a325cdc923f6e9 in repository https://gitbox.apache.org/repos/asf/iceberg-rust.git
commit 940281125d5b0be136327f5f76ced9500a750bd4 Author: Christian <[email protected]> AuthorDate: Mon Nov 16 07:59:17 2026 +0000 fix(arrow): wake equality-delete waiters with the notifier of the started load (#3697) Co-authored-by: JeonDaehong <[email protected]> --- .../src/arrow/caching_delete_file_loader.rs | 2 +- crates/iceberg/src/arrow/delete_filter.rs | 38 ++++++++++++++++------ 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/crates/iceberg/src/arrow/caching_delete_file_loader.rs b/crates/iceberg/src/arrow/caching_delete_file_loader.rs index 0711a58b3..ef6f9f181 100644 --- a/crates/iceberg/src/arrow/caching_delete_file_loader.rs +++ b/crates/iceberg/src/arrow/caching_delete_file_loader.rs @@ -311,7 +311,7 @@ impl CachingDeleteFileLoader { }; let (sender, receiver) = channel(); - del_filter.insert_equality_delete(task.file_path(), receiver); + del_filter.insert_equality_delete(task.file_path(), notify, receiver); // Per the Iceberg spec, evolve schema for equality deletes but only for the // equality_ids columns, not all table columns. diff --git a/crates/iceberg/src/arrow/delete_filter.rs b/crates/iceberg/src/arrow/delete_filter.rs index 977917030..cec17bd31 100644 --- a/crates/iceberg/src/arrow/delete_filter.rs +++ b/crates/iceberg/src/arrow/delete_filter.rs @@ -339,20 +339,14 @@ impl DeleteFilter { *entry.lock().unwrap() |= delete_vector; } + /// Stores the equality delete predicate that `eq_del` delivers, and wakes the tasks + /// waiting on `notify`, the notifier from [`Self::try_start_eq_del_load`]. pub(crate) fn insert_equality_delete( &self, delete_file_path: &str, + notify: Arc<Notify>, eq_del: Receiver<Predicate>, ) { - let notify = Arc::new(Notify::new()); - { - let mut state = self.state.write().unwrap(); - state.equality_deletes.insert( - delete_file_path.to_string(), - EqDelState::Loading(notify.clone()), - ); - } - let state = self.state.clone(); let delete_file_path = delete_file_path.to_string(); self.runtime.cpu().spawn(async move { @@ -492,6 +486,29 @@ pub(crate) mod tests { )); } + // A task that finds the load started before the loader calls `insert_equality_delete` + // must be woken when the predicate arrives. + #[tokio::test] + async fn test_eq_del_waiter_registered_before_insert_is_woken() { + let filter = DeleteFilter::new(Runtime::current()); + let path = "s3://bucket/eq-delete.parquet"; + let notify = filter.try_start_eq_del_load(path).unwrap(); + + let mut waiter = Box::pin(filter.get_equality_delete_predicate_for_delete_file_path(path)); + // Registers the waiter on the notifier that `try_start_eq_del_load` stored. + assert!(futures::poll!(&mut waiter).is_pending()); + + let (tx, rx) = tokio::sync::oneshot::channel(); + filter.insert_equality_delete(path, notify, rx); + let predicate = Reference::new("id").equal_to(Datum::long(1)); + tx.send(predicate.clone()).unwrap(); + + let loaded = tokio::time::timeout(std::time::Duration::from_secs(5), waiter) + .await + .expect("waiter did not wake after the predicate arrived"); + assert_eq!(loaded, Some(predicate)); + } + #[tokio::test] async fn test_delete_file_filter_load_deletes() { let tmp_dir = TempDir::new().unwrap(); @@ -730,8 +747,9 @@ pub(crate) mod tests { // ---------- insert equality delete predicate ---------- let pred = Reference::new("id").equal_to(Datum::long(10)); + let notify = filter.try_start_eq_del_load("eq-del.parquet").unwrap(); let (tx, rx) = tokio::sync::oneshot::channel(); - filter.insert_equality_delete("eq-del.parquet", rx); + filter.insert_equality_delete("eq-del.parquet", notify, rx); tx.send(pred).unwrap();
