Skip to content

feat(oplog): hold readers back while a write is in progress - #107

Open
PiquelChips wants to merge 1 commit into
feat/events-oplogfrom
feat/events-oplog-writers
Open

PiquelChips wants to merge 1 commit into
feat/events-oplogfrom
feat/events-oplog-writers

Conversation

@PiquelChips

Copy link
Copy Markdown
Member

An op log entry is appended before its write is committed, and synced with it. A reader that moved past it before then could hand out a cursor that a power loss takes back, and the next entry would reuse its number. A reader also couldn't tell a write in progress from one that crashed.

Each write now appends its entries as a writer: a lock file, oplog/writers/<n>, where n is the sequence number of its first entry, which every entry names. The writer creates and locks the file before it appends that entry, and removes it once the write is published. OpLog::settled is the entry up to which readers may read: the one before the first entry whose writer still holds its lock.

A crashed writer leaves its file behind, unlocked. Readers sync the segments that may hold its entries, remove the file, and take the entries' effects as what they find published. So a crashed writer stalls nothing.

Note

Written by Claude Opus 5.5 in Claude Code (via T3 Code)

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 34 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a8dc1b33-5fb8-4b93-a14c-654b2cb19ecb
Commits

Reviewing files that changed from the base of the PR and between 82e1b5c and 86d72da.

Files selected for processing: 1

  • apps/origin-src/src/oplog.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@PiquelChips
PiquelChips added this pull request to stack #165 November 22, 2026 14:59
@PiquelChips
PiquelChips force-pushed the feat/events-oplog-writers branch 2 times, most recently from 44b1311 to 11ab3cd Compare November 22, 2026 18:54
An entry is appended before its write is committed, and synced with it.
A reader that moved past it before then could hand out a cursor a power
loss takes back, and the next entry would reuse its number. Nor could a
reader tell whether a write was still in progress, or had crashed.

Each write now appends its entries as a writer: a lock file,
`oplog/writers/<n>`, `n` being the sequence number of its first entry,
which every entry names. It's created and locked before that entry is
appended, and removed once the write is published. `OpLog::settled` is
the entry up to which readers may read: the one before the first entry
whose writer still holds its lock.

A writer that crashed leaves its file behind, unlocked. Readers then sync
the segments that may hold its entries, remove the file, and take the
entries' effects as what they find published, so a crashed writer holds
nothing back.
@PiquelChips
PiquelChips force-pushed the feat/events-oplog-writers branch from 11ab3cd to 86d72da Compare November 22, 2026 19:20
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