AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.
Rust agent-memoryai-agentsbm25claude-codeclicode-searchcursordatabaseelasticsearchfull-text-searchhybrid-searchjsonllocal-firstmcpmcp-servermodel-context-protocolragrustsearch-enginevector-search
Revert "diag(#1023): temporary runner-side interleaving instrumentation, WILL BE REVERTED"
xerj-org8c4980b2565e
diff --git a/engine/crates/xerj-api/src/es_compat.rs b/engine/crates/xerj-api/src/es_compat.rsindex d59cac29e..d1dc4656d 100644--- a/engine/crates/xerj-api/src/es_compat.rs+++ b/engine/crates/xerj-api/src/es_compat.rs@@ -26400,12 +26400,6 @@ async fn run_delete_by_query(// publications (#1023), so a purge storm cannot collect an empty set out// of another call's drain→publish window and report a clean no-op.if let Some(mut ids) = idx.matching_ids_sorted(&parsed_query).await {- eprintln!(- "[DIAG2] dbq ids-collected n={} first={:?} dir={}",- ids.len(),- &ids[..ids.len().min(3)],- idx.data_dir().display()- );// ES `max_docs`: stop after N documents; `total` then reports the// processed count (the same rule the paged arm applies).let matched = ids.len() as u64;@@ -26815,7 +26809,6 @@ async fn run_update_by_query(// precondition of the run being complete, so a failed flush must not be// followed by an update that reports a `total` over an index it could not// read consistently.- eprintln!("[DIAG2] ubq entry-flush start dir={}", idx.data_dir().display());if let Err(e) = idx.flush().await {return ApiError::new(xerj_common::XerjError::internal(format!("update_by_query was not attempted: flushing the index failed ({e}); the update \@@ -26823,7 +26816,6 @@ async fn run_update_by_query())).into_value();}- eprintln!("[DIAG2] ubq entry-flush done dir={}", idx.data_dir().display());// Parse once for the single-pass eligibility check below. The handler// already validated the (page-1-shaped) query, so this cannot fail for a@@ -26867,12 +26859,6 @@ async fn run_update_by_query(// reported total:0/updated:0/failures:[] — a silent no-op.if script.is_some() {if let Some(mut ids) = idx.matching_ids_sorted(&parsed_query).await {- eprintln!(- "[DIAG2] ubq ids-collected n={} first={:?} dir={}",- ids.len(),- &ids[..ids.len().min(3)],- idx.data_dir().display()- );// ES `max_docs`: stop after N documents; `total` then// reports the processed count (the same rule the paged// arm applies).@@ -26918,10 +26904,6 @@ async fn run_update_by_query(};return Ok((total, updated, batches, failures, timed_out));}- eprintln!(- "[DIAG2] ubq ids-collected NONE -> paged arm dir={}",- idx.data_dir().display()- );}// ── Paged arm: every other shape ─────────────────────────────────@@ -27167,7 +27149,6 @@ async fn transform_one(}let result = idx.transform_document_serialized(id, None, |mut current| {- let read_n = current.get("n").cloned();apply_painless_update(&mut current, src, params)?;// ES runs `?pipeline=` on the result of the script, and so do we —// inside the same serialized transform, so the pipeline sees@@ -27175,19 +27156,12 @@ async fn transform_one(if let Some((engine, name)) = pipeline.as_ref() {current = apply_pipeline_or_fail(engine, name, id, current)?;}- eprintln!(- "[DIAG2] transform_one id={id} read_n={read_n:?} write_n={:?}",- current.get("n")- );Ok::<_, String>(current)}).await;match result {Ok(Ok(Some(_))) => Some(Ok(())),- Ok(Ok(None)) => {- eprintln!("[DIAG2] transform_one id={id} VANISHED (get_document None)");- None- }+ Ok(Ok(None)) => None,Ok(Err(error)) => Some(Err(error)),Err(error) => Some(Err(error.to_string())),}diff --git a/engine/crates/xerj-engine/src/index.rs b/engine/crates/xerj-engine/src/index.rsindex 81c066c0c..07d936f6d 100644--- a/engine/crates/xerj-engine/src/index.rs+++ b/engine/crates/xerj-engine/src/index.rs@@ -17857,17 +17857,8 @@ impl Index {notified.as_mut().enable();match self.collection_publication.try_admit_reader() {ReadAdmission::Admitted(token) => break token,- ReadAdmission::Poisoned => {- eprintln!("[DIAG2] mis admit POISONED dir={}", self.data_dir.display());- return None;- }- ReadAdmission::WriterActive => {- eprintln!(- "[DIAG2] mis admit wait-writer dir={}",- self.data_dir.display()- );- notified.await;- }+ ReadAdmission::Poisoned => return None,+ ReadAdmission::WriterActive => notified.await,}};let snap = self.store.snapshot();@@ -17897,40 +17888,16 @@ impl Index {}}if unsupported {- eprintln!(- "[DIAG2] mis UNSUPPORTED id-map dir={}",- self.data_dir.display()- );return None;}ids.sort_unstable();// Same contract as the paged loop's `seen_ids`: an id resolves to one// delete even if a legacy multi-segment layout lists it twice.ids.dedup();- eprintln!(- "[DIAG2] mis attempt segs={} ids={} memtbl_docs={} first={:?} dir={}",- snap.segments.len(),- ids.len(),- self.memtable.doc_count(),- &ids[..ids.len().min(3)],- self.data_dir.display()- );match self.collection_publication.validate_reader(token) {ReadAdmission::Admitted(_) => break ids,- ReadAdmission::Poisoned => {- eprintln!(- "[DIAG2] mis validate POISONED dir={}",- self.data_dir.display()- );- return None;- }- ReadAdmission::WriterActive => {- eprintln!(- "[DIAG2] mis validate-retry dir={}",- self.data_dir.display()- );- continue;- }+ ReadAdmission::Poisoned => return None,+ ReadAdmission::WriterActive => continue,}};Some(ids)@@ -31435,24 +31402,10 @@ async fn do_flush_shard(// caller observed it as non-empty. No collection state changed in// this attempt, so this is a clean cancellation rather than a// failed publication.- eprintln!("[DIAG2] flush drain-empty shard={} dir={}", shard_idx, data_dir.display());collection_publication_guard.cancel();return Ok(());}};- {- let drained_ids: Vec<String> = drained_fts- .iter()- .map(|(id, _, _)| id.clone())- .collect();- eprintln!(- "[DIAG2] flush drained shard={} docs={} ids={:?} dir={}",- shard_idx,- drained_ids.len(),- &drained_ids[..drained_ids.len().min(4)],- data_dir.display()- );- }let drained_fts = Arc::new(drained_fts);let storage_drained = Arc::new(storage_drained);@@ -31627,8 +31580,6 @@ async fn do_flush_shard(let memtable_for_finalize = Arc::clone(&memtable);let drained_fts_for_restore = Arc::clone(&drained_fts);let version_map_for_restore = Arc::clone(&store.version_map);- let diag_dir = data_dir.display().to_string();- let diag_shard = shard_idx;// A dedicated async coordinator owns and awaits the queued blocking job.// Dropping/cancelling the API caller merely detaches this coordinator;// it continues to own the blocking JoinHandle and the worker-captured@@ -31677,22 +31628,8 @@ async fn do_flush_shard(xerj_storage::index_store::FlushFinalizeOutcome::Published { .. }))) {- let seg = match &result {- Ok(Ok(- xerj_storage::index_store::FlushFinalizeOutcome::Published { meta, .. },- )) => meta.id.as_str().to_string(),- _ => String::new(),- };- eprintln!(- "[DIAG2] flush commit shard={} seg={} dir={}",- diag_shard, seg, diag_dir- );collection_publication_guard.commit();} else {- eprintln!(- "[DIAG2] flush CANCEL+RESTORE shard={} dir={}",- diag_shard, diag_dir- );collection_publication_guard.cancel();}let result = match result {