KB-381A
S109 CP-2+CP-3 Report — Firestore → PostgreSQL Migration
2 min read Revision 1
S109 CP-2+CP-3 Report — Firestore → PostgreSQL Migration
Date: 2026-03-11 | Session: S109 | PRs: #289, #290, #291, #292, #293
Tóm tắt
Agent Data đã chuyển từ Google Cloud (Firestore + GCS) sang PostgreSQL trên VPS. Tất cả Firestore dependencies removed. Production verified healthy.
Thay đổi chính (PR #289)
pg_store.py: PostgreSQL key-value store mới (JSONB) thay Firestorememory.py: PostgresChatHistory thay FirestoreChatHistoryserver.py:_ensure_pg()thay_firestore(), tất cả endpoints dùng pg_storemain.py: gcs_ingest disabled, metadata tools dùng pg_store- 10+ test files rewritten: Firestore fakes → pg_store mocks
Verification (2026-03-11)
- Health: healthy, postgres OK (4.2ms latency)
- Documents: 359 active / 1,227 total trong PG
- Deploy: GREEN (run 22945396463)
- CI: 208 tests passed, 3 skipped, coverage 70%+
Vấn đề phát hiện
- ⚠️ Vector orphans: 497 vectors vs 359 documents (138 dư)
- ⚠️ webhooks_registered=0 — event system → Qdrant sync cần điều tra riêng (TD-131)
- Các vấn đề trên KHÔNG ảnh hưởng production serving — tách riêng xử lý
Kiến trúc sau migration
- Document store: PostgreSQL (JSONB key-value via pg_store.py)
- Vector DB: Qdrant (không đổi)
- Chat history: PostgreSQL (PostgresChatHistory)
- File ingestion: Disabled (inline text only)
- Runtime: Docker trên VPS 38.242.240.89