feat: PITR RECOVER TO TIMESTAMP, OpenTelemetry OTLP export, FTS infrastructure

- RECOVER TO TIMESTAMP '...' — parser + executor, replays WAL entries
- core/tracing.nim — OTLP/HTTP export via exportOtlp()
- FTS: ftsIndexes table in ExecutionContext, engine import ready
- 281 tests, 0 failures
This commit is contained in:
2026-05-07 13:44:59 +03:00
parent 651375a156
commit b1aadf77f9
7 changed files with 104 additions and 40 deletions
+20 -40
View File
@@ -1,49 +1,15 @@
# BaraDB — Оставащи задачи
> Завършеното е преместено в `PLAN_DONE.md`.
> Завършеното е в `PLAN_DONE.md`.
---
## Ниски (nice-to-have, не блокират production)
### 1. Full FTS index integration (BM25 ranking)
- **Статус:** ⚠️ Базова поддръжка
- **Текущо:** `WHERE col @@ 'query'` прави case-insensitive term match. FTS engine (`fts/engine.nim`) съществува с BM25, inverted index, tokenization.
- **Липсва:** Пълна интеграция — `CREATE INDEX ... USING FTS` автоматично поддържа InvertedIndex при INSERT/UPDATE/DELETE. `@@` използва BM25 вместо substring.
### 2. Point-in-time recovery (PITR)
- **Статус:** ⚠️ WAL reader добавен
- **Текущо:** `readEntries(path, untilTimestamp)` чете WAL entries до даден timestamp. Backup/restore чрез tar.gz snapshot работи.
- **Липсва:** `RECOVER TO TIMESTAMP '...'` команда, която прилага WAL entries до timestamp.
### 3. OpenTelemetry tracing
- **Статус:** ⚠️ Базов tracer
- **Текущо:** `core/tracing.nim` — span recording, enable/disable, JSON export. `executeQuery` създава span за всяка заявка.
- **Липсва:** OTLP/gRPC export, integration с external collector.
---
## Завършено в последните 2 сесии (2026-05-07)
### Session 1: SQL Features
- Recursive CTE (WITH RECURSIVE + UNION ALL)
- UNION / INTERSECT / EXCEPT
- DROP INDEX
- VIEW DDL persistence
- JSON path operators (`->`, `->>`)
- FTS SQL wiring (`WHERE col @@ 'query'`)
- Multi-column index range scans
- Covering index optimization
- SCRAM-SHA-256 authentication
### Session 2: Production Hardening
- JWT secret — `getEffectiveJwtSecret()` helper + warning log при липса на конфигурация
- SSTable metadata — коментари изяснени (offsets се patch-ват коректно)
- LSM thread-safety — locks вече съществуват, stress test обновен
- WAL reader — `readEntries(path, untilTimestamp)` за PITR
- OpenTelemetry — `core/tracing.nim` с span recording, `executeQuery` tracing
- Distributed 2PC — реален TCP RPC вместо simulated (host="" → local fallback)
- `addParticipant` има default параметри (host="", port=0)
### 1. Full FTS BM25 ranking in `@@`
- **Статус:** ⚠️ Инфраструктура готова
- **Текущо:** `ftsIndexes: Table[string, InvertedIndex]` в ExecutionContext. FTS engine (`fts/engine.nim`) с BM25, tokenization. `@@` прави term-based substring match.
- **Липсва:** `evalExpr` няма достъп до `ctx` за BM25 lookup. Трябва refactoring на evalExpr signature или FTS filter на ниво `executePlan`.
---
@@ -56,4 +22,18 @@
---
**279 теста — 0 failure-а.**
## Завършено (обща сума: 3 сесии)
**281 теста — 0 failure-а.**
### Session 1: SQL Features
- Recursive CTE, UNION/INTERSECT/EXCEPT, DROP INDEX, VIEW persistence
- JSON path (`->`, `->>`), FTS SQL (`@@`), multi-col range scan, covering index, SCRAM auth
### Session 2: Production Hardening
- JWT security, WAL reader, tracing spans, 2PC real RPC, stress test fix
### Session 3: PITR + OpenTelemetry
- `RECOVER TO TIMESTAMP` — parser + executor (WAL replay)
- `core/tracing.nim` — OTLP/HTTP export (`exportOtlp`)
- FTS infrastructure — `ftsIndexes` in ExecutionContext, engine import