mirage / irmin

Irmin is a distributed database that follows the same design principles as Git
https://irmin.org
ISC License
1.84k stars 153 forks source link

irmin-pack-tool: Add a tool for last indexed accessible commits #2218

Open clecat opened 1 year ago

clecat commented 1 year ago

This PR aims to help restoring a store to a previous state when a corruption occurs.

It uses the index of the store in order to find the latest commit indexed which is available in the suffix files. It should become useful in the case of a control file being updated, but the suffixes staying behind (i.e. power outage).

There might be some work to do in order to ensure that we do it correctly, but a good direction we discussed @art-w and I for this PR would be to re-generate a working control file which a user could use in order to avoid deleting and reinstalling it's store. We might however have some issues with data registered in the index and such, but we still wanted to create a draft PR to open the discussion.

One last point is that this PR currently makes several assumptions based on the control file and it's validity, and we might want to create additional checks which do not use it.

art-w commented 1 year ago

Thanks! Do you mind addressing @metanivek comments and running dune build @fmt? I think this PR is an important step towards behind able to repair a broken control file :)