feat(blockstore): Envvar can adjust badger compaction worker poolsize
This commit is contained in:
parent
048ccc71bb
commit
a4a4e04c5e
@ -1,6 +1,11 @@
|
||||
package repo
|
||||
|
||||
import badgerbs "github.com/filecoin-project/lotus/blockstore/badger"
|
||||
import (
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
badgerbs "github.com/filecoin-project/lotus/blockstore/badger"
|
||||
)
|
||||
|
||||
// BadgerBlockstoreOptions returns the badger options to apply for the provided
|
||||
// domain.
|
||||
@ -42,5 +47,17 @@ func BadgerBlockstoreOptions(domain BlockstoreDomain, path string, readonly bool
|
||||
|
||||
opts.ReadOnly = readonly
|
||||
|
||||
// Envvar LOTUS_CHAIN_BADGERSTORE_COMPACTIONWORKERNUM
|
||||
// Allows the number of compaction workers used by BadgerDB to be adjusted
|
||||
// Unset - leaves the default number of compaction workers (4)
|
||||
// "0" - disables compaction
|
||||
// Positive integer - enables that number of compaction workers
|
||||
if badgerNumCompactors, badgerNumCompactorsSet := os.LookupEnv("LOTUS_CHAIN_BADGERSTORE_COMPACTIONWORKERNUM"); badgerNumCompactorsSet {
|
||||
if numWorkers, err := strconv.Atoi(badgerNumCompactors); err == nil && numWorkers >= 0 {
|
||||
opts.NumCompactors = numWorkers
|
||||
}
|
||||
}
|
||||
|
||||
return opts, nil
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user