Skip to content
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

Set max retries of meta & chunk according to the config io-retries #1713

Merged
merged 1 commit into from
Apr 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func clientFlags() []cli.Flag {
},
&cli.IntFlag{
Name: "io-retries",
Value: 30,
Value: 10,
Usage: "number of retries after network failure",
},
&cli.IntFlag{
Expand Down
3 changes: 2 additions & 1 deletion cmd/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ func prepareMp(mp string) {

func getMetaConf(c *cli.Context, mp string, readOnly bool) *meta.Config {
return &meta.Config{
Retries: 10,
Retries: c.Int("io-retries"),
Strict: true,
ReadOnly: readOnly,
NoBGJob: c.Bool("no-bgjob"),
Expand Down Expand Up @@ -286,6 +286,7 @@ func getChunkConf(c *cli.Context, format *meta.Format) *chunk.Config {
PutTimeout: time.Second * time.Duration(c.Int("put-timeout")),
MaxUpload: c.Int("max-uploads"),
MaxDeletes: c.Int("max-deletes"),
MaxRetries: c.Int("io-retries"),
Writeback: c.Bool("writeback"),
Prefetch: c.Int("prefetch"),
BufferSize: c.Int("buffer-size") << 20,
Expand Down
6 changes: 3 additions & 3 deletions docs/en/reference/command_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ the max number of seconds to download an object (default: 60)
the max number of seconds to upload an object (default: 60)

`--io-retries value`<br />
number of retries after network failure (default: 30)
number of retries after network failure (default: 10)

`--max-uploads value`<br />
number of connections to upload (default: 20)
Expand Down Expand Up @@ -311,7 +311,7 @@ the max number of seconds to download an object (default: 60)
the max number of seconds to upload an object (default: 60)

`--io-retries value`<br />
number of retries after network failure (default: 30)
number of retries after network failure (default: 10)

`--max-uploads value`<br />
number of connections to upload (default: 20)
Expand Down Expand Up @@ -410,7 +410,7 @@ the max number of seconds to download an object (default: 60)
the max number of seconds to upload an object (default: 60)

`--io-retries value`<br />
number of retries after network failure (default: 30)
number of retries after network failure (default: 10)

`--max-uploads value`<br />
number of connections to upload (default: 20)
Expand Down
6 changes: 3 additions & 3 deletions docs/zh_cn/reference/command_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ consul注册中心地址(默认: "127.0.0.1:8500")
上传一个对象的超时时间;单位为秒 (默认: 60)

`--io-retries value`<br />
网络异常时的重试次数 (默认: 30)
网络异常时的重试次数 (默认: 10)

`--max-uploads value`<br />
上传对象的连接数 (默认: 20)
Expand Down Expand Up @@ -311,7 +311,7 @@ juicefs gateway [command options] META-URL ADDRESS
上传一个对象的超时时间;单位为秒 (默认: 60)

`--io-retries value`<br />
网络异常时的重试次数 (默认: 30)
网络异常时的重试次数 (默认: 10)

`--max-uploads value`<br />
上传对象的连接数 (默认: 20)
Expand Down Expand Up @@ -408,7 +408,7 @@ juicefs webdav [command options] META-URL ADDRESS
上传一个对象的超时时间;单位为秒 (默认: 60)

`--io-retries value`<br />
网络异常时的重试次数 (默认: 30)
网络异常时的重试次数 (默认: 10)

`--max-uploads value`<br />
上传对象的连接数 (默认: 20)
Expand Down
6 changes: 5 additions & 1 deletion pkg/chunk/cached_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ func (store *cachedStore) upload(key string, block *Page, c *wChunk) error {

try, max := 0, 3
if sync {
max = 10
max = store.conf.MaxRetries
}
for ; try < max; try++ {
time.Sleep(time.Second * time.Duration(try*try))
Expand Down Expand Up @@ -590,6 +590,7 @@ type Config struct {
Compress string
MaxUpload int
MaxDeletes int
MaxRetries int
UploadLimit int64 // bytes per second
DownloadLimit int64 // bytes per second
Writeback bool
Expand Down Expand Up @@ -698,6 +699,9 @@ func NewCachedStore(storage object.ObjectStorage, config Config, registerer prom
if compressor == nil {
logger.Fatalf("unknown compress algorithm: %s", config.Compress)
}
if config.MaxRetries == 0 {
config.MaxRetries = 10
}
if config.GetTimeout == 0 {
config.GetTimeout = time.Second * 60
}
Expand Down
1 change: 1 addition & 0 deletions pkg/chunk/cached_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ var defaultConf = Config{
CacheSize: 1,
MaxUpload: 1,
MaxDeletes: 1,
MaxRetries: 10,
PutTimeout: time.Second,
GetTimeout: time.Second * 2,
AutoCreate: true,
Expand Down
2 changes: 1 addition & 1 deletion pkg/meta/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ type baseMeta struct {

func newBaseMeta(conf *Config) baseMeta {
if conf.Retries == 0 {
conf.Retries = 30
conf.Retries = 10
}
if conf.Heartbeat == 0 {
conf.Heartbeat = 12 * time.Second
Expand Down
4 changes: 3 additions & 1 deletion sdk/java/libjfs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ type javaConf struct {
DownloadLimit int `json:"downloadLimit"`
MaxUploads int `json:"maxUploads"`
MaxDeletes int `json:"maxDeletes"`
IORetries int `json:"ioRetries"`
GetTimeout int `json:"getTimeout"`
PutTimeout int `json:"putTimeout"`
FastResolve bool `json:"fastResolve"`
Expand Down Expand Up @@ -396,7 +397,7 @@ func jfs_init(cname, jsonConf, user, group, superuser, supergroup *C.char) uintp
}

metaConf := &meta.Config{
Retries: 10,
Retries: jConf.IORetries,
Strict: true,
ReadOnly: jConf.ReadOnly,
NoBGJob: jConf.NoBGJob,
Expand Down Expand Up @@ -460,6 +461,7 @@ func jfs_init(cname, jsonConf, user, group, superuser, supergroup *C.char) uintp
CacheFullBlock: jConf.CacheFullBlock,
MaxUpload: jConf.MaxUploads,
MaxDeletes: jConf.MaxDeletes,
MaxRetries: jConf.IORetries,
UploadLimit: int64(jConf.UploadLimit) * 1e6 / 8,
DownloadLimit: int64(jConf.DownloadLimit) * 1e6 / 8,
Prefetch: jConf.Prefetch,
Expand Down
1 change: 1 addition & 0 deletions sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ public void initialize(URI uri, Configuration conf) throws IOException {
obj.put("maxDeletes", Integer.valueOf(getConf(conf, "max-deletes", "2")));
obj.put("uploadLimit", Integer.valueOf(getConf(conf, "upload-limit", "0")));
obj.put("downloadLimit", Integer.valueOf(getConf(conf, "download-limit", "0")));
obj.put("ioRetries", Integer.valueOf(getConf(conf, "io-retries", "10")));
obj.put("getTimeout", Integer.valueOf(getConf(conf, "get-timeout", getConf(conf, "object-timeout", "5"))));
obj.put("putTimeout", Integer.valueOf(getConf(conf, "put-timeout", getConf(conf, "object-timeout", "60"))));
obj.put("memorySize", Integer.valueOf(getConf(conf, "memory-size", "300")));
Expand Down