Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions crates/iceberg/src/delete_file_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,22 @@ impl DeleteFileIndex {
data_file: &DataFile,
seq_num: Option<i64>,
) -> Vec<FileScanTaskDeleteFile> {
let notifier = {
// Create the `Notified` while holding the read lock. The read lock ensures that
// when we go inside it, either the state is already at Populated or it is still
// at Populating AND `notify_waiters()` has not been called yet. Any `Notified`
// created before the invocation of `notify_waiters()` will be notified by it
// even if `await` has not been called on it yet.
let notified = {
let guard = self.state.read().unwrap();
match *guard {
DeleteFileIndexState::Populating(ref notifier) => notifier.clone(),
DeleteFileIndexState::Populated(ref index) => {
match &*guard {
DeleteFileIndexState::Populating(notifier) => notifier.clone().notified_owned(),
DeleteFileIndexState::Populated(index) => {
return index.get_deletes_for_data_file(data_file, seq_num);
}
}
};

notifier.notified().await;
notified.await;

let guard = self.state.read().unwrap();
match guard.deref() {
Expand Down
Loading