Disable GC on chain badger datastore
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
parent
b8bbbf3ea3
commit
997d49b63f
@ -17,7 +17,7 @@ import (
|
|||||||
type dsCtor func(path string) (datastore.Batching, error)
|
type dsCtor func(path string) (datastore.Batching, error)
|
||||||
|
|
||||||
var fsDatastores = map[string]dsCtor{
|
var fsDatastores = map[string]dsCtor{
|
||||||
"chain": badgerDs,
|
"chain": chainBadgerDs,
|
||||||
"metadata": levelDs,
|
"metadata": levelDs,
|
||||||
|
|
||||||
// Those need to be fast for large writes... but also need a really good GC :c
|
// Those need to be fast for large writes... but also need a really good GC :c
|
||||||
@ -26,6 +26,16 @@ var fsDatastores = map[string]dsCtor{
|
|||||||
"client": badgerDs, // client specific
|
"client": badgerDs, // client specific
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func chainBadgerDs(path string) (datastore.Batching, error) {
|
||||||
|
opts := badger.DefaultOptions
|
||||||
|
opts.GcInterval = 0 // disable GC for chain datastore
|
||||||
|
|
||||||
|
opts.Options = dgbadger.DefaultOptions("").WithTruncate(true).
|
||||||
|
WithValueThreshold(1 << 10)
|
||||||
|
|
||||||
|
return badger.NewDatastore(path, &opts)
|
||||||
|
}
|
||||||
|
|
||||||
func badgerDs(path string) (datastore.Batching, error) {
|
func badgerDs(path string) (datastore.Batching, error) {
|
||||||
opts := badger.DefaultOptions
|
opts := badger.DefaultOptions
|
||||||
opts.Options = dgbadger.DefaultOptions("").WithTruncate(true).
|
opts.Options = dgbadger.DefaultOptions("").WithTruncate(true).
|
||||||
|
Loading…
Reference in New Issue
Block a user