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.
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 :)
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 theindex
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.