mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-12 20:50:05 +00:00
Remove Validator DB Cache (#9238)
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
parent
e1d543a77b
commit
c780301096
@ -21,10 +21,6 @@ import (
|
|||||||
var _ iface.Database = (*Store)(nil)
|
var _ iface.Database = (*Store)(nil)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// VotesCacheSize with 1M validators will be 8MB.
|
|
||||||
VotesCacheSize = 1 << 23
|
|
||||||
// NumOfVotes specifies the vote cache size.
|
|
||||||
NumOfVotes = 1 << 20
|
|
||||||
// BeaconNodeDbDirName is the name of the directory containing the beacon node database.
|
// BeaconNodeDbDirName is the name of the directory containing the beacon node database.
|
||||||
BeaconNodeDbDirName = "beaconchaindata"
|
BeaconNodeDbDirName = "beaconchaindata"
|
||||||
// DatabaseFileName is the name of the beacon node database.
|
// DatabaseFileName is the name of the beacon node database.
|
||||||
@ -56,12 +52,11 @@ type Config struct {
|
|||||||
// Store defines an implementation of the Prysm Database interface
|
// Store defines an implementation of the Prysm Database interface
|
||||||
// using BoltDB as the underlying persistent kv-store for Ethereum Beacon Nodes.
|
// using BoltDB as the underlying persistent kv-store for Ethereum Beacon Nodes.
|
||||||
type Store struct {
|
type Store struct {
|
||||||
db *bolt.DB
|
db *bolt.DB
|
||||||
databasePath string
|
databasePath string
|
||||||
blockCache *ristretto.Cache
|
blockCache *ristretto.Cache
|
||||||
validatorIndexCache *ristretto.Cache
|
stateSummaryCache *stateSummaryCache
|
||||||
stateSummaryCache *stateSummaryCache
|
ctx context.Context
|
||||||
ctx context.Context
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// KVStoreDatafilePath is the canonical construction of a full
|
// KVStoreDatafilePath is the canonical construction of a full
|
||||||
@ -109,22 +104,12 @@ func NewKVStore(ctx context.Context, dirPath string, config *Config) (*Store, er
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
validatorCache, err := ristretto.NewCache(&ristretto.Config{
|
|
||||||
NumCounters: NumOfVotes, // number of keys to track frequency of (1M).
|
|
||||||
MaxCost: VotesCacheSize, // maximum cost of cache (8MB).
|
|
||||||
BufferItems: 64, // number of keys per Get buffer.
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
kv := &Store{
|
kv := &Store{
|
||||||
db: boltDB,
|
db: boltDB,
|
||||||
databasePath: dirPath,
|
databasePath: dirPath,
|
||||||
blockCache: blockCache,
|
blockCache: blockCache,
|
||||||
validatorIndexCache: validatorCache,
|
stateSummaryCache: newStateSummaryCache(),
|
||||||
stateSummaryCache: newStateSummaryCache(),
|
ctx: ctx,
|
||||||
ctx: ctx,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := kv.db.Update(func(tx *bolt.Tx) error {
|
if err := kv.db.Update(func(tx *bolt.Tx) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user