Skip to content

[db] Do in place shrinking of values in Storage #1783#1795

Merged
michaelvlach merged 2 commits intomainfrom
1783-db-reuse-existing-deleted-blocks-in-storage
May 2, 2026
Merged

[db] Do in place shrinking of values in Storage #1783#1795
michaelvlach merged 2 commits intomainfrom
1783-db-reuse-existing-deleted-blocks-in-storage

Conversation

@michaelvlach
Copy link
Copy Markdown
Collaborator

No description provided.

@michaelvlach michaelvlach requested review from agnesoft and Copilot May 2, 2026 07:10
@michaelvlach michaelvlach linked an issue May 2, 2026 that may be closed by this pull request
@vercel
Copy link
Copy Markdown

vercel Bot commented May 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agdb Ready Ready Preview, Comment May 2, 2026 7:28am

Copy link
Copy Markdown
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 updates the core Storage shrinking logic to support in-place value shrink when enough space can be reclaimed, and adds regression tests to ensure storage layout/reading remains correct after shrinking.

Changes:

  • Update Storage::shrink_value to optionally write an “empty record” into reclaimed space instead of always moving the record to the end.
  • Add Storage::write_empty helper to persist an empty record header.
  • Add tests for in-place shrinking behavior in MemoryStorage and reload/readability behavior in FileStorage.

Reviewed changes

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

File Description
agdb/src/storage.rs Implements in-place shrinking by writing an empty record into reclaimed space.
agdb/src/storage/memory_storage.rs Adds tests covering in-place shrink behavior, truncation-at-end, and compaction via optimize_storage().
agdb/src/storage/file_storage.rs Adds a persistence/reload test to ensure storages with holes remain readable.

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

Comment thread agdb/src/storage/memory_storage.rs
Comment thread agdb/src/storage/memory_storage.rs Outdated
Comment thread agdb/src/storage/file_storage.rs
@michaelvlach michaelvlach merged commit afcac82 into main May 2, 2026
11 checks passed
@michaelvlach michaelvlach deleted the 1783-db-reuse-existing-deleted-blocks-in-storage branch May 2, 2026 07:36
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.

[db] Do in place shrinking of values in Storage

3 participants