-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
unixfs autosharding with config #8527
Changes from all commits
d9d3321
86d41db
66e0f98
36c1eda
75a3db0
2bed2a2
9775022
e0b6bb4
b14aa37
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,8 @@ import ( | |
offline "github.com/ipfs/go-ipfs-exchange-offline" | ||
offroute "github.com/ipfs/go-ipfs-routing/offline" | ||
uio "github.com/ipfs/go-unixfs/io" | ||
|
||
"github.com/dustin/go-humanize" | ||
"go.uber.org/fx" | ||
) | ||
|
||
|
@@ -316,8 +318,20 @@ func IPFS(ctx context.Context, bcfg *BuildCfg) fx.Option { | |
return bcfgOpts // error | ||
} | ||
|
||
// TEMP: setting global sharding switch here | ||
uio.UseHAMTSharding = cfg.Experimental.ShardingEnabled | ||
// Auto-sharding settings | ||
shardSizeString := cfg.Internal.UnixFSShardingSizeThreshold.WithDefault("256kiB") | ||
shardSizeInt, err := humanize.ParseBytes(shardSizeString) | ||
if err != nil { | ||
return fx.Error(err) | ||
} | ||
uio.HAMTShardingSize = int(shardSizeInt) | ||
|
||
// Migrate users of deprecated Experimental.ShardingEnabled flag | ||
if cfg.Experimental.ShardingEnabled { | ||
logger.Fatal("The `Experimental.ShardingEnabled` field is no longer used, please remove it from the config.\n" + | ||
"go-ipfs now automatically shards when directory block is bigger than `" + shardSizeString + "`.\n" + | ||
"If you need to restore the old behavior (sharding everything) set `Internal.UnixFSShardingSizeThreshold` to `1B`.\n") | ||
} | ||
Comment on lines
+329
to
+334
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ℹ️ This provides a migration path for existing users that have experiment enabled. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks. This seems like the best we can get. There's no way to warn anybody who explicitly wanted sharding to stay off since that flag didn't have no way to denote "unset" which is what we're moving towards now. |
||
|
||
return fx.Options( | ||
bcfgOpts, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: use a version of interop that's on master