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
41 lines
934 B
Go
41 lines
934 B
Go
// Copyright (C) 2020 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
package main
|
|
|
|
import (
|
|
"os"
|
|
|
|
"go.uber.org/zap"
|
|
|
|
"storj.io/private/process"
|
|
_ "storj.io/storj/private/version" // This attaches version information during release builds.
|
|
)
|
|
|
|
func main() {
|
|
process.SetHardcodedApplicationName("storagenode")
|
|
|
|
if startAsService() {
|
|
return
|
|
}
|
|
|
|
allowDefaults := !isFilewalkerCommand()
|
|
rootCmd, _ := newRootCmd(allowDefaults)
|
|
|
|
loggerFunc := func(logger *zap.Logger) *zap.Logger {
|
|
return logger.With(zap.String("Process", rootCmd.Use))
|
|
}
|
|
|
|
process.ExecWithCustomOptions(rootCmd, process.ExecOptions{
|
|
InitDefaultDebugServer: allowDefaults,
|
|
InitTracing: allowDefaults,
|
|
InitProfiler: allowDefaults,
|
|
LoggerFactory: loggerFunc,
|
|
LoadConfig: process.LoadConfig,
|
|
})
|
|
}
|
|
|
|
func isFilewalkerCommand() bool {
|
|
return len(os.Args) > 1 && os.Args[1] == usedSpaceFilewalkerCmd
|
|
}
|