Skip to content

feat(index): catch the index up from the op log - #108

Open
PiquelChips wants to merge 1 commit into
feat/events-oplog-writersfrom
feat/events-index-catch-up
Open

PiquelChips wants to merge 1 commit into
feat/events-oplog-writersfrom
feat/events-index-catch-up

Conversation

@PiquelChips

Copy link
Copy Markdown
Member

A batch appended its records to the index before publishing them, and marked them published afterwards. With the op log, every batch was logged twice, and each log was synced.

Writers no longer touch the index. A batch logs its records in the op log, with what the index keeps of them, synced with the records. Opening the index catches up: it reads the op log after the last entry it has, adds the records that are published, and appends them to the index without syncing. If a crash loses an appended frame, the index catches up again from the op log. If the op log no longer keeps those entries, the index is rebuilt.

The index stops before an entry whose write is still in progress, and looks at it again next time. It takes records published after that entry, such as this process's own, in memory only, since a power loss may take them back before their entry settles. The index only writes records of settled entries. A rebuild starts from the op log's last settled entry and keeps the records of later entries in memory the same way. The index format moves to version 3.

rebuilds_never_miss_concurrent_writes passed 300/300 with the op log's segment fix.

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: 1ca4bed0-b071-47cf-bfd2-53bedba8a3cf
Commits

Reviewing files that changed from the base of the PR and between 86d72da and 81d71fa.

Files selected for processing: 4

  • apps/origin-src/src/index.rs
  • apps/origin-src/src/oplog.rs
  • apps/origin-src/src/store/mod.rs
  • apps/origin-src/src/targets.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-index-catch-up branch 2 times, most recently from b20ec4a to 8a31bb2 Compare November 22, 2026 18:54
A batch appended its records to the index before publishing them, and
marked them published after, under a shared index lock. With the op log
there were two logs of every batch, each synced.

Writers no longer touch the index: a batch logs its records in the op
log, with what the index keeps of them, synced with the records. Opening
the index catches up: it reads the op log after the last entry it has,
adds the records that are published, and appends them to the index, with
that entry's sequence number, without syncing. A frame lost to a crash is
caught up again from the op log, and if the op log no longer keeps the
entries, the index is rebuilt.

An entry whose write is still in progress is looked at again next time.
The records published after it meanwhile, such as this process's own, are
taken in memory only, since a power loss may take them back before their
entry settles. A rebuild starts from the op log's last settled entry, and
keeps the records of later entries in memory the same way.

The index's format moves to version 3.
@PiquelChips
PiquelChips force-pushed the feat/events-index-catch-up branch from 8a31bb2 to 81d71fa 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