c6f67d4799
Lazyfilewalker was failing with SIGPIPE which was quite misleading. The command was failing because the the value of the --lower-io-priority flag was assumed to be an arguement since it was passed as "--lower-io-priority true" instead "--lower-io-priority=true" Resolves https://github.com/storj/storj/issues/5900 Change-Id: Icf79fcce76dafee21659d76ee0ce19d8520c8f1d
43 lines
1.5 KiB
Go
43 lines
1.5 KiB
Go
// Copyright (C) 2023 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
package lazyfilewalker
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"storj.io/storj/storagenode/blobstore/filestore"
|
|
)
|
|
|
|
// Config is the config for lazyfilewalker process.
|
|
type Config struct {
|
|
// TODO: just trying to match the names in storagenodedb.Config. Change these to be more descriptive.
|
|
Storage string `help:"path to the storage database directory"`
|
|
Info string `help:"path to the piecestore db"`
|
|
Info2 string `help:"path to the info database"`
|
|
Driver string `help:"database driver to use" default:"sqlite3"`
|
|
Pieces string `help:"path to store pieces in"`
|
|
Filestore filestore.Config
|
|
|
|
LowerIOPriority bool `help:"if true, the process will run with lower IO priority" default:"true"`
|
|
}
|
|
|
|
// Args returns the flags to be passed lazyfilewalker process.
|
|
func (config *Config) Args() []string {
|
|
// TODO: of course, we shouldn't hardcode this.
|
|
return []string{
|
|
"--storage", config.Storage,
|
|
"--info", config.Info,
|
|
"--info2", config.Info2,
|
|
"--pieces", config.Pieces,
|
|
"--driver", config.Driver,
|
|
"--filestore.write-buffer-size", config.Filestore.WriteBufferSize.String(),
|
|
// set log output to stderr, so it doesn't interfere with the output of the command
|
|
"--log.output", "stderr",
|
|
// use the json formatter in the subprocess, so we could read lines and re-log them in the main process
|
|
// with all the fields intact.
|
|
"--log.encoding", "json",
|
|
fmt.Sprintf("--lower-io-priority=%v", config.LowerIOPriority),
|
|
}
|
|
}
|