lance worker: a withdrawal recovers interrupted adds first

An add whose commit overwrote another key's request and stopped before
setting it again hides that request. A withdrawal of it then found
nothing to do, and the add's later recovery brought the request back.
request_removal now recovers such adds before it decides.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Chris LuandClaude Opus 5.5 committed 2026-11-20 06:01:08 -08:00
1 parent 441b941f55
commit 9ea759ca68
1 file changed
+5
@@ -276,6 +276,11 @@ pub async fn request(dataset: &mut Dataset, key: &str) -> Result<()> {
/// so queries stop using it, and the worker removes it. A key not indexed
/// needs nothing, so asking again is done.
pub async fn request_removal(dataset: &mut Dataset, key: &str) -> Result<()> {
// An add that stopped before setting again what it overwrote may hide
// this key's request, which its recovery would bring back later.
for added in keys_of(dataset) {
recover_add(dataset, &added).await?;
}
if let Some(column) = keys_of(dataset).into_iter().find(|k| k.key == key) {
if column.state != Some(State::Off) {
set_state(dataset, &column.column, State::Off).await?;