This is an automated email from the ASF dual-hosted git repository.
github-merge-queue[bot] pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-rust.git
The following commit(s) were added to refs/heads/main by this push:
new ff0564170 fix(arrow): wake equality-delete waiters with the notifier
of the started load (#3697)
ff0564170 is described below
commit ff0564170e66e2cd79436513bbba4ac831f8a72b
Author: Christian <[email protected]>
AuthorDate: Mon Nov 16 15:34:38 2026 +0000
fix(arrow): wake equality-delete waiters with the notifier of the started
load (#3697)
* fix(arrow): wake equality-delete waiters with the notifier of the started
load
Co-authored-by: JeonDaehong <[email protected]>
* Assert that insert_equality_delete gets the notifier of the started load
---------
Co-authored-by: JeonDaehong <[email protected]>
---
.../src/arrow/caching_delete_file_loader.rs | 2 +-
crates/iceberg/src/arrow/delete_filter.rs | 42 ++++++++++++++++------
2 files changed, 33 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..1b49e12e2 100644
--- a/crates/iceberg/src/arrow/delete_filter.rs
+++ b/crates/iceberg/src/arrow/delete_filter.rs
@@ -339,20 +339,18 @@ 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()),
- );
- }
-
+ debug_assert!(matches!(
+ self.state.read().unwrap().equality_deletes.get(delete_file_path),
+ Some(EqDelState::Loading(stored)) if Arc::ptr_eq(stored, ¬ify)
+ ));
let state = self.state.clone();
let delete_file_path = delete_file_path.to_string();
self.runtime.cpu().spawn(async move {
@@ -492,6 +490,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 +751,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();