Merge pull request #3457 from filecoin-project/fix/disable-badger-gc

Disable GC on chain badger datastore
This commit is contained in:
Łukasz Magiera 2020-09-02 15:02:52 +02:00 committed by GitHub
commit b7f2487c4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,7 +17,7 @@ import (
type dsCtor func(path string) (datastore.Batching, error)
var fsDatastores = map[string]dsCtor{
"chain": badgerDs,
"chain": chainBadgerDs,
"metadata": levelDs,
// 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
}
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) {
opts := badger.DefaultOptions
opts.Options = dgbadger.DefaultOptions("").WithTruncate(true).