Skip to content

feat: cold tier Parquet compaction, DuckDB query executor, and scaling RFCs - #118

Open
bjacobso wants to merge 1 commit into
mainfrom
feat/cold-tier-duckdb
Open

bjacobso wants to merge 1 commit into
mainfrom
feat/cold-tier-duckdb

Conversation

@bjacobso

Copy link
Copy Markdown
Owner

Summary

Implements Phase 1 of the scaling roadmap (Hot/Cold Storage Tiering + DuckDB QueryExecutor) along with five scaling and agent-workflow RFCs under docs/rfcs/.

Implementation (packages/core, packages/duckdb)

  • DuckDB Dialect & QueryExecutor:
    • Added "duckdb" to SqlDialect and browser-safe DuckDbDialect in packages/core/src/dialects/duckdb.ts.
    • Created packages/duckdb (@triplex-build/triplex-duckdb) with @duckdb/[email protected] pinned in pnpm-workspace.yaml.
    • Implemented DuckDbQueryExecutor over makeSqlQueryExecutor / SqlStatementRunner, passing the full shared Triplex conformance corpus (makeTriplesConformanceSuite, makeSealedStorageSuite, makeSensitiveConformanceSuite) plus direct Zstd read_parquet views.
  • Watermark Parquet Compaction & Manifest (packages/duckdb/src/compaction/):
    • ColdManifest: Content-addressed (ContentId) JSON manifest schema + CAS ColdManifestStore.
    • ParquetCompactor: Archives immutable retracted facts (retracted_position <= W) and historical journal rows (position <= W) to Zstd-compressed sorted Parquet, preserves [tripleId, op] journal reference integrity, uses a crash-safe/idempotent two-phase publish, and supports periodic full live snapshot export at P >= W.
  • Tiered Hot/Cold Routing & Federated Views (packages/duckdb/src/tiered/):
    • FederatedViews: DuckDB UNION ALL views over attached hot SQL + cold Parquet with overlap deduplication (QUALIFY ROW_NUMBER()) and sensitive-value / cold erasure tombstone handling.
    • TieredQueryExecutor & TieredTriples: Routes live/recent cuts (> W) 100% to hot SQL (0 DuckDB calls), federates historical/cross-boundary cuts across hot + cold, preserves opaque pagination cursors across W, and maintains pre- vs. post-compaction parity for query, queryPage, history, transactions, transactionsForEntity, Why.why, and Sensitive.

Scaling & Agent-Workflow RFCs (docs/rfcs/, docs/roadmap.md)

  • docs/rfcs/cold-tier-duckdb.md
  • docs/rfcs/distributed-datalog.md
  • docs/rfcs/hybrid-retrieval-datalog.md
  • docs/rfcs/agent-branches.md
  • docs/rfcs/incremental-derivations-and-bounded-reads.md
  • Updated docs/roadmap.md with links to all new RFCs and tx1-scoped-concurrency.md.

Verification

  • pnpm --filter @triplex-build/triplex-duckdb test: 3/3 test files, 23/23 tests passed (conformance.test.ts 4/4, compaction.test.ts 9/9, tiered.test.ts 10/10)
  • pnpm --filter @triplex-internal/core build && typecheck: passed
  • pnpm --filter @triplex-build/triplex-duckdb build && typecheck: passed
  • oxfmt --check and oxlint on all new/modified files: 0 warnings, 0 errors
  • node scripts/check-markdown-code.mjs && pnpm docs:build: passed (118 snippets, 60 local doc links)

@github-actions

Copy link
Copy Markdown
Contributor

Documentation preview: https://triplex-docs-pr-118.bjacobso.workers.dev

Commit: e1ff2ef

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant