Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add MAX_COMPACTION_LEVELS option #211

Merged
merged 1 commit into from
Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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 DOCUMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -1385,6 +1385,10 @@ You can tune the LOG_LEVEL of the Datahub. The supported values are DEBUG and IN

The Datahub supports reporting metrics trough a StatsD server. This is turned off if left empty, and you can turn it on by giving it an ip-address and a port combination.

```MAX_COMPACTION_LEVELS```

Can be used to override Badger's default 7 LSM levels. When more that 1.1TB disk space usage are exceeded or expected to be exceeded, 8 compaction levels are needed.

#### Securing the Data Hub

There are four main security models for the data hub.
Expand Down
1 change: 1 addition & 0 deletions internal/conf/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func loadEnv(basePath *string, loadFromHome bool) (*Env, error) {
FullsyncLeaseTimeout: viper.GetDuration("FULLSYNC_LEASE_TIMEOUT"),
BlockCacheSize: viper.GetInt64("BLOCK_CACHE_SIZE"),
ValueLogFileSize: viper.GetInt64("VALUE_LOG_FILE_SIZE"),
MaxCompactionLevels: viper.GetInt("MAX_COMPACTION_LEVELS"),
AdminUserName: viper.GetString("ADMIN_USERNAME"),
AdminPassword: viper.GetString("ADMIN_PASSWORD"),
NodeId: viper.GetString("NODE_ID"),
Expand Down
1 change: 1 addition & 0 deletions internal/conf/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type Env struct {
FullsyncLeaseTimeout time.Duration
BlockCacheSize int64
ValueLogFileSize int64
MaxCompactionLevels int
AdminUserName string
AdminPassword string
NodeId string
Expand Down
10 changes: 9 additions & 1 deletion internal/server/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ type Store struct {
fullsyncLeaseTimeout time.Duration
blockCacheSize int64
valueLogFileSize int64
maxCompactionLevels int
}

type BadgerLogger struct { // we use this to implement the Badger Logger interface
Expand Down Expand Up @@ -86,6 +87,7 @@ func NewStore(lc fx.Lifecycle, env *conf.Env, statsdClient statsd.ClientInterfac
fullsyncLeaseTimeout: fsTimeout,
blockCacheSize: env.BlockCacheSize,
valueLogFileSize: env.ValueLogFileSize,
maxCompactionLevels: env.MaxCompactionLevels,
}
store.NamespaceManager = NewNamespaceManager(store)

Expand Down Expand Up @@ -342,7 +344,13 @@ func (s *Store) GetGlobalContext() *Context {
func (s *Store) Open() error {
s.logger.Info("Open database")
opts := badger.DefaultOptions(s.storeLocation)
opts.MaxLevels = 8 // make badger accept data larger than 1.1TB

if s.maxCompactionLevels > 0 {
// default is 7, set to 8 to make badger accept data larger than 1.1TB at the cost of larger compactions
opts.MaxLevels = s.maxCompactionLevels
}
s.logger.Infof("Max Compaction Levels: %v", opts.MaxLevels)

if s.blockCacheSize > 0 {
opts.BlockCacheSize = s.blockCacheSize
} else {
Expand Down