about summary refs log tree commit diff
path: root/src/bin
diff options
context:
space:
mode:
authorAlexander_Kabui <alexanderkabui@proton.me>2026-10-14 07:28:47 +0300
committerAlexander_Kabui <alexanderkabui@proton.me>2026-10-14 07:28:47 +0300
commitd607e8faa7692f28f7e6cf3d0517a69a44557a27 (patch)
tree5643ec45ed1f1d1296bf0732f775e9fd93afd882 /src/bin
parentb0c027a40c1e64d5c3a6b7e5dd79d1f3c4cb35eb (diff)
downloadgenenetwork4-d607e8faa7692f28f7e6cf3d0517a69a44557a27.tar.gz
indexer: add versioning-based DELTA mode
* src/indexer/delta.rs: change detection over MariaDB system versioning
  (ROW_START/ROW_END): coverage marker, versioning probe, purge check,
  per-table candidate queries and identity-term fan-out.
* src/indexer/run.rs (run_delta): reuse the streaming crawl and shard diff,
  scoped to the affected datasets.
* src/indexer/sidecar.rs: manifest v3 with versioning_marker/versioning_flavour.
* src/bin/gn-indexer.rs: add the delta mode.
* scripts/gn-indexer-run.sh, scripts/gn-indexer-lag.sh: flock wrapper and lag SLA.
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/gn-indexer.rs19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/bin/gn-indexer.rs b/src/bin/gn-indexer.rs
index 224edb8..57a3f57 100644
--- a/src/bin/gn-indexer.rs
+++ b/src/bin/gn-indexer.rs
@@ -3,6 +3,7 @@
 //! Usage:
 //!   gn-indexer full        [--index PATH] [--rdf-cache PATH] [--no-publish-filter]
 //!   gn-indexer incremental [--index PATH] [--rdf-cache PATH] [--no-publish-filter]
+//!   gn-indexer delta       [--index PATH] [--rdf-cache PATH] [--no-publish-filter]
 //!
 //! The target index comes from `--index`, else `XAPIAN_DB_PATH` (the
 //! same key the search engine reads), and is written IN PLACE. The RDF
@@ -10,6 +11,10 @@
 //! `/tmp/gn4-rdf-cache.json`. `SQL_URI` comes from the crate's normal
 //! layered configuration.
 //!
+//! `delta` names changed rows via system versioning and re-diffs only the
+//! affected datasets; it falls back to a FULL rebuild on any doubt. The
+//! periodic `incremental` sweep remains the correctness bound.
+//!
 //! Test-only RED controls for the incremental gates are read from
 //! `GN4_INDEXER_RED` (values `hash`, `delete`, `commit`); they sabotage
 //! one guarantee each and are never set in a normal run.
@@ -18,11 +23,11 @@ use std::path::PathBuf;
 use std::process::ExitCode;
 
 use genenetwork4::config::Config;
-use genenetwork4::indexer::{RunConfig, run_full, run_incremental};
+use genenetwork4::indexer::{RunConfig, run_delta, run_full, run_incremental};
 
 fn usage() -> ExitCode {
     eprintln!(
-        "usage: gn-indexer <full|incremental> [--index PATH] [--rdf-cache PATH] \
+        "usage: gn-indexer <full|incremental|delta> [--index PATH] [--rdf-cache PATH] \
          [--no-publish-filter]"
     );
     ExitCode::from(2)
@@ -70,6 +75,7 @@ fn main() -> ExitCode {
     let result = match mode.as_str() {
         "full" => run_full(&run_config),
         "incremental" => run_incremental(&run_config),
+        "delta" => run_delta(&run_config),
         _ => return usage(),
     };
 
@@ -97,6 +103,15 @@ fn main() -> ExitCode {
             println!("commit_chunks={}", stats.commit_chunks);
             println!("chunk_rss_peak_kib={}", stats.chunk_rss_peak_kib);
             println!("startup={}", stats.startup);
+            for (table, count) in &stats.candidates {
+                println!("candidates_{table}={count}");
+            }
+            println!("affected_datasets={}", stats.affected_datasets);
+            println!(
+                "marker_from={}",
+                stats.marker_from.as_deref().unwrap_or("-")
+            );
+            println!("marker_to={}", stats.marker_to.as_deref().unwrap_or("-"));
             ExitCode::SUCCESS
         }
         Err(error) => {