-
Notifications
You must be signed in to change notification settings - Fork 50
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
IDEA: restore kvs from persist-directory #777
Conversation
Allow a NULL JSON object to be sent in flux_rpc().
Add "if not exists" to CREATE TABLE command when opening content store to allow the open of an existing content store sqlite file.
Do not issue a fatal error on mkdir() if persist directory already exists. This allows opening an existing persist directory.
Add a simple script to dump `kvs.getroot` result to stdout.
If persist-directory is set save kvs root information along with joblog.
Add command to set kvs root from a Lua table in a file.
Test automatic `flux kvs-getroot` with persist-directory, along with kvs restore from a new session using `flux kvs-setroot`.
Current coverage is 74.76% (diff: 88.88%)@@ master #777 diff @@
==========================================
Files 145 145
Lines 25022 25025 +3
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
- Hits 18712 18711 -1
- Misses 6310 6314 +4
Partials 0 0
|
Does this at all or How does this relate to the cvs snapshot idea captured on various issue tickets including #76? |
I do remember having discussions about this and similar ideas for kvs snapshot/restore, but I searched for related issues and was unsuccessful at finding them. This particular PR is more like a "stunt" to show feasibility, but I do have at least one idea for its use in testing, for example to reuse a kvs already populated with large number of jobs, large task count, or lots of IO etc -- for more efficient testing... |
I am a big fan of use case-based development! I'm just throwing other areas which can potentially benefit from similar enhancements. I don't remember exactly, but such a capability can help one implement various consistency models over how our cvs can be used in distributed computing : #77. |
Hm, I didn't see how #77 is related, is that the correct issue? I think in general the design of the kvs lends itself to easily supporting snapshots, rollback, historical "views" etc. This particular case is probably just a reduction to the simplest useful case. I was pretty happy at how easy it was to get something working, so I though I'd post to get some discussion. |
Oops. Fat finger -- doing this while prepping for church this morning. The issue I was trying to refer to was: #206 |
Thanks @dongahn, What is proposed here is nothing as complex as some of things described in #206, except that something like |
This is great and without having looked in too much detail, sounds like what I had imagined for a sort of checkpoint/restart for a session. Make sure not to violate the invariant that the "rootseq" is monotonically increasing, e.g. setroot should not allow that number to go backwards. |
Great point! I was thinking It might be useful for now to store the kvs root info with persist-directory just because... |
I wonder if maybe we need a new operation like int kvs_link (flux_t h, const char *key, const char *blobref, bool directory); that would allow any object to be grafted into the namespace by reference, with say a NULL key or a key of The "rootseq" could be managed in the usual way by the rank 0 commit logic. In addition to the above use case, this would allow hierarchies of KVS data to be built up using another mechanism (such as through reductions), then added with one commit. |
This is a great idea. The more I think about the approach in this current PR the more I realize, though simple, it probably isn't feasible even for the proposed testing use case. The tricky bits are:
I will probably close this pr unless there is something we want to capture into issues first (@garlick's |
I'm less worried about your first point as I hope KVS metadata changes will be infrequent and deliberate, and the next change will introduce metadata versioning as described in RFC 11 On test content-stores - maybe the right way to go about this is to provide tools so a content store could be created quickly offline with scripts and then provided to I'm OK if you want to close this. I can create a |
@garlick, yes your idea for test content stores is perfect for my use case. Thanks! |
Since this PR a few built-in tools have been added which make this problem easier to solve. It's possible to save/restore a KVS root (although the root cannot overwrite the current root):
It seems like adding a getroot to the rc3, within the |
For testing purposes, it would be nice to be able to restore a previous kvs state to test against, instead of creating the kvs state on the fly. For example, there is a bug in
flux wreck attach
that seems to only be triggered from a lwj with >32K tasks. Rather than write a test that first runs 32K tasks (or even simulates a run of 32K tasks by writing to kvs), it would be nice to start with an existingpersist-directory
content store, and "recover" the kvs using the last know rootdir sha1 hash.This PR is just a proof-of-concept of that idea (original credit going to @garlick for the idea).
Two new "plumbing" type commands are added
flux kvs-getroot
andflux kvs-setroot
which are simple interfaces tokvs.getroot
andkvs.setroot
message/events.If persist-directory is set, the output of
kvs.getroot
is saved to the persist-directory.In order for the content store to "restart" from and existing sqlite db, two kind of hackish mods were made to the content-sqlite
Once a session is started using a previous
persist-directory
, the kvs can then be "restored" with a command like:I'm guessing this is a bit dangerous without some further sanity checks, so I'd only propose this for testing at this point. Here's some results