Part 16 · Capstone & Mock Interview

Schema evolution, audit và convergence

Distributed state sẽ lệch tạm thời; hệ thống Senior có detector và repair path thay vì giả định mọi message luôn tới đúng lúc.

Migration

Expand-contract: additive schema, deploy readers/writers compatible, backfill checkpoint/throttle, verify, switch, remove sau. Migration có lock/IO/replication risk và rollback/forward plan.

Ownership

Order và Payment không share tables; exchange contracts/events. Read model/copy có freshness và rebuild semantics. Không dùng cross-service DB transaction để che boundary.

Reconciliation

Periodic compare orders PAYMENT_PENDING với payment/provider state; deterministic rule, bounded batch, idempotent repair, dry-run/audit và manual exception queue.

Backup/restore

Backup phải có restore drill, RPO/RTO và dependency ordering; point-in-time state cần reconcile messages/external provider sau restore.

PostgreSQL ALTER TABLE · Flyway Documentation