Skip to content

Fix flush for initial writes - #158

Open
mark0-cn wants to merge 1 commit into
jonhoo:mainfrom
mark0-cn:codex/fix-initial-flush
Open

Fix flush for initial writes#158
mark0-cn wants to merge 1 commit into
jonhoo:mainfrom
mark0-cn:codex/fix-initial-flush

Conversation

@mark0-cn

Copy link
Copy Markdown

Summary

  • track operations written directly before the first publish
  • make has_pending_operations report those initial writes
  • make flush publish initial writes as documented
  • preserve empty extend as a non-pending operation

Root cause

Before the first publish, operations are applied directly to the write-side copy as an initialization optimization and never enter the oplog. has_pending_operations only inspected the oplog boundary, so it returned false after an initial write. flush consequently skipped the publish and readers continued to see the old value.

The new first_pending bit records whether that direct-write path consumed any operations and is cleared by the first successful swap.

Validation

  • cargo test --offline
  • cargo fmt --all -- --check
  • regression coverage for empty extend and append -> flush -> read

@mark0-cn mark0-cn changed the title [codex] fix flush for initial writes Fix flush for initial writes Jul 27, 2026
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