Merge pull request #9973 from placer14/mg/chore/expose-compaction-poolsize-envvar
feat: blockstore: Envvar can adjust badger compaction worker poolsize
This commit is contained in:
commit
ec1b2b959a
@ -1,6 +1,11 @@
|
|||||||
package repo
|
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
|
// BadgerBlockstoreOptions returns the badger options to apply for the provided
|
||||||
// domain.
|
// domain.
|
||||||
@ -42,5 +47,17 @@ func BadgerBlockstoreOptions(domain BlockstoreDomain, path string, readonly bool
|
|||||||
|
|
||||||
opts.ReadOnly = readonly
|
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
|
return opts, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user