Expose a type for snapshots in inodes#1757
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1757 +/- ##
==========================================
- Coverage 64.63% 64.54% -0.10%
==========================================
Files 116 118 +2
Lines 14159 14375 +216
==========================================
+ Hits 9152 9278 +126
- Misses 5007 5097 +90
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
a47de7b to
0d7ce97
Compare
|
thanks for the suggestions @Ngoguey42 |
0d7ce97 to
3a06dc2
Compare
48227d5 to
ebf3177
Compare
|
The
The size of the snapshot on disk obtained after the export with master is
The The corresponding tezos commit is [here] (icristescu/tezos@58f6f3d). Thanks @Ngoguey42 and @maiste for the recording branch, very useful for benchmarking :) |
3274415 to
e9f0e09
Compare
src/irmin-pack/s.ml
Outdated
| - if [on_disk] is [`Reuse] the store's index is reused. *) | ||
|
|
||
| val export : | ||
| ?on_disk:on_disk -> |
There was a problem hiding this comment.
Does ~on_disk:`Reuse make sense in the context of export?
There was a problem hiding this comment.
no, it doesn't, I wanted to reuse the same type for import and export.
I replaced on_disk with string for export. I don't like so much, because its less clear, but if you think its better I'll leave it like this.
There was a problem hiding this comment.
Let's just remove the `Reusable tag from the current types. That way most of the symmetry is kept
There was a problem hiding this comment.
I actually meant removing `Reusable from export only, and not from import.
?on_disk:[ `Path of string ] in export and ?on_disk:[ `Path of string | `Reuse ] in import.
Reuse was a good feature, I think it should be in this PR. Sorry for the ambiguous message :(
93c7441 to
eb8a3a3
Compare
Ngoguey42
left a comment
There was a problem hiding this comment.
Second part of my review :)
I still have to review the inode code
01e2f29 to
5240d7d
Compare
| in | ||
| let entry_of_address = function | ||
| | Compress.Offset offset -> entry_of_offset offset | ||
| | Hash h -> entry_of_hash h |
There was a problem hiding this comment.
FYI: Reaching this line is the sign that h is dangling.
In Tezos it only happens when importing a full snapshot because of a small bug in check_protocol_commit_consistency that was fixed since.
You can leave your code as is.
src/irmin-pack/inode.ml
Outdated
| let get_key ~index h = | ||
| match index h with | ||
| | None -> | ||
| Fmt.failwith | ||
| "get_key: You are trying to save to the backend an inode \ | ||
| deserialized using [Irmin.Type] that used to contain pointer(s) \ | ||
| to inodes which are unknown to the backend. Hash: %a" | ||
| pp_hash h | ||
| | Some key -> key |
There was a problem hiding this comment.
I think it would be better for index to have the index:(hash -> key) signature (instead of index:(hash -> key option)). You could then raise the exception from a place that has more context.
5240d7d to
6520226
Compare
5f16aa2 to
ef8a45b
Compare
…min-test, irmin-pack, irmin-mirage, irmin-mirage-graphql, irmin-mirage-git, irmin-http, irmin-graphql, irmin-git, irmin-fs, irmin-containers, irmin-chunk and irmin-bench (3.2.0) CHANGES: ### Added - **irmin-pack** - Add `forbid_empty_dir_persistence` in store configuration. (mirage/irmin#1789, @Ngoguey42) - Add `Store.Snapshot` to expose the inodes for tezos snapshots (mirage/irmin#1757, @icristescu). ### Changed - **irmin** - Add error types in the API or proof verifiers. (mirage/irmin#1791, @icristescu) - Reduced the memory footprint of ``Tree.fold ~uniq:`True`` by a factor of 2. (mirage/irmin#1770, @craigfe)
I added a test that shows how this is used in tezos, and also tarides/tezos#19