f076238748
As part of fixing the IO priority of filewalker related processes such as the garbage collection and used-space calculation, this change allows the initial used-space calculation to run as a separate subprocess with lower IO priority. This can be enabled with the `--storage2.enable-lazy-filewalker` config item. It falls back to the old behaviour when the subprocess fails. Updates https://github.com/storj/storj/issues/5349 Change-Id: Ia6ee98ce912de3e89fc5ca670cf4a30be73b36a6
38 lines
1.3 KiB
Go
38 lines
1.3 KiB
Go
// Copyright (C) 2023 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
package lazyfilewalker
|
|
|
|
import (
|
|
"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
|
|
}
|
|
|
|
// 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",
|
|
}
|
|
}
|