Skip to content

Commit

Permalink
expend the tablesize range (#347)
Browse files Browse the repository at this point in the history
* expend the tablesize range
  • Loading branch information
jingweicb authored Sep 20, 2022
1 parent 6dd4f30 commit 0ff8d25
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion configuration/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ func assertConfiguration(ctx context.Context, config *Configuration) error {
return fmt.Errorf("the number of serial block workers %d is invalid: %w", config.SerialBlockWorkers, cliErrs.ErrNegativeSerialBlockWorkers)
}

if config.TableSize != nil && (*config.TableSize < 2 || *config.TableSize > 100) {
if config.TableSize != nil && (*config.TableSize < 1 || *config.TableSize > 100) {
return fmt.Errorf("table size %d is invalid: %w", *config.TableSize, cliErrs.ErrTableSizeIsOutOfRange)
}

Expand Down
12 changes: 6 additions & 6 deletions configuration/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,23 +413,23 @@ type Configuration struct {
// to performance gains.
CompressionDisabled bool `json:"compression_disabled"`

// MemoryLimitDisabled configures storage to increase memory
// L0InMemoryEnabled configures storage to increase memory
// usage. Enabling this massively increases performance
// but can use 10s of GBs of RAM, even with pruning enabled.
MemoryLimitDisabled bool `json:"memory_limit_disabled"`
L0InMemoryEnabled bool `json:"l0_in_memory_enabled"`

// AllInMemoryDisabled configures storage to increase memory
// usage. Enabling this massively increases performance
// but can use >20s of GBs of RAM, even with pruning enabled.
AllInMemoryEnabled bool `json:"all_in_memory_enabled"`

// TableSize unit is GB, enable users to define MaxTableSize
// when AllInMemoryEnabled == true or MemoryLimitDisabled== true, Cli will look up this config
// default value is 3, modification range is [2, 100]
// when AllInMemoryEnabled == true or L0InMemoryEnabled== true, Cli will look up this config
// default value is 2, modification range is [1, 100]
TableSize *int64 `json:"table_size,omitempty"`

// TableSize unit is MB, enable users to define ValueLogFileSize
// when AllInMemoryEnabled == true or MemoryLimitDisabled== true, Cli will look up this config
// ValueLogFileSize unit is MB, enable users to define ValueLogFileSize
// when AllInMemoryEnabled == true or L0InMemoryEnabled== true, Cli will look up this config
// default value is 512, modification range is [128, 2048]
ValueLogFileSize *int64 `json:"value_log_file_size,omitempty"`

Expand Down
2 changes: 1 addition & 1 deletion examples/configuration/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"max_reorg_depth": 100,
"log_configuration": false,
"compression_disabled": false,
"memory_limit_disabled": false,
"l0_in_memory_enabled": false,
"all_in_memory_enabled": false,
"error_stack_trace_disabled": false,
"coin_supported": false,
Expand Down
2 changes: 1 addition & 1 deletion pkg/errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var (
ErrNegativeSeenBlockWorkers = errors.New("the number of seen block workers is negative")
ErrNegativeSerialBlockWorkers = errors.New("the number of serial block workers is negative")
ErrReconciliationOutOfRange = errors.New("reconciliation is out of range, it must be in the range [0, 1]")
ErrTableSizeIsOutOfRange = errors.New("table size is out of range, it must be in the range [2, 100]")
ErrTableSizeIsOutOfRange = errors.New("table size is out of range, it must be in the range [1, 100]")
ErrValueLogFileSizeIsOutOfRange = errors.New("value log file size is out of range, it must be in the range [128, 2048]")
ErrBalanceTrackingIsDisabledForReconciliation = errors.New("balance tracking cannot be disabled for reconciliation")
ErrBalanceTrackingIsDisabledForReconciliationCoverageEndCondition = errors.New("balance tracking cannot be disabled for reconciliation coverage end condition")
Expand Down
2 changes: 1 addition & 1 deletion pkg/tester/construction.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func InitializeConstruction(
if config.CompressionDisabled {
opts = append(opts, database.WithoutCompression())
}
if config.MemoryLimitDisabled {
if config.L0InMemoryEnabled {
opts = append(
opts,
database.WithCustomSettings(database.PerformanceBadgerOptions(dataPath)),
Expand Down
6 changes: 3 additions & 3 deletions pkg/tester/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const (
EndAtTipCheckInterval = 10 * time.Second

//MinTableSize unit is GB
MinTableSize = int64(2)
MinTableSize = int64(1)

//MaxTableSize unit is GB
MaxTableSize = int64(100)
Expand Down Expand Up @@ -179,7 +179,7 @@ func InitializeData(
if config.CompressionDisabled {
opts = append(opts, database.WithoutCompression())
}
if config.MemoryLimitDisabled {
if config.L0InMemoryEnabled {
opts = append(
opts,
database.WithCustomSettings(database.PerformanceBadgerOptions(dataPath)),
Expand All @@ -191,7 +191,7 @@ func InitializeData(
// according to users config. tableSize means the LSM table size, when the table more than the tableSize,
// will trigger a compact.
// In default mode, we will not change the badger DB's TableSize and ValueLogFileSize for limiting memory usage
if config.AllInMemoryEnabled || config.MemoryLimitDisabled {
if config.AllInMemoryEnabled || config.L0InMemoryEnabled {
if config.TableSize != nil {
if *config.TableSize >= MinTableSize && *config.TableSize <= MaxTableSize {
opts = append(
Expand Down

0 comments on commit 0ff8d25

Please sign in to comment.