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

irmin-pack: update flush, close and reload to return `Ro_not_allowed instead of raising an exception #2044

Merged
merged 2 commits into from Aug 11, 2022

Conversation

zshipko
Copy link
Contributor

@zshipko zshipko commented Aug 10, 2022

Closes #2043

@zshipko zshipko requested a review from metanivek August 10, 2022 18:00
@codecov-commenter
Copy link

codecov-commenter commented Aug 10, 2022

Codecov Report

Merging #2044 (62e4641) into main (b5d5e3f) will decrease coverage by 0.05%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main    #2044      +/-   ##
==========================================
- Coverage   64.48%   64.43%   -0.06%     
==========================================
  Files         130      130              
  Lines       15604    15607       +3     
==========================================
- Hits        10063    10056       -7     
- Misses       5541     5551      +10     
Impacted Files Coverage Δ
src/irmin-pack/unix/pack_index.ml 63.88% <0.00%> (-5.81%) ⬇️
src/irmin-fs/unix/irmin_fs_unix.ml 64.51% <0.00%> (-3.23%) ⬇️
src/irmin-fs/irmin_fs.ml 81.21% <0.00%> (-1.22%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@metanivek
Copy link
Member

Thanks! Could you look to see if octez code needs updating with the new error?

type error :=
[ `Index_failure of string
| `Io_misc of Io.Unix.misc_error
| `Ro_not_allowed ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since v does not use Ro_not_allowed it might be nice to not include it in its error type but I'm not sure of good names to distinguish the two categories of error. My first thought was create_error and write_error but write seems a little too broad. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

write_error sounds fine, or we could do create_error and keep error (which is even more generic 😄)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kk, lets go with write_error

@zshipko
Copy link
Contributor Author

zshipko commented Aug 10, 2022

Okay, I split out the write_error and create_error

Thanks! Could you look to see if octez code needs updating with the new error?

It seems unaffected

@metanivek
Copy link
Member

Thanks for checking. To satisfy my own curiosity, I just took a look to answer the question of why not. Turns out we raise exceptions on error at the store boundary:

let flush t = File_manager.flush ?hook:None t.fm |> Errs.raise_if_error

So now callers will get a Ro_not_allowed exception instead of an assertion failure, which is a better situation.

@metanivek metanivek merged commit 39afb7b into mirage:main Aug 11, 2022
@metanivek metanivek changed the title Update flush, close and reload to return `Ro_not_allowed instead of raising an exception irmin-pack: update flush, close and reload to return `Ro_not_allowed instead of raising an exception Aug 11, 2022
@zshipko zshipko deleted the readonly-flush-error branch August 11, 2022 15:00
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.

irmin-pack: assertion failure when calling flush for a read-only index
3 participants