-
Notifications
You must be signed in to change notification settings - Fork 157
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
Gc-based snapshots #2125
Gc-based snapshots #2125
Conversation
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.
Deadly simple!
src/irmin-pack/unix/s.ml
Outdated
prefix_commit_offset : int63; | ||
} | ||
|
||
val export : repo -> commit_key -> snap Lwt.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.
Following an offline discussion with @icristescu, a good story for that export function could be that export takes the path where a directory will be created containing a new fully functional irmin-pack store which contains only the commit (and it's tree).
This way, no import function is needed.
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.
Would it make sense to separate the export
from running the GC? (= copy the existing prefix/mapping with first_commit
as commit_key
, without running a (destructive) GC to build the snapshot)
Nevermind I missread the finalize!
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.
IIUC, this code runs the worker part of the normal GC but doesn't run the finalise part of the normal GC.
The worker part only creates new files, it doesn't modify the existing files in any way.
Does this answer your question?
Sure
If I understand correctly, the
How could we avoid that? |
Indeed, I have not though about this case. Isn't it the case that currently we don't run a node and do a snapshot export at the same time? To allow a concurrent snapshot export I think it could work as follow (I'm rephrasing a bit your suggestions):
So either way, cancelling or skipping is maybe not too complicated. What is less trivial I think is the "postponing" part. |
No. Snapshots can be exported while the octez node is running. We want to keep that feature and it should not interfere too much with the node's life.
There should be no interliving, indeed. However, it seems a good property not to cancel a running GC. Thus you will always perform a GC as some point. That is not guaranteed if the GC may be cancelled. To me, skipping the "real GC" if a "snapshot GC" is running is not fine. That is the main issue.
|
67cf48a
to
78ee6a8
Compare
this is ready for another round of reviews |
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 really like this solution to updating snapshot as a simple export of a "one commit store". I left some thoughts on naming/code organization.
Codecov Report
@@ Coverage Diff @@
## main #2125 +/- ##
==========================================
+ Coverage 68.17% 68.21% +0.04%
==========================================
Files 134 134
Lines 16042 16085 +43
==========================================
+ Hits 10937 10973 +36
- Misses 5105 5112 +7
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
…ils, irmin-test, irmin-pack, irmin-mirage, irmin-mirage-graphql, irmin-mirage-git, irmin-http, irmin-graphql, irmin-git, irmin-fs, irmin-containers, irmin-cli, irmin-chunk and irmin-bench (3.5.0) CHANGES: ### Added - **irmin-pack** - Add `Irmin_pack_unix.Stats.Latest_gc` which is now the parameter of GC's `finished` callback (mirage/irmin#2089, @Ngoguey42) - Add `Gc.oldest_live_commit` which returns the key of the commit on which the latest gc was called on. (mirage/irmin#2110, @icristescu) - Add `split` to create a new suffix chunk. Subsequent writes will append to this chunk until `split` is called again. (mirage/irmin#2118, @icristescu) - Add `create_one_commit_store` to create a new store from the existing one, containing only one commit. (mirage/irmin#2125, @icristescu) ### Changed - **irmin-pack** - Upgraded on-disk format to version 4. (mirage/irmin#2110, @icristescu) - Detecting control file corruption with a checksum (mirage/irmin#2119, @art-w) - Change on-disk layout of the suffix from a single file to a multiple, chunked file design (mirage/irmin#2115, @metanivek) - Modify GC to work with new chunked suffix. See `examples/gc.ml` for a demonstration of how it works with the new `split` function. (mirage/irmin#2126, @metanivek) ### Fixed
…ils, irmin-test, irmin-pack, irmin-mirage, irmin-mirage-graphql, irmin-mirage-git, irmin-http, irmin-graphql, irmin-git, irmin-fs, irmin-containers, irmin-cli, irmin-chunk and irmin-bench (3.5.0) CHANGES: ### Added - **irmin-pack** - Add `Irmin_pack_unix.Stats.Latest_gc` which is now the parameter of GC's `finished` callback (mirage/irmin#2089, @Ngoguey42) - Add `Gc.oldest_live_commit` which returns the key of the commit on which the latest gc was called on. (mirage/irmin#2110, @icristescu) - Add `split` to create a new suffix chunk. Subsequent writes will append to this chunk until `split` is called again. (mirage/irmin#2118, @icristescu) - Add `create_one_commit_store` to create a new store from the existing one, containing only one commit. (mirage/irmin#2125, @icristescu) ### Changed - **irmin-pack** - Upgraded on-disk format to version 4. (mirage/irmin#2110, @icristescu) - Detecting control file corruption with a checksum (mirage/irmin#2119, @art-w) - Change on-disk layout of the suffix from a single file to a multiple, chunked file design (mirage/irmin#2115, @metanivek) - Modify GC to work with new chunked suffix. See `examples/gc.ml` for a demonstration of how it works with the new `split` function. (mirage/irmin#2126, @metanivek) ### Fixed
After discussions with @vect0r-vicall, I'm working on a new snapshot export that:
The import:
This is WIP, but I would appreciate any feedback, in case I missed something. Things that I see to improve are: