Skip to content
StarRocks (OLAP Analytics) | Omni Manual Book

StarRocks (OLAP Analytics)

Architecture, event catalog, medallion pipeline, and cutover runbook for StarRocks — the analytics read-model for dashboards, reports, and BI.

Omni uses StarRocks as the analytics read-model (single source of truth for all analytical reads). Postgres remains the system-of-record (OLTP); StarRocks serves dashboard overviews, charts, reports, and BI through a three-layer medallion architecture (bronze / silver / gold) fed by event-driven ingestion.

flowchart LR
subgraph Postgres[Postgres - System of Record]
O[Transactional Outbox<br/>event_outbox]
end
subgraph SR[StarRocks - OLAP Read Model]
B[(Bronze<br/>analytics_event_raw)]
S[(Silver Facts<br/>fact_*, dim_*)]
G[(Gold Marts<br/>mart_*)]
end
subgraph Svc[Backend StarrocksSyncService]
Sync[Sync Worker<br/>*/10s + direct bridge]
Router[Event Router]
Sink[Stream Load / Kafka]
end
O -->|emitOutbox| Sync
Sync --> Router --> Sink --> B
Sink --> S
Dim[Dims<br/>StarrocksDimService] --> S
Mart[Mart Scheduler<br/>02:15] --> G
S --> Mart
B -.->|parity gate| G

All events are captured in bronze (analytics_event_raw, append-only, unique event_id). Two ingestion paths exist:

  1. Outbox (emitOutbox) — durable, automatically hits bronze. Covers the majority of events.
  2. Direct bridge — for in-process events (bus.emit) that bypass the outbox, captured via @OnEvent listeners in StarrocksSyncService (the onJournalPosted, onPoIssued, etc. pattern).
DomainFactNotes
Accountingfact_journal_lineJournal line-grain, dimension-rich (OU/cost_center/project)
Order-to-Cashfact_invoice, fact_invoice_line, fact_sales_order, fact_so_line, fact_paymentEnriched (segment, discount, tax, outstanding, method/channel)
Procure-to-Payfact_pr, fact_po, fact_goods_receipt, fact_vendor_invoiceHeader grain
HR/Payrollfact_attendance, fact_payroll
Inventoryfact_inventory_movement

dim_date (2020–2035 calendar), dim_customer, dim_vendor, dim_product, dim_account, dim_organization_unit, dim_employee, dim_warehouse, dim_bank_account — SCD Type 1, rebuilt from Postgres masters.

mart_revenue_kpi, mart_cash_position_account_daily, mart_ar_aging, mart_ar_totals, mart_cash_application_daily, mart_ar_overdue_daily, mart_customer_revenue, mart_payment_channel, mart_so_pipeline.

ComponentScheduleRole
StarrocksSyncServiceevery 10sConsume outbox → bronze + silver UPSERT
StarrocksDimServicedaily 02:15Rebuild dim_* from Postgres
StarrocksMartSchedulerServicedaily 02:15Rebuild gold marts + parity reconcile
StarrocksParityServiceon-demandValidate Postgres ↔ StarRocks
Terminal window
cd backend
bun run scripts/starrocks-selfcheck.ts # apply DDL + check bronze/silver/dim/mart
Terminal window
bun run scripts/starrocks-backfill.ts --table fact_journal_line # or --table <all>
bun run scripts/starrocks-repair-journal-date.ts # fill journal_date for legacy rows
Terminal window
bun run scripts/starrocks-selfcheck.ts
# then via UI Settings → StarRocks Operations → Run Parity (per tenant), or the endpoint
Terminal window
STARROCKS_ENABLED=true

The Settings → StarRocks Operations page provides: ingestion status, delivery-queue admin (list/stats/replay), parity gate (run + history), and gold-mart + dimension rebuilds.

  • Router & facts: backend/src/modules/starrocks/starrocks-event-router.ts
  • Sync bridge: backend/src/modules/starrocks/starrocks-sync.service.ts
  • DDL migrations: backend/src/modules/starrocks/ddl/starrocks-ddl.ts
  • Read/rebuild marts: backend/src/modules/starrocks/starrocks-analytics.service.ts
  • Dimensions: backend/src/modules/starrocks/starrocks-dim.service.ts
  • Parity: backend/src/modules/starrocks/starrocks-parity.service.ts
  • Backfill/selfcheck: backend/scripts/starrocks-backfill.ts, backend/scripts/starrocks-selfcheck.ts