Skip to content

fix(store): serialize usage checkpoint DDL - #718

Merged
Gajesh2007 merged 5 commits into
masterfrom
fix/usage-totals-checkpoint-ddl-race
Aug 25, 2026
Merged

Gajesh2007 merged 5 commits into
masterfrom
fix/usage-totals-checkpoint-ddl-race

Conversation

@Gajesh2007

@Gajesh2007 Gajesh2007 commented Aug 25, 2026 •

Copy link
Copy Markdown
Member

Summary

  • move usage_totals_backfill_state creation out of the unconditional startup statement list
  • create the checkpoint table only after acquiring the usage-migration advisory lock
  • add an eight-way real-PostgreSQL regression proving concurrent coordinators cannot race in PostgreSQL catalogs

Follow-up to #665. The accounting state machine is unchanged; this closes the concurrent-start race found during its release review.

Before

flowchart LR
  subgraph Behavior
    B1[Concurrent coordinator starts] --> B2[Both create checkpoint table]
    B2 --> B3[PostgreSQL catalog uniqueness race]
    B3 --> B4[One coordinator fails startup]
  end
  subgraph Code
    C1[PostgresStore migrate loop] --> C2[CREATE TABLE IF NOT EXISTS]
    C2 --> C3[Later acquire advisory lock]
  end
Loading

After

flowchart LR
  subgraph Behavior
    B1[Concurrent coordinator starts] --> B2[One acquires migration lock]
    B2 --> B3[Checkpoint table created once]
    B3 --> B4[Other starts observe completed DDL]
  end
  subgraph Code
    C1[migrateUsageTotals] --> C2[Acquire advisory lock]
    C2 --> C3[CREATE TABLE IF NOT EXISTS]
    C3 --> C4[Run migration state machine]
  end
Loading

Test plan

  • focused migration suite against isolated PostgreSQL 16, 10 repetitions
  • complete coordinator/store suite against isolated PostgreSQL 16
  • eight-way concurrent checkpoint-table creation regression
  • complete coordinator suite (go test ./... -count=1)
  • repository pre-push Go tests, TypeScript lint, and Next.js build

cursoragent and others added 4 commits August 22, 2026 07:45
Co-authored-by: gajesh <gajesh@eigenlabs.org>
Co-authored-by: gajesh <gajesh@eigenlabs.org>
Co-authored-by: gajesh <gajesh@eigenlabs.org>
Keep checkpoint creation behind the migration advisory lock so concurrent coordinator starts cannot race in PostgreSQL's catalogs.

Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel

vercel Bot commented Aug 25, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
d-inference Ready Ready Preview Aug 25, 2026 6:01am
d-inference-console-ui-dev Ready Ready Preview Aug 25, 2026 6:01am
d-inference-landing Ready Ready Preview Aug 25, 2026 6:01am

Request Review

Resolve the post-#665 branch update by retaining only the serialized checkpoint DDL fix and its regression coverage.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Gajesh2007 Gajesh2007 changed the title fix(store): skip usage totals backfill safely fix(store): serialize usage checkpoint DDL Aug 25, 2026
@Gajesh2007
Gajesh2007 merged commit 9e65d91 into master Aug 25, 2026
12 of 14 checks passed

This branch had an error being deployed

1 failed and 3 active deployments
Preview – d-inference — 76d2d461 Deployed Aug 25, 2026 by vercel[bot]
Preview – d-inference-console-ui-dev — 76d2d461 Deployed Aug 25, 2026 by vercel[bot]
Preview – d-inference-landing — 76d2d461 Deployed Aug 25, 2026 by vercel[bot]
benchmarks — 76d2d461 Deployed Aug 25, 2026 by Gajesh2007 via E2E Benchmarks #439
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.

2 participants