From ce621e447e79127c7db124cef4558b7ac68a9c52 Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Thu, 16 Jan 2025 11:37:37 +0100 Subject: [PATCH 1/3] Release writer_receiver as soon as writing to db panics --- crates/milli/src/update/new/indexer/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/milli/src/update/new/indexer/mod.rs b/crates/milli/src/update/new/indexer/mod.rs index d4c4841bc..e68a1ad4d 100644 --- a/crates/milli/src/update/new/indexer/mod.rs +++ b/crates/milli/src/update/new/indexer/mod.rs @@ -110,7 +110,7 @@ where }, ); - let (extractor_sender, mut writer_receiver) = pool + let (extractor_sender, writer_receiver) = pool .install(|| extractor_writer_bbqueue(&mut bbbuffers, total_bbbuffer_capacity, 1000)) .unwrap(); @@ -425,6 +425,7 @@ where let mut arroy_writers = arroy_writers?; { + let mut writer_receiver = writer_receiver; let span = tracing::trace_span!(target: "indexing::write_db", "all"); let _entered = span.enter(); From b84c0a53905aa7b6173a7f2eb1a44cf3ffdcd532 Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Thu, 16 Jan 2025 11:38:21 +0100 Subject: [PATCH 2/3] Demote panic to error log --- crates/milli/src/update/new/indexer/mod.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/crates/milli/src/update/new/indexer/mod.rs b/crates/milli/src/update/new/indexer/mod.rs index e68a1ad4d..cbd58c0ad 100644 --- a/crates/milli/src/update/new/indexer/mod.rs +++ b/crates/milli/src/update/new/indexer/mod.rs @@ -585,10 +585,11 @@ fn write_from_bbqueue( } (key, None) => match database.delete(wtxn, key) { Ok(false) => { - unreachable!( - "We tried to delete an unknown key from {database_name}: {:?}", - key.as_bstr() - ) + tracing::error!( + database_name, + key = %key.as_bstr(), + "Attempt to delete an unknown key" + ); } Ok(_) => (), Err(error) => { From 8c3574484853ad5d6e0ecac9ef1f8a188ae4ba5e Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Thu, 16 Jan 2025 14:33:53 +0100 Subject: [PATCH 3/3] Improve error log --- crates/milli/src/update/new/indexer/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/milli/src/update/new/indexer/mod.rs b/crates/milli/src/update/new/indexer/mod.rs index cbd58c0ad..9d0f8e480 100644 --- a/crates/milli/src/update/new/indexer/mod.rs +++ b/crates/milli/src/update/new/indexer/mod.rs @@ -587,7 +587,8 @@ fn write_from_bbqueue( Ok(false) => { tracing::error!( database_name, - key = %key.as_bstr(), + key_bytes = ?key, + formatted_key = ?key.as_bstr(), "Attempt to delete an unknown key" ); }