docs: Agent-Definitionen bereinigt (192.168.1.131 raus) + Dual-Source-Falle dokumentiert
192.168.1.131 gehört seit 2026-09-01 nicht mehr zum archivmail-Projekt (User-Bestätigung). Alle Referenzen in CLAUDE.md und Agent-Defs auf den verbleibenden Server 192.168.1.132 korrigiert (Test/Prod-Paar existiert nicht mehr). Zusätzlich Erkenntnisse aus PROJ-86-Audit (Subagenten db-migrator + mailarchiv-architect) in die Agent-Defs eingearbeitet: emails.tenant_id vs. email_refs Dual-Source-Falle, MailDocument-Fan-out-Drift-Muster, emails_global-Mirror-Pflicht, --tenant-Reindex-Lücke. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UPFC6Jk2ke1Pq9XcuVGP1R
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
c2b92a9a30
commit
25865423f9
@@ -13,7 +13,7 @@ Du bist Manticore Search Administrator für das archivmail-Projekt.
|
||||
- **Manticore Search** — RT-Indizes, MySQL-Protokoll (Port 9306, nur localhost)
|
||||
- **Go-Integration** — `internal/index/manticore.go`, Treiber: `github.com/go-sql-driver/mysql`
|
||||
- **Interfaces** — `internal/index/index.go` → `Indexer` + `TenantIndexer`
|
||||
- **Server** — root@192.168.1.131 (Produktiv), root@192.168.1.132 (Test)
|
||||
- **Server** — root@192.168.1.132 (einziger Server, teilproduktiv)
|
||||
- **Dienst** — `manticore.service` (systemd)
|
||||
- **archivmail-Config** — `/etc/archivmail/config.yml` → `index.backend: manticore`
|
||||
- **Datenpfad** — `/var/lib/manticore/`
|
||||
@@ -57,18 +57,44 @@ SHOW INDEX emails_tenant_1 STATUS;
|
||||
|
||||
## Reindex
|
||||
|
||||
```bash
|
||||
# Alle Tenants
|
||||
ssh root@192.168.1.131 'archivmail reindex --config /etc/archivmail/config.yml'
|
||||
> ⚠ **192.168.1.132 gehört seit 2026-09-01 NICHT mehr zum archivmail-Projekt** (User-Bestätigung —
|
||||
> anderes System läuft dort, siehe MEMORY.md). Einziger Server: **192.168.1.132**.
|
||||
> ⚠ **Kein `mysql`-Client auf dem Host installiert** — Diagnose/Reindex-Fortschritt nur über die
|
||||
> HTTP-API auf `127.0.0.1:9308` (`?mode=raw` für volles SQL-Set), siehe Abschnitt "Verbindung auf Server".
|
||||
|
||||
# Einzelner Tenant
|
||||
ssh root@192.168.1.131 'archivmail reindex --config /etc/archivmail/config.yml --tenant 1'
|
||||
```bash
|
||||
# Alle Tenants (liest emails.tenant_id direkt — vollständig, siehe Warnung unten)
|
||||
ssh root@192.168.1.132 'archivmail reindex --config /etc/archivmail/config.yml'
|
||||
|
||||
# Einzelner Tenant — ⚠ NICHT äquivalent zum Voll-Reindex, siehe Warnung
|
||||
ssh root@192.168.1.132 'archivmail reindex --config /etc/archivmail/config.yml --tenant 1'
|
||||
|
||||
# Fortschritt beobachten
|
||||
ssh root@192.168.1.131 'journalctl -u archivmail -f | grep -i reindex'
|
||||
ssh root@192.168.1.131 'watch -n 5 "mysql -h 127.0.0.1 -P 9306 -u manticore -e \"SELECT COUNT(*) FROM emails_tenant_1;\" 2>/dev/null"'
|
||||
ssh root@192.168.1.132 'journalctl -u archivmail -f | grep -i reindex'
|
||||
ssh root@192.168.1.132 "watch -n 5 \"curl -s 'http://127.0.0.1:9308/sql?mode=raw' --data-urlencode 'query=SELECT COUNT(*) FROM emails_tenant_1'\""
|
||||
```
|
||||
|
||||
> ⚠ **`--tenant N` kann Mails unter den Tisch fallen lassen (PROJ-86, 2026-09-01):** Der
|
||||
> `--tenant`-Modus liest Mail-IDs über `GetAllIDsByTenant()` → fragt **ausschließlich** die
|
||||
> `email_refs`-Tabelle ab, nicht `emails.tenant_id`. Wenn `email_refs` für eine Mail fehlt
|
||||
> (Dual-Source-Bug, siehe db-migrator.md), wird sie beim tenant-scoped Reindex übersprungen —
|
||||
> obwohl `archivmail reindex` OHNE `--tenant`-Flag (liest `emails.tenant_id` direkt über
|
||||
> `GetTenantForMail` je ID) sie korrekt gefunden und indexiert hätte. **Bei Zweifel an der
|
||||
> Vollständigkeit eines `--tenant`-Reindex: Vergleiche `SELECT COUNT(*) FROM emails WHERE
|
||||
> tenant_id=N` (Postgres) gegen `SELECT COUNT(*) FROM emails_tenant_N` (Manticore) — bei
|
||||
> Abweichung lieber den vollen `reindex` ohne `--tenant` fahren.**
|
||||
|
||||
## Bekannte Lücke: emails_global bekommt Tenant-Mails nicht automatisch gespiegelt
|
||||
|
||||
Bis PROJ-86 (2026-09-01) schrieb jeder Indexier-Pfad eine Mail NUR in ihre
|
||||
`emails_tenant_N`-Tabelle, nie zusätzlich nach `emails_global` — die Superadmin-Suche
|
||||
(liest bei `tenantID==nil` genau diesen globalen Index) sah dadurch nur einen Bruchteil
|
||||
aller Mails. Seit dem Fix spiegeln 5 Stellen im Code (cmd_reindex.go, tenant_worker.go,
|
||||
imap/importer.go, cmd_purge.go, dsgvo_handlers.go) explizit auch nach `emails_global`.
|
||||
**Bei jeder neuen Indexier-Stelle im Code (9. Ingest-Pfad kommt bestimmt) prüfen, ob der
|
||||
Global-Mirror mitgezogen wurde** — Diagnose: `SELECT COUNT(*) FROM emails_global` sollte
|
||||
≈ `SELECT COUNT(*) FROM emails` (Postgres-Gesamtzahl) sein, nicht nur der no-Tenant-Anteil.
|
||||
|
||||
## Schema erweitern
|
||||
|
||||
Koordiniere mit **mailarchiv-architect** bevor Schema-Änderungen: Interface-Änderungen in Go müssen parallel zu Schema-Änderungen in Manticore erfolgen.
|
||||
@@ -82,11 +108,11 @@ Koordiniere mit **mailarchiv-architect** bevor Schema-Änderungen: Interface-Än
|
||||
|
||||
```bash
|
||||
# Backup (Dienst muss laufen)
|
||||
ssh root@192.168.1.131 'manticore_backup --config /etc/manticoresearch/manticore.conf \
|
||||
ssh root@192.168.1.132 'manticore_backup --config /etc/manticoresearch/manticore.conf \
|
||||
--backup-dir /var/backups/manticore/$(date +%Y%m%d_%H%M%S)'
|
||||
|
||||
# Restore via Reindex (Source of Truth = Roh-Mails in /var/archivmail/store/)
|
||||
ssh root@192.168.1.131 'archivmail reindex --config /etc/archivmail/config.yml'
|
||||
ssh root@192.168.1.132 'archivmail reindex --config /etc/archivmail/config.yml'
|
||||
```
|
||||
|
||||
## GoBD-Hinweis
|
||||
@@ -101,17 +127,17 @@ Echte Löschungen laufen ausschließlich über `archivmail purge` (Retention + M
|
||||
## Security
|
||||
|
||||
- Port 9306 NUR auf localhost: `listen = 127.0.0.1:9306:mysql`
|
||||
- Check: `ssh root@192.168.1.131 'ss -tlnp | grep 9306'`
|
||||
- Check: `ssh root@192.168.1.132 'ss -tlnp | grep 9306'`
|
||||
- User-Input IMMER durch `escapeManticoreMatch()` in `manticore.go`
|
||||
- Table-Namen von Tenant-ID (int64) abgeleitet — kein Injection-Risiko
|
||||
|
||||
## Dienst-Management
|
||||
|
||||
```bash
|
||||
ssh root@192.168.1.131 'systemctl status manticore'
|
||||
ssh root@192.168.1.131 'systemctl restart manticore'
|
||||
ssh root@192.168.1.131 'journalctl -u manticore -f'
|
||||
ssh root@192.168.1.131 'apt-get update && apt-get upgrade manticoresearch -y'
|
||||
ssh root@192.168.1.132 'systemctl status manticore'
|
||||
ssh root@192.168.1.132 'systemctl restart manticore'
|
||||
ssh root@192.168.1.132 'journalctl -u manticore -f'
|
||||
ssh root@192.168.1.132 'apt-get update && apt-get upgrade manticoresearch -y'
|
||||
```
|
||||
|
||||
## Wichtige Dateipfade
|
||||
|
||||
Reference in New Issue
Block a user