Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: File format version 3 #894

Open
cberner opened this issue Nov 13, 2024 · 2 comments
Open

RFC: File format version 3 #894

cberner opened this issue Nov 13, 2024 · 2 comments

Comments

@cberner
Copy link
Owner

cberner commented Nov 13, 2024

This issue is for tracking and discussing potential changes for a version 3 file format

1) Change persistent savepoint storage to make restore_savepoint() faster

As described in the design doc savepoint restore could be faster if the freed tree was split into two: one for the system tables and one for normal tables, and then a table to track allocations needs to be added too.

2) Change allocator state to be stored in a system table

PR #893 demonstrates how the allocator state can be moved into a system table instead of a special part of the file format. Assuming it's merged, it would be better to unify all allocator state storage to use the system table approach, instead of having two code paths

@mconst
Copy link
Contributor

mconst commented Nov 13, 2024

It would be great to get rid of the old allocator state! Note that it's actually possible to do that without breaking compatibility, if you want:

First, we'd add code that makes an empty commit on shutdown with set_quick_repair(true) (this can be skipped if the user's last commit already used that option). Then, after a transition period, we can just delete all the code that reads and writes the old allocator state. You'd still be able to open any database with any redb version, and if the database has been opened at least one during the transition period, it'll open cleanly. Otherwise it'll require repair, but it'll always work.

Effectively, we'd be deleting the "normal" database open path, leaving only quick-repair and full repair. The recovery_required bit would be permanently set.

@cberner
Copy link
Owner Author

cberner commented Nov 14, 2024

Oh ya, nice! I hadn't thought that through, but doing it without breaking compatibility would be nice. It'll leave some unused space in the file, but that's pretty minimal. ~256KiB for every 4GiB, or so, if I recall correctly

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

No branches or pull requests

2 participants