Skip to content

Commit 2136df7

Browse files
committed
fixes to make 0.4.3 install and migration work properly
1 parent e25affb commit 2136df7

File tree

9 files changed

+25
-10
lines changed

9 files changed

+25
-10
lines changed

Godeps/_workspace/src/github.com/ipfs/ipfs-update/util/utils.go

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ipfs-3-to-4/flatfs/flatfs.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ func New(path string, prefixLen int, sync bool) (*Datastore, error) {
5353
var padding = strings.Repeat("_", maxPrefixLen)
5454

5555
func (fs *Datastore) encode(key datastore.Key) (dir, file string) {
56-
prefix := (key.String() + padding)[:fs.prefixLen]
56+
noslash := key.String()[1:]
57+
prefix := (noslash + padding)[:fs.prefixLen]
5758
dir = path.Join(fs.path, prefix)
58-
file = path.Join(dir, key.String()+extension)
59+
file = path.Join(dir, noslash+extension)
5960
return dir, file
6061
}
6162

@@ -114,7 +115,7 @@ func (fs *Datastore) Put(key datastore.Key, value interface{}) error {
114115
return err
115116
}
116117

117-
log.Printf("too many open files, retrying in %dms\n", 100*i)
118+
log.Printf("too many open files, retrying in %dms", 100*i)
118119
time.Sleep(time.Millisecond * 100 * time.Duration(i))
119120
}
120121
return err

ipfs-3-to-4/flatfs/flatfs_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func TestStorage(t *testing.T) {
152152
defer cleanup()
153153

154154
const prefixLen = 2
155-
const prefix = "q"
155+
const prefix = "qu"
156156
const target = prefix + string(os.PathSeparator) + "quux.data"
157157
fs, err := flatfs.New(temp, prefixLen, false)
158158
if err != nil {

ipfs-3-to-4/migration/migration.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ func openDatastores(repopath string) (a, b dstore.ThreadSafeDatastore, e error)
182182
}
183183

184184
blockspath := path.Join(repopath, "blocks")
185-
nfds, err := nuflatfs.New(blockspath, 7, true)
185+
nfds, err := nuflatfs.New(blockspath, 5, true)
186186
if err != nil {
187187
return nil, nil, err
188188
}
@@ -277,6 +277,7 @@ func rewriteKeys(oldds, newds dstore.Datastore, pref string, mkKey mkKeyFunc, va
277277
return err
278278
}
279279
}
280+
fmt.Println()
280281

281282
return nil
282283
}

sharness/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ BINS += bin/fs-repo-migrations
1616
BINS += bin/ipfs-0-to-1
1717
BINS += bin/ipfs-1-to-2
1818
BINS += bin/ipfs-2-to-3
19+
BINS += bin/ipfs-3-to-4
1920
BINS += bin/ipfs-update
2021
BINS += bin/random-files
2122
BINS += bin/go-sleep
@@ -25,6 +26,7 @@ FS_REPO_SRC = ../
2526
IPFS_0_TO_1_SRC = ../ipfs-0-to-1
2627
IPFS_1_TO_2_SRC = ../ipfs-1-to-2
2728
IPFS_2_TO_3_SRC = ../ipfs-2-to-3
29+
IPFS_3_TO_4_SRC = ../ipfs-3-to-4
2830
IPFS_UPDATE_SRC = ../Godeps/_workspace/src/github.com/ipfs/ipfs-update
2931

3032
# User might want to override those on the command line
@@ -87,6 +89,10 @@ bin/ipfs-2-to-3: $(call find_go_files, $(IPFS_2_TO_3_SRC)) BUILD-OPTIONS
8789
@echo "*** installing $@ ***"
8890
go build $(GOFLAGS) -o $@ $(IPFS_2_TO_3_SRC)
8991

92+
bin/ipfs-3-to-4: $(call find_go_files, $(IPFS_3_TO_4_SRC)) BUILD-OPTIONS
93+
@echo "*** installing $@ ***"
94+
go build $(GOFLAGS) -o $@ $(IPFS_3_TO_4_SRC)
95+
9096
BUILD-OPTIONS: FORCE
9197
@bin/checkflags '$@' '$(GOFLAGS)' '*** new Go flags ***'
9298

sharness/lib/test-lib.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ GUEST_FS_REPO_MIG="sharness/bin/fs-repo-migrations"
8282
GUEST_IPFS_0_TO_1="sharness/bin/ipfs-0-to-1"
8383
GUEST_IPFS_1_TO_2="sharness/bin/ipfs-1-to-2"
8484
GUEST_IPFS_2_TO_3="sharness/bin/ipfs-2-to-3"
85+
GUEST_IPFS_3_TO_4="sharness/bin/ipfs-3-to-4"
8586

8687
GUEST_RANDOM_FILES="sharness/bin/random-files"
8788

sharness/t0030-simple-migration.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ test_expect_success "'fs-repo-migrations -v' works" '
1313
'
1414

1515
test_expect_success "'fs-repo-migrations -v' output looks good" '
16-
echo "3" >expected &&
16+
echo "4" >expected &&
1717
test_cmp expected actual
1818
'
1919

@@ -30,7 +30,7 @@ test_expect_success "'fs-repo-migrations -v' works" '
3030
'
3131

3232
test_expect_success "'fs-repo-migrations -v' output looks good" '
33-
echo "3" >expected &&
33+
echo "4" >expected &&
3434
test_cmp expected actual
3535
'
3636

@@ -47,7 +47,7 @@ test_expect_success ".ipfs/ has been created" '
4747
'
4848

4949
test_expect_success "'fs-repo-migrations -y' works" '
50-
exec_docker "$DOCID" "$GUEST_FS_REPO_MIG -y" >actual
50+
exec_docker "$DOCID" "$GUEST_FS_REPO_MIG -y -to=3" >actual
5151
'
5252

5353
test_expect_success "'fs-repo-migrations -y' output looks good" '

sharness/t0040-migration-2-3.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ test_expect_success "ipfs cat output looks good" '
4848
'
4949

5050
test_expect_success "'fs-repo-migrations -y' works" '
51-
exec_docker "$DOCID" "$GUEST_FS_REPO_MIG -y" >actual
51+
exec_docker "$DOCID" "$GUEST_FS_REPO_MIG -y -to=3" >actual
5252
'
5353

5454
test_expect_success "'fs-repo-migrations -y' output looks good" '

sharness/t0050-migration-2-3-pins.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ test_expect_success "'ipfs pin ls --type=all' works" '
8181
'
8282

8383
test_expect_success "'fs-repo-migrations -y' works" '
84-
exec_docker "$DOCID" "$GUEST_FS_REPO_MIG -y" >actual
84+
exec_docker "$DOCID" "$GUEST_FS_REPO_MIG -y -to=3" >actual
8585
'
8686

8787
test_expect_success "'fs-repo-migrations -y' output looks good" '

0 commit comments

Comments
 (0)