Skip to content

add 'ipfs repo migrate' command#7658

Closed
zaibon wants to merge 8 commits into
ipfs:masterfrom
zaibon:feat/cmds/repo-migrate
Closed

add 'ipfs repo migrate' command#7658
zaibon wants to merge 8 commits into
ipfs:masterfrom
zaibon:feat/cmds/repo-migrate

Conversation

@zaibon

@zaibon zaibon commented Sep 7, 2020

Copy link
Copy Markdown

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

resolves #7471

@welcome

This comment has been minimized.

@aschmahmann

Copy link
Copy Markdown
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

zaibon commented Sep 9, 2020

Copy link
Copy Markdown
Author

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.

Comment thread test/sharness/t0066-migration.sh Outdated
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
Copy Markdown
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 zaibon force-pushed the feat/cmds/repo-migrate branch from 54b4019 to f2e7133 Compare September 14, 2020 06:24
@zaibon

zaibon commented Sep 14, 2020

Copy link
Copy Markdown
Author

@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
Copy Markdown
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

zaibon commented Nov 13, 2020

Copy link
Copy Markdown
Author

@aschmahmann ping ;-)

@aschmahmann

Copy link
Copy Markdown
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

zaibon commented Nov 13, 2020

Copy link
Copy Markdown
Author

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
Copy Markdown
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.

@zaibon zaibon force-pushed the feat/cmds/repo-migrate branch from f2e7133 to 6499f36 Compare November 13, 2020 21:07
@gammazero

Copy link
Copy Markdown
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

zaibon commented Apr 2, 2021

Copy link
Copy Markdown
Author

@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
Copy Markdown
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

@zaibon zaibon force-pushed the feat/cmds/repo-migrate branch from 6499f36 to 2455742 Compare April 3, 2021 17:23
@aschmahmann

Copy link
Copy Markdown
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
Copy Markdown
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).

@christophedcpm christophedcpm force-pushed the feat/cmds/repo-migrate branch from 2455742 to 82e1efb Compare April 6, 2021 07:42
@zaibon zaibon force-pushed the feat/cmds/repo-migrate branch from 82e1efb to cc7e14f Compare April 16, 2021 08:12
@zaibon

zaibon commented Apr 16, 2021

Copy link
Copy Markdown
Author

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

Comment thread test/sharness/t0066-migration.sh Outdated
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
Copy Markdown
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
Copy Markdown
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.

Comment thread test/sharness/t0066-migration.sh Outdated
@gammazero

Copy link
Copy Markdown
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
Copy Markdown
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

zaibon commented May 24, 2021

Copy link
Copy Markdown
Author

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

@aschmahmann aschmahmann self-assigned this May 24, 2021
@BigLep BigLep added need/author-input Needs input from the original author and removed status/blocked Unable to be worked further until needs are met labels Aug 13, 2021
@christophedcpm christophedcpm force-pushed the feat/cmds/repo-migrate branch from 67960ec to 3a94ced Compare August 13, 2021 15:16
@zaibon

zaibon commented Aug 13, 2021

Copy link
Copy Markdown
Author

@BigLep done.

@Matchjuan859

Matchjuan859 commented Aug 13, 2021 via email

Copy link
Copy Markdown

@gammazero

Copy link
Copy Markdown
Contributor

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

@BigLep

BigLep commented Aug 14, 2021

Copy link
Copy Markdown
Contributor

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

BigLep commented Aug 20, 2021

Copy link
Copy Markdown
Contributor

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

@BigLep

BigLep commented Aug 27, 2021

Copy link
Copy Markdown
Contributor

@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 gammazero force-pushed the feat/cmds/repo-migrate branch from eca5f20 to 59a418b Compare September 3, 2021 22:33
@gammazero

Copy link
Copy Markdown
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 gammazero force-pushed the feat/cmds/repo-migrate branch from f823d83 to 647cb41 Compare September 10, 2021 12:30
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
Copy Markdown
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