-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
fsrepo migrations #950
fsrepo migrations #950
Conversation
@whyrusleeping not sure how you want to store things in keyspec, but is the layout in https://github.com/ipfs/specs/tree/master/repo/fs-repo#keys work for you? note the |
@jbenet thats a little non-standard (i was going for ssh-compliant naming and formats) but I can work with it. |
see discussion in #975 (comment) |
@jbenet why do you have a binary commited? |
@whyrusleeping because i fail. thanks
|
lets make sure it gets GCed out! 2MB makes a difference to new clones |
this looks good to me, i like the approach. |
@jbenet should the daemon check the repo version on startup, and run the appropriate migration tools? (or, prompt the user to run them) |
7d40540
to
d77c58c
Compare
@whyrusleeping for now prompt the user to run them. we can do things automatically later, but if something goes wrong for now, would be ideal to have the user on top of it |
d77c58c
to
3e6ea00
Compare
im not convinced we should have a tool for each migration, i think a single tool would be the better approach |
Need to make sure we can rest assured these will work years from now without our maintenance. The repo's code will progress, often change fundamentally. Forcing us to maintain things backwards compatible with all repo versions -- or even one tool -- is signing us up for pain in the future, testing with old things, etc. Instead, if we freeze its code now, with its own vendoring, we can count on these working with the current repo versions down the road. I'm envisioning a pretty simple setup where:
so we can go into any of these, compile and know it will work. depending on how we do things, we may not need to use godeps, we could just vendor directly (cp -r) what we need into those directories. |
vers := string(ver)[:1] | ||
|
||
if vers != RepoVersion { | ||
return nil, fmt.Errorf("Repo has incorrect version: '%s'\nProgram version is: '%s'\nPlease run the appropriate migration tool before continuing", |
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.
var MsgUpgradeRepo = `Repo has incorrect version: %s
Program version is: %s
Please run the repo migration tool before continuing:
<cmd for them to run>
`
I'll think about what a good way to do <cmd for them to run>
is. the problem is they:
- may not have it installed (installed ipfs as a binary).
- may not have go installed (may not be able to compile).
- do not have ipfs installed (cannot
ipfs cat <hash>/<arch>/1-to-2 >1-to-2
)
May be able to do something like:
wget http://gateway.ipfs.io/ipfs/<hash>/<arch>/1-to-2
chmod +x 1-to-2
./1-to-2
And ship a little shell script that does it as:
ipfs-repo-migrate 1-to-2
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.
go 1.5 is coming at such a good moment...
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.
we could at least just have a page somewhere discussing migrations, maybe a github repo, and link them to it in the error message
@whyrusleeping LGTM!! I'll write the script to download the migrations for us. |
// _before_ acquiring the daemon lock so the user gets an appropriate error | ||
// message. | ||
// NB: It's safe to read the config without the daemon lock, but not safe | ||
// to write. |
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.
@whyrusleeping will this still yield the right error?
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.
the errors returned may now differ, but they actually mean something now. the other error was completely worthless
@whyrusleeping the new changes may alter the semantics of ipfs startup. are the right errors still gotten? I'll start full tests manually. |
Every commit passed for me. And i think for @whyrusleeping as well. |
+1. We should probably vendor those just in case :| -- we dont have to use godeps. we can just copy-paste. (:open_mouth:!) |
im fine with copy pasting, especially since we are 'vendoring' with the explicit goal of never changing that code |
@whyrusleeping what's missing here? just the guide to upgrade? |
Just the guide. |
Migrations CR
now:
should be something like:
This should work on every machine with as few steps as possible. We could detect if Go is installed, and suggest using It's really funny, if ipfs worked during this process, or could install things from it, this would be so easy. lol 🐔 🥚 Hmm. maybe it can be ok to say:
if we want to make it easy for ourselves this round.
|
On the message, maybe we can say:
|
|
FSRepo.Open is dead since fdd1cd8
This allows replacing the datastore without needing to write Close through to every wrapped datastore.
WARNING: No migration performed! That needs to come in a separate commit, perhaps amended into this one. Migration must move keyspace "/b" from leveldb to the flatfs subdir, while removing the "b" prefix (keys should start with just "/").
This changes .go-ipfs to .ipfs everywhere. And by the way this defines a DefaultPathName const for this name. License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Improved the repo migration errors to provide instructions to the user.
The "daemon.lock" was really a repo.lock, as the cli also took it and the purpose was any process mutex. This is part of the 1-to-2 migration, and has already been handled in https://github.com/ipfs/fs-repo-migrations/tree/master/ipfs-1-to-2
rebased on new master |
This PR adds migrations for fsrepo.
like https://github.com/ipfs/specs/tree/master/repo/fs-repo
The 1-to-2 isn't done yet and will be the meat of this PR. Need
blocks/