Implement defragment operation for lsm_store #28

Open
opened 2023-11-16 19:01:12 +01:00 by Jef Roosens · 0 comments

An active database will inevitably accumulate some internal fragmentation. To fight this, a defragment operation can be introduced when can e.g. run on startup.

Implementing this should be very simple: iterate over the idx file, write any entries with a length greater than zero to a new idx file, and write the respective data from the database to a new database file. The indexes of the idx file entries will need to be adjusted though, as the database file's offsets will have changed.

An active database will inevitably accumulate some internal fragmentation. To fight this, a defragment operation can be introduced when can e.g. run on startup. Implementing this should be very simple: iterate over the idx file, write any entries with a length greater than zero to a new idx file, and write the respective data from the database to a new database file. The indexes of the idx file entries will need to be adjusted though, as the database file's offsets will have changed.
Jef Roosens added the
feature
label 2023-11-16 19:01:12 +01:00
Jef Roosens changed title from Implement vacuum operation for `lsm_store` to Implement defragment operation for `lsm_store` 2023-11-16 19:01:33 +01:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Chewing_Bever/lander#28
There is no content yet.