Skip to content

Conversation

@rfyiamcool
Copy link
Contributor

😁 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

DefaultOptions

// 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.

// 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
}

The default value of NumCompactors is 4, not 2.
@skrdgraph
Copy link
Contributor

Thanks @rfyiamcool for helping out here.

@skrdgraph skrdgraph merged commit f690097 into dgraph-io:main Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants