mirror of
https://github.com/luxfi/zapdb.git
synced 2026-07-27 06:54:45 +00:00
Use actual value of uint16-16 in ErrValueThreshold (#877)
* Use actual value of uint16-16 in ErrValueThreshold The ErrValueThreshold doesn't really show what should be the max value of value threshold. This commit adds the actual value of value threshold to the error message.
This commit is contained in:
@@ -192,7 +192,7 @@ func Open(opt Options) (db *DB, err error) {
|
||||
opt.maxBatchSize = (15 * opt.MaxTableSize) / 100
|
||||
opt.maxBatchCount = opt.maxBatchSize / int64(skl.MaxNodeSize)
|
||||
|
||||
if opt.ValueThreshold > math.MaxUint16-16 {
|
||||
if opt.ValueThreshold > ValueThresholdLimit {
|
||||
return nil, ErrValueThreshold
|
||||
}
|
||||
|
||||
|
||||
@@ -17,9 +17,16 @@
|
||||
package badger
|
||||
|
||||
import (
|
||||
"math"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
const (
|
||||
// ValueThresholdLimit is the maximum permissible value of opt.ValueThreshold.
|
||||
ValueThresholdLimit = math.MaxUint16 - 16 + 1
|
||||
)
|
||||
|
||||
var (
|
||||
// ErrValueLogSize is returned when opt.ValueLogFileSize option is not within the valid
|
||||
// range.
|
||||
@@ -27,7 +34,8 @@ var (
|
||||
|
||||
// ErrValueThreshold is returned when ValueThreshold is set to a value close to or greater than
|
||||
// uint16.
|
||||
ErrValueThreshold = errors.New("Invalid ValueThreshold, must be lower than uint16")
|
||||
ErrValueThreshold = errors.Errorf(
|
||||
"Invalid ValueThreshold, must be less than %d", ValueThresholdLimit)
|
||||
|
||||
// ErrKeyNotFound is returned when key isn't found on a txn.Get.
|
||||
ErrKeyNotFound = errors.New("Key not found")
|
||||
|
||||
Reference in New Issue
Block a user