feat(persist): FTS indexes survive restart (schema key + restore replay)

This commit is contained in:
2026-07-30 15:56:48 +03:00
parent 9088dc1381
commit 6703ca2b29
4 changed files with 63 additions and 0 deletions
+7
View File
@@ -15,6 +15,12 @@ import ../../vector/engine as vengine
import types
import schema
## Wired by executor.nim at module load. Breaks the context <-> executor
## module cycle: newExecutionContext cannot call executor code directly, so
## the engine-restore pass (FTS/HNSW/graph replay from persisted schema keys)
## is injected here and invoked nil-safely below.
var restoreEnginesHook*: proc(ctx: ExecutionContext)
# ----------------------------------------------------------------------
# Context management
# ----------------------------------------------------------------------
@@ -39,6 +45,7 @@ proc newExecutionContext*(db: LSMTree, registry: DatabaseRegistry = nil): Execut
result.sharedLock = SharedLock()
initLock(result.sharedLock.lock)
restoreSchema(result)
if restoreEnginesHook != nil: restoreEnginesHook(result)
# ----------------------------------------------------------------------
# AST to SQL serializer (for VIEW DDL persistence)
+1
View File
@@ -16,6 +16,7 @@ const
SchemaTriggerPrefix* = "_schema:triggers:"
SchemaUserPrefix* = "_schema:users:"
SchemaPolicyPrefix* = "_schema:policies:"
SchemaFtsIndexPrefix* = "_schema:ftsidx:"
## Legacy CREATE TABLE keys (pre-fix) used a migrations: counter suffix
SchemaLegacyCreatePrefix* = "_schema:migrations:"