Skip to content

CockroachDB metadata-store support report + e2e test harness - #24

Open
fuziontech wants to merge 1 commit into
mainfrom
crdb-metadata-store-report
Open

CockroachDB metadata-store support report + e2e test harness#24
fuziontech wants to merge 1 commit into
mainfrom
crdb-metadata-store-report

Conversation

@fuziontech

Copy link
Copy Markdown
Member

What

An experiment: how well does CockroachDB work as a DuckLake metadata store? This PR adds the resulting support report (experiments/crdb/REPORT.md) plus the docker-compose setup, test scripts, and raw outputs to reproduce it.

Tested: DuckDB v1.5.3 + ducklake against CockroachDB v25.2.19 (single node, docker compose), with Postgres 17 as a control baseline.

TL;DR of the findings

Verdict: near-supportable. With two scanner settings, the entire core feature surface passes (DDL, DML, deletion vectors, snapshots, time travel, schema evolution, transactions, views, partitioning, compaction, data inlining, change feeds, concurrent readers):

SET GLOBAL pg_use_text_protocol = true;  -- CRDB has no binary COPY (cockroachdb#96590)
SET GLOBAL pg_use_ctid_scan = false;

Two real gaps remain, both fixable upstream:

  1. ducklake_expire_snapshots() / ducklake_flush_inlined_data() fail — these route metadata DELETEs through DuckDB's DML planner on the attached catalog, and postgres_scanner addresses rows by ctid, which CockroachDB doesn't expose. Every other metadata write goes through raw postgres_execute passthrough and works fine; routing these DELETEs the same way would fix it (and save round trips on vanilla Postgres too). Until then the catalog grows forever.
  2. Concurrent writers lose ~24% of commits — CRDB reports commit races as SQLSTATE 40001 restart transaction: ... WriteTooOldError, which RetryOnError() doesn't match (it expects Postgres's "duplicate key ... unique" message). A one-line patch (match "restart transaction") was built and verified: 0/45 failed commits vs 11/45 unpatched. The same gap technically exists for vanilla PG's "could not serialize access" message.

Perf: ~2× slower metadata commits than PG17 single-node (~0.5s vs ~0.27s per attach+commit cycle) — expected for a consensus engine; data-file I/O unaffected.

Notes

  • Report only — no source changes in this PR. The verified RetryOnError patch is included as a snippet in the report if we want to follow up with a code PR.
  • Not tested: multi-node CRDB, the full SQL test suite under a CRDB config, catalog version migrations.

🤖 Generated with Claude Code

Experiment: audit + full end-to-end test of CockroachDB v25.2 as a
DuckLake metadata catalog (docker compose, single node, Postgres 17
as control baseline).

Verdict: near-supportable. Core feature surface passes with
pg_use_text_protocol=true / pg_use_ctid_scan=false. Two real gaps:
- ducklake_expire_snapshots() / ducklake_flush_inlined_data() fail
  (ctid-based DELETE path in postgres_scanner; CRDB has no ctid)
- concurrent writers lose ~24% of commits (CRDB 40001 "restart
  transaction" errors not matched by RetryOnError); a one-line
  patch fixes it, verified 0/45 failures

See experiments/crdb/REPORT.md for details and repro scripts.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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