Skip to content

Commit 97ed5ec

Browse files
authored
fix: inverted index build deadlock (#4026)
This is the root cause of the hanging mac-build CI task.
1 parent 9c972c2 commit 97ed5ec

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

rust/lance-index/src/scalar/inverted/builder.rs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,20 @@ impl InvertedIndexBuilder {
159159
index_tasks.push(task);
160160
}
161161

162-
let mut stream = flatten_stream.map(|batch| {
163-
let batch = batch?;
164-
let num_rows = batch.num_rows();
165-
sender.send_blocking(batch).expect("failed to send batch");
166-
Result::Ok(num_rows)
167-
});
162+
let sender = Arc::new(sender);
163+
164+
let mut stream = Box::pin(flatten_stream.then({
165+
|batch_result| {
166+
let sender = sender.clone();
167+
async move {
168+
let sender = sender.clone();
169+
let batch = batch_result?;
170+
let num_rows = batch.num_rows();
171+
sender.send(batch).await.expect("failed to send batch");
172+
Result::Ok(num_rows)
173+
}
174+
}
175+
}));
168176
log::info!("indexing FTS with {} workers", num_workers);
169177

170178
let mut last_num_rows = 0;

0 commit comments

Comments
 (0)