Skip to content

Edge: stop storing the push head and backup flag, 3 → 2 rows (stage 2 of 2) - #798

Draft
wingleeio wants to merge 1 commit into
edge/cut-chatroom-row-writesfrom
edge/drop-stored-heads
Draft

wingleeio wants to merge 1 commit into
edge/cut-chatroom-row-writesfrom
edge/drop-stored-heads

Conversation

@wingleeio

@wingleeio wingleeio commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #746. Merge only after #746 has been live long enough that rolling back past it is off the table.

What

#746 derives ChatRoom/RegistryRoom heads from the log (MAX(seq) floored by seqFloor / gcFloor, with the stored copy as a lower bound). It gates the nightly backup on head > backupSeq. It still stores headSeq / seq and backupDirty on every push, because older releases read only those.

This PR stops storing them. A push then writes only its data: 3 → 2 rows, about $7 → $5 a day at current traffic.

Rollback

The floor is #746. Releases older than that trust only the stored head, which no longer keeps up here, so they would reissue seqs. #746's readers handle state written by this release, and the tests pin that:

  • a ChatRoom head the stored copy never saw continues at the right seq;
  • a RegistryRoom seq the stored copy never saw continues without reissuing;
  • backups run with no dirty flag at all.

Tests

  • Write counts (workerd cursors): append 2, ChatRoom push 2, RegistryRoom one-row push 2.
  • tsc ✅
  • vitest run (63) ✅
  • vitest run -c vitest.workerd.config.ts (34) ✅
  • wrangler deploy --dry-run ✅

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Stage 1 (#746) derives ChatRoom/RegistryRoom heads from the log and
gates backups on head > backupSeq, while still storing headSeq/seq and
backupDirty for older releases. With that release live as the rollback
floor, the stored copies are dead weight: a push now writes only its
data, 3 -> 2 rows.

Rollback must not go past #746: older releases trust only the stored
head, which no longer keeps up. Tests pin that #746's readers handle
state written here (a head and seq the stored copy never saw; backups
with no dirty flag).

Co-Authored-By: Claude Opus 5.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.

2 participants