mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-22 14:22:37 +01:00
lncfg+channeldb: add autocompact flags to BoltConfig
This commit is contained in:
parent
c7eea13f95
commit
6131a53eb4
3 changed files with 36 additions and 9 deletions
|
@ -1,18 +1,31 @@
|
||||||
package kvdb
|
package kvdb
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
const (
|
||||||
// BoltBackendName is the name of the backend that should be passed into
|
// BoltBackendName is the name of the backend that should be passed into
|
||||||
// kvdb.Create to initialize a new instance of kvdb.Backend backed by a live
|
// kvdb.Create to initialize a new instance of kvdb.Backend backed by a
|
||||||
// instance of bbolt.
|
// live instance of bbolt.
|
||||||
const BoltBackendName = "bdb"
|
BoltBackendName = "bdb"
|
||||||
|
|
||||||
// EtcdBackendName is the name of the backend that should be passed into
|
// EtcdBackendName is the name of the backend that should be passed into
|
||||||
// kvdb.Create to initialize a new instance of kvdb.Backend backed by a live
|
// kvdb.Create to initialize a new instance of kvdb.Backend backed by a
|
||||||
// instance of etcd.
|
// live instance of etcd.
|
||||||
const EtcdBackendName = "etcd"
|
EtcdBackendName = "etcd"
|
||||||
|
|
||||||
|
// DefaultBoltAutoCompactMinAge is the default minimum time that must
|
||||||
|
// have passed since a bolt database file was last compacted for the
|
||||||
|
// compaction to be considered again.
|
||||||
|
DefaultBoltAutoCompactMinAge = time.Hour * 24 * 7
|
||||||
|
)
|
||||||
|
|
||||||
// BoltConfig holds bolt configuration.
|
// BoltConfig holds bolt configuration.
|
||||||
type BoltConfig struct {
|
type BoltConfig struct {
|
||||||
SyncFreelist bool `long:"nofreelistsync" description:"Whether the databases used within lnd should sync their freelist to disk. This is disabled by default resulting in improved memory performance during operation, but with an increase in startup time."`
|
SyncFreelist bool `long:"nofreelistsync" description:"Whether the databases used within lnd should sync their freelist to disk. This is disabled by default resulting in improved memory performance during operation, but with an increase in startup time."`
|
||||||
|
|
||||||
|
AutoCompact bool `long:"auto-compact" description:"Whether the databases used within lnd should automatically be compacted on every startup (and if the database has the configured minimum age). This is disabled by default because it requires additional disk space to be available during the compaction that is freed afterwards. In general compaction leads to smaller database files."`
|
||||||
|
|
||||||
|
AutoCompactMinAge time.Duration `long:"auto-compact-min-age" description:"How long ago the last compaction of a database file must be for it to be considered for auto compaction again. Can be set to 0 to compact on every startup."`
|
||||||
}
|
}
|
||||||
|
|
||||||
// EtcdConfig holds etcd configuration.
|
// EtcdConfig holds etcd configuration.
|
||||||
|
|
|
@ -26,7 +26,9 @@ type DB struct {
|
||||||
func DefaultDB() *DB {
|
func DefaultDB() *DB {
|
||||||
return &DB{
|
return &DB{
|
||||||
Backend: BoltBackend,
|
Backend: BoltBackend,
|
||||||
Bolt: &kvdb.BoltConfig{},
|
Bolt: &kvdb.BoltConfig{
|
||||||
|
AutoCompactMinAge: kvdb.DefaultBoltAutoCompactMinAge,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -928,3 +928,15 @@ litecoin.node=ltcd
|
||||||
[bolt]
|
[bolt]
|
||||||
; If true, prevents the database from syncing its freelist to disk.
|
; If true, prevents the database from syncing its freelist to disk.
|
||||||
; db.bolt.nofreelistsync=1
|
; db.bolt.nofreelistsync=1
|
||||||
|
|
||||||
|
; Whether the databases used within lnd should automatically be compacted on
|
||||||
|
; every startup (and if the database has the configured minimum age). This is
|
||||||
|
; disabled by default because it requires additional disk space to be available
|
||||||
|
; during the compaction that is freed afterwards. In general compaction leads to
|
||||||
|
; smaller database files.
|
||||||
|
; db.bolt.auto-compact=true
|
||||||
|
|
||||||
|
; How long ago the last compaction of a database file must be for it to be
|
||||||
|
; considered for auto compaction again. Can be set to 0 to compact on every
|
||||||
|
; startup. (default: 168h)
|
||||||
|
; db.bolt.auto-compact-min-age=0
|
||||||
|
|
Loading…
Add table
Reference in a new issue