@cryptotaxi247 / kubo / commits / 1366795f3

Change repo version to 5, use new flatfs sharding

License: MIT Signed-off-by: Jeromy <why@ipfs.io>

Jeromy committed Jan 18, 2017 at 00:26 UTC 1366795f31d54608ed6ed7440b8e5960d45eb4b1
6 files changed +16 -11
package.json
+2 -2
@@ -213,9 +213,9 @@
213 },
214 {
215 "author": "whyrusleeping",
216 - "hash": "Qmbx2KUs8mUbDUiiESzC1ms7mdmh4pRu8X1V1tffC46M4n",
216 + "hash": "Qmcdc2Str4Dkc8yVCzzUFpnxmkS9AZXnpfo6jbhjjtXXkB",
217 "name": "go-ds-flatfs",
218 - "version": "1.0.1"
218 + "version": "1.1.0"
219 },
220 {
221 "author": "whyrusleeping",
repo/fsrepo/defaultds.go
+5 -4
@@ -13,7 +13,7 @@ import (
13 levelds "gx/ipfs/QmaHHmfEozrrotyhyN44omJouyuEtx6ahddqV6W5yRaUSQ/go-ds-leveldb"
14 ldbopts "gx/ipfs/QmbBhyDKsY4mbY6xsKt3qu9Y7FPvMJ6qbD8AMjYYvPRw1g/goleveldb/leveldb/opt"
15 measure "gx/ipfs/QmbUSMTQtK9GRrUbD4ngqJwSzHsquUc8nyDubRWp4vPybH/go-ds-measure"
16 - "gx/ipfs/Qmbx2KUs8mUbDUiiESzC1ms7mdmh4pRu8X1V1tffC46M4n/go-ds-flatfs"
16 + "gx/ipfs/Qmcdc2Str4Dkc8yVCzzUFpnxmkS9AZXnpfo6jbhjjtXXkB/go-ds-flatfs"
17 )
18
19 const (
@@ -33,9 +33,10 @@ func openDefaultDatastore(r *FSRepo) (repo.Datastore, error) {
33 }
34
35 syncfs := !r.config.Datastore.NoSync
36 - // 5 bytes of prefix gives us 25 bits of freedom, 16 of which are taken by
37 - // by the Qm prefix. Leaving us with 9 bits, or 512 way sharding
38 - blocksDS, err := flatfs.New(path.Join(r.path, flatfsDirectory), 5, syncfs)
36 +
37 + // 2 characters of base32 suffix gives us 10 bits of freedom.
38 + // Leaving us with 10 bits, or 1024 way sharding
39 + blocksDS, err := flatfs.CreateOrOpen(path.Join(r.path, flatfsDirectory), flatfs.NextToLast(2), syncfs)
40 if err != nil {
41 return nil, fmt.Errorf("unable to open flatfs datastore: %v", err)
42 }
repo/fsrepo/fsrepo.go
+1 -1
@@ -29,7 +29,7 @@ import (
29 var log = logging.Logger("fsrepo")
30
31 // version number that we are currently expecting to see
32 -var RepoVersion = 4
32 +var RepoVersion = 5
33
34 var migrationInstructions = `See https://github.com/ipfs/fs-repo-migrations/blob/master/run.md
35 Sorry for the inconvenience. In the future, these will run automatically.`
repo/fsrepo/migrations/migrations.go
+3
@@ -35,6 +35,9 @@ func migrationsBinName() string {
35 }
36
37 func RunMigration(newv int) error {
38 + if newv == 5 {
39 + return fmt.Errorf("No automatic migrations yet for repo version 5. You will have to build them from source.\nSee https://github.com/ipfs/fs-repo-migrations")
40 + }
41 migrateBin := migrationsBinName()
42
43 fmt.Println(" => Looking for suitable fs-repo-migrations binary.")
test/sharness/t0066-migration.sh
+3 -2
@@ -35,8 +35,9 @@ test_expect_success "ipfs daemon --migrate=true runs migration" '
35 '
36
37 test_expect_success "output looks good" '
38 - grep "Running: " true_out > /dev/null &&
39 - grep "Success: fs-repo has been migrated to version 4." true_out > /dev/null
38 + #grep "Running: " true_out > /dev/null &&
39 + #grep "Success: fs-repo has been migrated to version 4." true_out > /dev/null
40 + grep "No automatic migrations yet" true_out > /dev/null
41 '
42
43 test_expect_success "'ipfs daemon' prompts to auto migrate" '
test/sharness/t0084-repo-read-rehash.sh
+2 -2
@@ -16,8 +16,8 @@ test_init_ipfs
16 H_BLOCK1=$(echo "Block 1" | ipfs add -q)
17 H_BLOCK2=$(echo "Block 2" | ipfs add -q)
18
19 -BS_BLOCK1="CIQPD/CIQPDDQH5PDJTF4QSNMPFC45FQZH5MBSWCX2W254P7L7HGNHW5MQXZA.data"
20 -BS_BLOCK2="CIQNY/CIQNYWBOKHY7TCY7FUOBXKVJ66YRMARDT3KC7PPY6UWWPZR4YA67CKQ.data"
19 +BS_BLOCK1="XZ/CIQPDDQH5PDJTF4QSNMPFC45FQZH5MBSWCX2W254P7L7HGNHW5MQXZA.data"
20 +BS_BLOCK2="CK/CIQNYWBOKHY7TCY7FUOBXKVJ66YRMARDT3KC7PPY6UWWPZR4YA67CKQ.data"
21
22
23 test_expect_success 'blocks are swapped' '