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

vfs: add BackupMeta in config #1460

Merged
merged 2 commits into from
Feb 21, 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
5 changes: 3 additions & 2 deletions cmd/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,14 +256,15 @@ func initForSvc(c *cli.Context, mp string, metaUrl string) (meta.Meta, chunk.Chu
AttrTimeout: time.Millisecond * time.Duration(c.Float64("attr-cache")*1000),
EntryTimeout: time.Millisecond * time.Duration(c.Float64("entry-cache")*1000),
DirEntryTimeout: time.Millisecond * time.Duration(c.Float64("dir-entry-cache")*1000),
BackupMeta: c.Duration("backup-meta"),
}

metricsAddr := exposeMetrics(m, c)
if c.IsSet("consul") {
metric.RegisterToConsul(c.String("consul"), metricsAddr, mp)
}
if d := c.Duration("backup-meta"); d > 0 && !c.Bool("read-only") {
go vfs.Backup(m, blob, d)
if !c.Bool("read-only") && conf.BackupMeta > 0 {
go vfs.Backup(m, blob, conf.BackupMeta)
}
if !c.Bool("no-usage-report") {
go usage.ReportUsage(m, fmt.Sprintf("%s %s", mp, version.Version()))
Expand Down
5 changes: 3 additions & 2 deletions cmd/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ func mount(c *cli.Context) error {
Version: version.Version(),
Mountpoint: mp,
Chunk: &chunkConf,
BackupMeta: c.Duration("backup-meta"),
}

if c.Bool("background") && os.Getenv("JFS_FOREGROUND") == "" {
Expand Down Expand Up @@ -288,8 +289,8 @@ func mount(c *cli.Context) error {
if c.IsSet("consul") {
metric.RegisterToConsul(c.String("consul"), metricsAddr, mp)
}
if d := c.Duration("backup-meta"); d > 0 && !readOnly {
go vfs.Backup(m, blob, d)
if !readOnly && conf.BackupMeta > 0 {
go vfs.Backup(m, blob, conf.BackupMeta)
}
if !c.Bool("no-usage-report") {
go usage.ReportUsage(m, version.Version())
Expand Down
1 change: 1 addition & 0 deletions pkg/vfs/vfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ type Config struct {
AttrTimeout time.Duration
DirEntryTimeout time.Duration
EntryTimeout time.Duration
BackupMeta time.Duration
FastResolve bool `json:",omitempty"`
AccessLog string `json:",omitempty"`
HideInternal bool
Expand Down
5 changes: 3 additions & 2 deletions sdk/java/libjfs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,10 @@ func jfs_init(cname, jsonConf, user, group, superuser, supergroup *C.char) uintp
DirEntryTimeout: time.Millisecond * time.Duration(jConf.DirEntryTimeout*1000),
AccessLog: jConf.AccessLog,
FastResolve: jConf.FastResolve,
BackupMeta: time.Second * time.Duration(jConf.BackupMeta),
}
if d := jConf.BackupMeta; d > 0 && !jConf.ReadOnly {
go vfs.Backup(m, blob, time.Duration(d*1e9))
if !jConf.ReadOnly && conf.BackupMeta > 0 {
go vfs.Backup(m, blob, conf.BackupMeta)
}
if !jConf.NoUsageReport {
go usage.ReportUsage(m, "java-sdk "+version.Version())
Expand Down