Skip to content
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

add 'ipfs repo migrate' command #7658

Closed
wants to merge 8 commits into from

Conversation

zaibon
Copy link

@zaibon zaibon commented Sep 7, 2020

this command allows to run the repo migration without starting the daemon.

resolves #7471

@welcome

This comment has been minimized.

@aschmahmann
Copy link
Contributor

Thanks @zaibon for starting this. Could you do two more things:

  1. As specified in the issue you linked we need an --allow-downgrade flag. While this command has one it's not hooked up to anything.
  2. There is nothing testing that this command works. You can modify https://github.com/ipfs/go-ipfs/blob/83c57eda1fe4c50660761b401b4e4f016e6ecfd0/test/sharness/t0066-migration.sh to also test that ipfs repo migrate and ipfs repo migrate --allow-downgrade work as expected

Thanks again and let me know if you need any guidance here.

@zaibon
Copy link
Author

zaibon commented Sep 9, 2020

Thanks for the review @aschmahmann.

As specified in the issue you linked we need an --allow-downgrade flag. While this command has one it's not hooked up to anything.

Right, forgot that part. What should be the behavior when this flag is set ? At the moment I always call migrate.RunMigration(fsrepo.RepoVersion) should I read the desired version from somewhere else and then compare the current version with the desired version and only allow downgrade if the flag is set ?

There is nothing testing that this command works. You can modify https://github.com/ipfs/go-ipfs/blob/83c57eda1fe4c50660761b401b4e4f016e6ecfd0/test/sharness/t0066-migration.sh to also test that ipfs repo migrate and ipfs repo migrate --allow-downgrade work as expected

Yep, will do, thanks for the guidance here.

@@ -13,7 +13,7 @@ test_init_ipfs
test_expect_success "setup mock migrations" '
mkdir bin &&
echo "#!/bin/bash" > bin/fs-repo-migrations &&
echo "echo 5" >> bin/fs-repo-migrations &&
echo "echo 10" >> bin/fs-repo-migrations &&
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to change this here to make the detection of the fs-repo-migrations to work since it seems now the code also checks the version the migration tool is able to handle.

@zaibon
Copy link
Author

zaibon commented Sep 14, 2020

@aschmahmann I hooked up the allow-downgrade flag. For this I had to add an extra argument to the RunMigration method. Not sure this is ok, I'm usually not a big fan of boolean argument. What's thought about it ?

I also added some test for the new command. I'm not sure how I can test the downgrade though, some input there would be welcome :-)

@aschmahmann
Copy link
Contributor

@zaibon sorry it's taking a while to get to this. A little busy with things related to the v0.7.0 release, but will try and get to this next week.

@zaibon
Copy link
Author

zaibon commented Nov 13, 2020

@aschmahmann ping ;-)

@aschmahmann
Copy link
Contributor

Thanks @zaibon for the reminder and apologies it slipped off my radar. I'll try and take a look over the weekend.

I was actually thinking about this PR yesterday because some of the pain around migrations has made implementing something like ipfs/fs-repo-migrations#98 more important. This would likely rely on ipfs repo migrate instead of a separate fs-repo-migrations binary which would make this command even more useful (and make testing it simpler too).

@zaibon
Copy link
Author

zaibon commented Nov 13, 2020

Nice, I'll have a look at ipfs/fs-repo-migrations#98.

Should I already try to rebase this PR since I guess it's a bit out of date with master or wait your review ?

@aschmahmann
Copy link
Contributor

Should I already try to rebase this PR since I guess it's a bit out of date with master or wait your review

I suspect it's an easy rebase, but if it's a pain for some reason then I'd hold off until there's some progress on ipfs/fs-repo-migrations#98. If we do basically what's recommended in that issue then this command will replace the fs-repo-migrations binary for people doing manual migration manipulation.

@gammazero
Copy link
Contributor

@zaibon Wanted to let you know that this PR has not been forgotten about. The work to overhaul the migrations and binary distribution is code-complete, and is waiting until there is time to review it all. Once #7857 is merged, then you can rebase this PR and make any necessary changes. Hopefully in the next couple of weeks.

@BigLep BigLep added the status/blocked Unable to be worked further until needs are met label Mar 29, 2021
@zaibon
Copy link
Author

zaibon commented Apr 2, 2021

@gammazero seems ipfs/fs-repo-migrations#98 is now closed. Can I start rebasing and make the required change here or is there anything else in the pipeline ?

@gammazero
Copy link
Contributor

@zaibon You can rebase now. You will need to make some changes to how you call RunMigration. See here:
https://github.com/ipfs/go-ipfs/blob/master/cmd/ipfs/daemon.go#L291-L293

@aschmahmann
Copy link
Contributor

@zaibon not sure if this is ready for re-review yet, but when you're ready just request review from me or tag me

@gammazero
Copy link
Contributor

@zaibon I took a look at the changes to the sharness tests, and realized that what was there (before your changes) needs to be fixed. go-ipfs no longer uses fs-repo-migrations to perform migrations, and the tests were not doing what they were supposed to be doing.

Attn: @aschmahmann
I have created a PR #8053 to fix this. It includes comments explaining what is going on as well. Please rebase this PR as soon as it can be merged. (sorry for another roadblock).

@zaibon
Copy link
Author

zaibon commented Apr 16, 2021

@aschmahmann I just rebased on top of #8053, so this PR should be ready now.

@@ -90,11 +90,11 @@ test_expect_success "ipfs repo migrate succeed" '

test_expect_success "output looks good" '
grep "Found outdated fs-repo, starting migration." migrate_out > /dev/null &&
grep "Success: fs-repo has been migrated to version 10" migrate_out > /dev/null
grep "Success: fs-repo has been migrated to version 11" migrate_out > /dev/null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a duplicate of the test at line 72-74.

You may want to take this test from the current master branch and reapply your changes.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is up to date with master branch, all the new code is only related this me PR.

This line looks similar to 71-74, cause it does test the same thing but it is the result of another command. In 71-74 we test the result of the ipfs daemon command, while here we test the result of the ipfs migrate command.

test/sharness/t0066-migration.sh Outdated Show resolved Hide resolved
@gammazero
Copy link
Contributor

@aschmahmann With the recent changes to allow migrations over IPFS, and to import downloaded migrations, we probably want this PR to at least be able to fetch migrations via IPFS. This command would also benefit from being able to import downloaded migrations as CAR files.

@aschmahmann
Copy link
Contributor

we probably want this PR to at least be able to fetch migrations via IPFS.

👍

This command would also benefit from being able to import downloaded migrations as CAR files.

We get this basically for free if we can fetch the migrations using IPFS then if the user really wants to work with CAR files they can use ipfs dag import <migration car> before they run ipfs repo migrate and that'll do the job.

@aschmahmann aschmahmann added need/author-input Needs input from the original author and removed status/blocked Unable to be worked further until needs are met labels Apr 19, 2021
@zaibon
Copy link
Author

zaibon commented May 24, 2021

@aschmahmann Do you still need some action from me on this ?

@BigLep BigLep added the need/author-input Needs input from the original author label Aug 13, 2021
@zaibon
Copy link
Author

zaibon commented Aug 13, 2021

@BigLep done.

@Matchjuan859
Copy link

Matchjuan859 commented Aug 13, 2021 via email

@gammazero
Copy link
Contributor

I took care of step 3 above to allow this command to use IPFS to download migrations.

@BigLep
Copy link
Contributor

BigLep commented Aug 14, 2021

Arg, and not it looks like CI is not passing. I have limited internet bandwidth to track it down, but I believe I sawt his mentioned somewhere else. @aschumann is there another issue we can track against so can then merge this?

@BigLep
Copy link
Contributor

BigLep commented Aug 20, 2021

@gammazero : can you please rebase on master and see if it's good to go?

@BigLep
Copy link
Contributor

BigLep commented Aug 27, 2021

@gammazero : just checking in - are you able to get this across the line?

@BigLep BigLep removed the need/author-input Needs input from the original author label Aug 27, 2021
@gammazero
Copy link
Contributor

@aschmahmann @BigLep As far as I can tell, this PR is done. The problem is that it does not have privileges to run the sharness tests using a 2xlarge instance as configured in the .circleci/config.yml here, and this is causing failure.

gammazero added a commit that referenced this pull request Sep 10, 2021
This PR replaces #7658 that was originally contributed by zaibons, in order to move code into a branch and avoid some CI problem.

The command allows the user to run the repo migration without starting the daemon.

resolves #7471
@gammazero
Copy link
Contributor

Closing: This PR is replaced by #8428 to move it into a branch to avoid CI problems associated with the repo.

@gammazero gammazero closed this Sep 10, 2021
guseggert pushed a commit that referenced this pull request May 6, 2022
This PR replaces #7658 that was originally contributed by zaibons, in order to move code into a branch and avoid some CI problem.

The command allows the user to run the repo migration without starting the daemon.

resolves #7471
guseggert pushed a commit that referenced this pull request May 6, 2022
This PR replaces #7658 that was originally contributed by zaibons, in order to move code into a branch and avoid some CI problem.

The command allows the user to run the repo migration without starting the daemon.

resolves #7471
guseggert pushed a commit that referenced this pull request May 6, 2022
This PR replaces #7658 that was originally contributed by zaibons, in order to move code into a branch and avoid some CI problem.

The command allows the user to run the repo migration without starting the daemon.

resolves #7471
guseggert added a commit that referenced this pull request May 6, 2022
* Add 'ipfs repo migrate' command

This PR replaces #7658 that was originally contributed by zaibons, in order to move code into a branch and avoid some CI problem.

The command allows the user to run the repo migration without starting the daemon.

resolves #7471

* return non-ErrNeedMigration errors from fsrepo.Open()

Co-authored-by: Gus Eggert <gus@gus.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ipfs migration without starting the daemon
5 participants