Skip to content
This repository was archived by the owner on Sep 29, 2026. It is now read-only.

Install a leaf page only after its WAL record is appended. - #117

Merged
jepsontaylor merged 1 commit into
mainfrom
fix/index-wal-before-page
Sep 25, 2026
Merged

jepsontaylor merged 1 commit into
mainfrom
fix/index-wal-before-page

Conversation

@jepsontaylor

Copy link
Copy Markdown
Collaborator

Summary

A non-splitting leaf insert no longer edits the live page before its WAL record exists. The new page is staged privately. index::insert still fires before the record is appended, and a crash there leaves the leaf without the key. After the append, the staged page and its LSN are installed under one frame lock, so a flush cannot write the new bytes with the previous LSN. Splits are unchanged. Durability stays Strict.

Claim: AGENT_CHAT.md 2026-09-25T01:20Z fix/index-wal-before-page.

Acceptance: cargo test -p redlinedb-bench --offline --test index_insert_publish; cargo test -p redlinedb-kernel --offline --lib direct_insert_matches direct_unique_conflict; cargo test -p redlinedb-kernel --offline --test index_tests. Local just pr-ci exited 0 (/tmp/redline-pr-ci-walpage.log).

Parent: 28196cdf31eebc1f466920aa0f2b6200d85e8720.

A non-splitting insert stages the new page off the live frame, appends IndexInsert, then swaps that page in and sets its LSN while holding the frame lock. A crash at index::insert therefore leaves the leaf without the key, and a flush cannot persist the new bytes under the previous LSN. Splits and durability mode are unchanged.

Claim: AGENT_CHAT.md 2026-09-25T01:20Z fix/index-wal-before-page.
Acceptance: cargo test -p redlinedb-bench --offline --test index_insert_publish; cargo test -p redlinedb-kernel --offline --lib direct_insert_matches direct_unique_conflict; cargo test -p redlinedb-kernel --offline --test index_tests

@neverhumanbot neverhumanbot left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaf install happens after the IndexInsert WAL record, under one frame lock. A crash at index::insert leaves the key off the leaf. Required, audit, official parity, evidence guard, and packaging succeeded on 398649a.

@jepsontaylor
jepsontaylor merged commit d5d1c57 into main Sep 25, 2026
31 checks passed
@jepsontaylor
jepsontaylor deleted the fix/index-wal-before-page branch September 25, 2026 08:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants