mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-01 00:31:21 +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
|
syncPeriod time.Duration
|
||||||
augumentLimit uint64
|
augumentLimit uint64
|
||||||
pageSize 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 {
|
func testKVPath() string {
|
||||||
@ -72,11 +77,12 @@ func testKVPath() string {
|
|||||||
|
|
||||||
func NewMDBX(log log.Logger) MdbxOpts {
|
func NewMDBX(log log.Logger) MdbxOpts {
|
||||||
return MdbxOpts{
|
return MdbxOpts{
|
||||||
bucketsCfg: WithChaindataTables,
|
bucketsCfg: WithChaindataTables,
|
||||||
flags: mdbx.NoReadahead | mdbx.Coalesce | mdbx.Durable,
|
flags: mdbx.NoReadahead | mdbx.Coalesce | mdbx.Durable,
|
||||||
log: log,
|
log: log,
|
||||||
pageSize: kv.DefaultPageSize(),
|
pageSize: kv.DefaultPageSize(),
|
||||||
growthStep: 2 * datasize.GB,
|
growthStep: 2 * datasize.GB,
|
||||||
|
mergeThreshold: 32768,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,6 +166,11 @@ func (opts MdbxOpts) WriteMap() MdbxOpts {
|
|||||||
return opts
|
return opts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (opts MdbxOpts) WriteMergeThreshold(v uint64) MdbxOpts {
|
||||||
|
opts.mergeThreshold = v
|
||||||
|
return opts
|
||||||
|
}
|
||||||
|
|
||||||
func (opts MdbxOpts) WithTableCfg(f TableCfgFunc) MdbxOpts {
|
func (opts MdbxOpts) WithTableCfg(f TableCfgFunc) MdbxOpts {
|
||||||
opts.bucketsCfg = f
|
opts.bucketsCfg = f
|
||||||
return opts
|
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)
|
// 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
|
// 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
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user