Skip to content

Commit

Permalink
fix: update code comments for WithNumCompactors (hypermodeinc#1900)
Browse files Browse the repository at this point in the history
😁 I think the default value of NumCompactors is `4` in comments for
WithNumCompactors, it's not 2.

Because the value of NumCompactors is 4 in `DefaultOptions` function.


[https://github.com/dgraph-io/badger/blob/main/options.go#L148](https://github.com/dgraph-io/badger/blob/main/options.go#L148)

### DefaultOptions

```go
// DefaultOptions sets a list of recommended options for good performance.
// Feel free to modify these to suit your needs with the WithX methods.
func DefaultOptions(path string) Options {
	return Options{
		// ...

		NumCompactors:           4, // Run at least 2 compactors. Zero-th compactor prioritizes L0.

		// ...
}
```

### code comments for WithNumCompactors.

```go
// WithNumCompactors sets the number of compaction workers to run concurrently.  Setting this to
// zero stops compactions, which could eventually cause writes to block forever.
//
// The default value of NumCompactors is 2. One is dedicated just for L0 and L1.
func (opt Options) WithNumCompactors(val int) Options {
	opt.NumCompactors = val
	return opt
}
```
  • Loading branch information
rfyiamcool authored Mar 7, 2023
1 parent 89e30b4 commit f690097
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion options.go
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ func (opt Options) WithValueLogMaxEntries(val uint32) Options {
// WithNumCompactors sets the number of compaction workers to run concurrently. Setting this to
// zero stops compactions, which could eventually cause writes to block forever.
//
// The default value of NumCompactors is 2. One is dedicated just for L0 and L1.
// The default value of NumCompactors is 4. One is dedicated just for L0 and L1.
func (opt Options) WithNumCompactors(val int) Options {
opt.NumCompactors = val
return opt
Expand Down

0 comments on commit f690097

Please sign in to comment.