diff --git a/node/repo/fsrepo_ds.go b/node/repo/fsrepo_ds.go index e62fe17e4..f4afe0dee 100644 --- a/node/repo/fsrepo_ds.go +++ b/node/repo/fsrepo_ds.go @@ -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).