mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-28 14:47:16 +00:00
mdbx mergeThreshold option #665
This commit is contained in:
parent
ca2ebac0f9
commit
9860f845fe
@ -59,7 +59,12 @@ type MdbxOpts struct {
|
||||
syncPeriod time.Duration
|
||||
augumentLimit uint64
|
||||
pageSize uint64
|
||||
roTxsLimiter *semaphore.Weighted
|
||||
|
||||
// must be in the range from 12.5% (almost empty) to 50% (half empty)
|
||||
// which corresponds to the range from 8192 and to 32768 in units respectively
|
||||
mergeThreshold uint64
|
||||
|
||||
roTxsLimiter *semaphore.Weighted
|
||||
}
|
||||
|
||||
func testKVPath() string {
|
||||
@ -72,11 +77,12 @@ func testKVPath() string {
|
||||
|
||||
func NewMDBX(log log.Logger) MdbxOpts {
|
||||
return MdbxOpts{
|
||||
bucketsCfg: WithChaindataTables,
|
||||
flags: mdbx.NoReadahead | mdbx.Coalesce | mdbx.Durable,
|
||||
log: log,
|
||||
pageSize: kv.DefaultPageSize(),
|
||||
growthStep: 2 * datasize.GB,
|
||||
bucketsCfg: WithChaindataTables,
|
||||
flags: mdbx.NoReadahead | mdbx.Coalesce | mdbx.Durable,
|
||||
log: log,
|
||||
pageSize: kv.DefaultPageSize(),
|
||||
growthStep: 2 * datasize.GB,
|
||||
mergeThreshold: 32768,
|
||||
}
|
||||
}
|
||||
|
||||
@ -160,6 +166,11 @@ func (opts MdbxOpts) WriteMap() MdbxOpts {
|
||||
return opts
|
||||
}
|
||||
|
||||
func (opts MdbxOpts) WriteMergeThreshold(v uint64) MdbxOpts {
|
||||
opts.mergeThreshold = v
|
||||
return opts
|
||||
}
|
||||
|
||||
func (opts MdbxOpts) WithTableCfg(f TableCfgFunc) MdbxOpts {
|
||||
opts.bucketsCfg = f
|
||||
return opts
|
||||
@ -263,7 +274,7 @@ func (opts MdbxOpts) Open() (kv.RwDB, error) {
|
||||
}
|
||||
// must be in the range from 12.5% (almost empty) to 50% (half empty)
|
||||
// which corresponds to the range from 8192 and to 32768 in units respectively
|
||||
if err = env.SetOption(mdbx.OptMergeThreshold16dot16Percent, 32768); err != nil {
|
||||
if err = env.SetOption(mdbx.OptMergeThreshold16dot16Percent, opts.mergeThreshold); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user