Skip to content

Conversation

@kTrzcinskii
Copy link
Member

Updated cache to allow dropping multiple pages as one MultiPageOperation to wal.
If PinnedWritePage has diffs during its drop then they are sent as SinglePageOperation to wal.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements automatic and manual WAL (Write-Ahead Log) logging for page modifications in the storage cache. When a PinnedWritePage is dropped, its diffs are automatically sent to the WAL as a single-page operation. Alternatively, multiple pages can be manually dropped together using Cache::drop_write_pages() to create an atomic multi-page WAL operation.

Key changes:

  • Added automatic WAL logging on PinnedWritePage drop for pages with modifications
  • Implemented Cache::drop_write_pages() method to batch multiple page updates into a single atomic WAL operation
  • Changed wal_client in Cache from Option<WalClient> to Option<Arc<WalClient>> to enable sharing across PinnedWritePage instances

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.

File Description
storage/src/page_diff.rs Added empty() method to check if a PageDiff has any diffs (used to avoid logging empty changes)
storage/src/cache.rs Added wal field to PinnedWritePage, implemented automatic WAL logging in Drop, added drop_write_pages() method for batching, changed wal_client to use Arc, and added comprehensive tests for all WAL logging scenarios

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kTrzcinskii kTrzcinskii merged commit f7969eb into main Jan 1, 2026
1 check passed
@kTrzcinskii kTrzcinskii deleted the feat/cache-api-for-diff-in-wal branch January 1, 2026 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[STORAGE] Create API for sending requests to wal when dropping pages

3 participants