-
Notifications
You must be signed in to change notification settings - Fork 159
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
RO syncs #1008
RO syncs #1008
Conversation
src/irmin-pack/irmin_pack.ml
Outdated
let ro_sync t = | ||
Contents.CA.ro_sync (contents_t t); | ||
Node.CA.ro_sync (snd (node_t t)); | ||
Commit.CA.ro_sync (snd (commit_t t)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happens in the case where the 3 stores are actually the same store? Do we have a way to make this more efficient?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left only one ro_sync
call and added a comment.
747b57f
to
3ae1bc8
Compare
If during a merge, an RO instance calls ro_sync and then looks for a value, that was flushed to disk by the merge, it will lead to an exception raised instead of returning None (see https://github.com/mirage/irmin/pull/1008/files#diff-51f1262f591288eadf8719ee5f293b18R309). I added some tests that use the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added some tests that use the
force_merge
function from index, so I switched toPrivate.Make
in pack_index. I think this is fine, we are not allowed to use pack_index from outside irmin-pack, but maybe there is a cleaner way to do this?
I'm very uneasy about that. The private API of Index is now being exposed by Irmin_pack.Index
, and the tests get access to that API very easily (no references to Private
or such). Indeed, constructing a Pack
instance now requires the user to construct an Index
with the private API.
If testing Index dependencies requires them having access to the private API, perhaps we need to rethink the public API 🙂
df37485
to
57a150a
Compare
I would like to have a But we need to use the private API of index in this PR, the problematic behaviour of |
I removed the private API of index, and used |
As discussed offline, the tricky case of "flush to index before indexed value has been flushed to pack" could be solved by having Index support a pre-flush callback. We would use that callback to flush to Pack. |
(And we should be sure to |
I added the hook from mirage/index#189 in the latest commit, and the tests now work fine, no invalid_read is raised. |
0e5d531
to
2f62593
Compare
fcc376b
to
135f697
Compare
Thanks. Will wait for Travis to wake up and then merge. |
A straightforward implementation for RO sync. I'll add more tests (concurrent ones too) so for now its a draft.
The way I think
ro_sync
should be used is to catch exceptions for RO operations, and retryro_sync
in case of failure.Depends on mirage/index#175