Skip to content

Commit

Permalink
feat: check migrate before run
Browse files Browse the repository at this point in the history
  • Loading branch information
xrypto.c committed Nov 7, 2024
1 parent 09bbc1c commit 38c8619
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 5 additions & 0 deletions bin/container_daemon
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ ipfs version

if [ -e "$repo/config" ]; then
echo "Found IPFS fs-repo at $repo"

# migrate if needed
echo "Checking for migration..."
export IPFS_FS_MIGRATION_11_TO_12_NWORKERS=100
ipfs repo migrate
else
ipfs init ${IPFS_PROFILE:+"--profile=$IPFS_PROFILE"}
ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001
Expand Down
8 changes: 3 additions & 5 deletions repo/fsrepo/fsrepo.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,9 @@ func open(repoPath string, userConfigFilePath string) (repo.Repo, error) {
return nil, err
}

// TODO: now skip version migration check
// if ver != 11 && RepoVersion > ver {
// return nil, ErrNeedMigration
// } else
if ver > RepoVersion {
if RepoVersion > ver {
return nil, ErrNeedMigration
} else if ver > RepoVersion {
// program version too low for existing repo
return nil, fmt.Errorf(programTooLowMessage, RepoVersion, ver)
}
Expand Down

0 comments on commit 38c8619

Please sign in to comment.