Remove Validator DB Cache (#9238)

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
Nishant Das 2021-07-21 23:26:07 +08:00 committed by GitHub
parent e1d543a77b
commit c780301096
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,10 +21,6 @@ import (
var _ iface.Database = (*Store)(nil)
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 = "beaconchaindata"
// DatabaseFileName is the name of the beacon node database.
@ -59,7 +55,6 @@ type Store struct {
db *bolt.DB
databasePath string
blockCache *ristretto.Cache
validatorIndexCache *ristretto.Cache
stateSummaryCache *stateSummaryCache
ctx context.Context
}
@ -109,20 +104,10 @@ func NewKVStore(ctx context.Context, dirPath string, config *Config) (*Store, er
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{
db: boltDB,
databasePath: dirPath,
blockCache: blockCache,
validatorIndexCache: validatorCache,
stateSummaryCache: newStateSummaryCache(),
ctx: ctx,
}