Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions node/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ type Config struct {

// A special test only setting. If true, then littDB will throw an error if the same data is written twice.
LittDBDoubleWriteProtection bool

// The size of the cache for storing chunks in littDB, in gigabytes.
LittDBChunkCacheSizeGB float64 // TODO flag
}

// NewConfig parses the Config from the provided flags or environment variables and
Expand Down Expand Up @@ -340,6 +343,7 @@ func NewConfig(ctx *cli.Context) (*Config, error) {
StoreChunksRequestMaxPastAge: ctx.GlobalDuration(flags.StoreChunksRequestMaxPastAgeFlag.Name),
StoreChunksRequestMaxFutureAge: ctx.GlobalDuration(flags.StoreChunksRequestMaxFutureAgeFlag.Name),
LittDBEnabled: ctx.GlobalBool(flags.LittDBEnabledFlag.Name),
LittDBChunkCacheSizeGB: ctx.GlobalFloat64(flags.LittDBCacheSizeGBFlag.Name),
DownloadPoolSize: ctx.GlobalInt(flags.DownloadPoolSizeFlag.Name),
}, nil
}
7 changes: 7 additions & 0 deletions node/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,13 @@ var (
Required: false,
EnvVar: common.PrefixEnvVar(EnvVarPrefix, "LITT_DB_ENABLED"),
}
LittDBCacheSizeGBFlag = cli.IntFlag{
Name: common.PrefixFlag(FlagPrefix, "litt-db-cache-size-gb"),
Usage: "The size of the LittDB cache in gigabytes.",
Required: false,
Value: 16 * units.GiB,
EnvVar: common.PrefixEnvVar(EnvVarPrefix, "LITT_DB_CACHE_SIZE_GB"),
}
DownloadPoolSizeFlag = cli.IntFlag{
Name: common.PrefixFlag(FlagPrefix, "download-pool-size"),
Usage: "The size of the download pool. The default value is 16.",
Expand Down
6 changes: 6 additions & 0 deletions node/validator_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/Layr-Labs/eigenda/litt/littbuilder"
"github.com/Layr-Labs/eigenda/litt/util"
"github.com/Layr-Labs/eigensdk-go/logging"
"github.com/docker/go-units"
"github.com/prometheus/client_golang/prometheus"
)

Expand Down Expand Up @@ -269,6 +270,11 @@ func NewValidatorStore(
return nil, fmt.Errorf("failed to get chunks table: %w", err)
}

err = chunkTable.SetCacheSize(uint64(config.LittDBChunkCacheSizeGB * units.GiB))
if err != nil {
return nil, fmt.Errorf("failed to set cache size for chunks table: %w", err)
}

// A prior implementation stored data here. Delete it if it exists.
// This is safe to delete once all old validators have been migrated to the new version.
err = littDB.DropTable(headersTableName)
Expand Down
Loading