Skip to content

Commit

Permalink
Fix numCompactor error
Browse files Browse the repository at this point in the history
  • Loading branch information
Ibrahim Jarif committed Aug 14, 2020
1 parent f698845 commit 1c1e17c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,11 @@ func (db *DB) replayFunction() func(Entry, valuePointer) error {

// Open returns a new DB object.
func Open(opt Options) (db *DB, err error) {
if opt.NumCompactors < 2 {
return nil, errors.New("Cannot have less than 2 compactors")
// It's okay to have zero compactors which will disable all compactions but
// we cannot have just one compactor otherwise we will end up with all data
// one level 2.
if opt.NumCompactors == 1 {
return nil, errors.New("Cannot have 1 compactor. Need at least 2")
}
if opt.InMemory && (opt.Dir != "" || opt.ValueDir != "") {
return nil, errors.New("Cannot use badger in Disk-less mode with Dir or ValueDir set")
Expand Down

0 comments on commit 1c1e17c

Please sign in to comment.