Skip to content

armgit / xerj

Public Imported from GitHub
0

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.

docs(upgrades): describe the real format marker instead of a nonexistent `xerj migrate` (#1440)

xerj-orge5c67577115b
diff --git a/landing/docs/upgrades.html b/landing/docs/upgrades.html
index ec06e8060..0f61dc101 100644
--- a/landing/docs/upgrades.html
+++ b/landing/docs/upgrades.html
@@ -275,22 +275,20 @@ $ ssh node-<id> sudo systemctl start xerj
<p>Because index data is node-local today, each node's data directory is also each node's upgrade responsibility — snapshot per the <a href="/docs/backup-restore">backup guide</a> before touching the binary.</p>
- <h2>On-disk format migrations</h2>
- <p>A major release that changes the segment format ships a <code class="inline">migrate</code> subcommand. Run it after stopping the old binary and before starting the new one:</p>
-<pre class="code">$ sudo systemctl stop xerj
-$ xerj migrate --from 1.x --to 2.x --data-dir /var/lib/xerj
-Scanning segments... 842 found
-Rewriting segment 1/842: logs/seg-000123 ... ok
-...
-Migration complete. Verify with: xerj verify --data-dir /var/lib/xerj
-$ sudo systemctl start xerj</pre>
-
- <p>The migrator is idempotent — if it crashes halfway, re-run it. It never touches source segments until the replacement is fully written and fsynced.</p>
+ <h2>On-disk format</h2>
+ <p>There is no migration step and no <code class="inline">migrate</code> subcommand: a newer binary opens an older data directory in place. What guards the layout is a format marker that every index directory carries, <code class="inline">&lt;data_dir&gt;/&lt;index&gt;/xerj_meta.json</code>:</p>
+<pre class="code">$ sudo cat /var/lib/xerj/logs/xerj_meta.json
+{"format_version":1,"xerj_version":"1.0.0-rc.95"}</pre>
+ <p>A binary checks the marker before it opens anything else in that index. If <code class="inline">format_version</code> is higher than it understands, it does not open the index, so it cannot misread or garbage-collect segments it does not recognise. The node still starts; the index is logged as failed to open, with this reason:</p>
+<pre class="code">data dir /var/lib/xerj/logs was written by a newer xerj (data-dir format version 2);
+this binary supports up to 1. Refusing to open — upgrade xerj to a build that
+understands format 2.</pre>
+ <p>Current binaries read format 2. Opening an index never raises its marker. It moves from 1 to 2 only when a flush writes a full-text field whose name cannot be used literally in a file name: longer than 128 bytes, or containing a character such as <code class="inline">/ \ : * ? " &lt; &gt; |</code>.</p>
<h2>Rolling back</h2>
- <p>Patch releases roll back by reinstalling the previous binary. Across a format migration, rolling back requires the pre-migration backup — there is no inverse migrator.</p>
+ <p>Roll back by reinstalling the previous binary. That works for every index whose marker is still at a version the previous binary reads; check the <code class="inline">xerj_meta.json</code> files first. An index whose marker has moved past it will not open under the old binary, and rolling it back means restoring the backup you took before the upgrade.</p>
- <p class="source-note">Source · engine/crates/xerj-server/src/main.rs</p>
+ <p class="source-note">Source · engine/crates/xerj-server/src/main.rs · engine/crates/xerj-storage/src/index_store.rs (check_data_dir_version) · engine/crates/xerj-fts/src/index.rs (field_file_component)</p>
<div class="next">