Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -1381,7 +1381,7 @@ func (b *Batch) countData() []byte {

func (b *Batch) grow(n int) {
newSize := len(b.data) + n
if uint64(newSize) >= maxBatchSize {
if uint64(newSize) > maxBatchSize {
panic(ErrBatchTooLarge)
}
if newSize > cap(b.data) {
Expand Down
2 changes: 1 addition & 1 deletion batch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ func TestBatchTooLarge(t *testing.T) {
result = r
}
}()
b.grow(maxBatchSize)
b.grow(maxBatchSize + 1)
}()
require.EqualValues(t, ErrBatchTooLarge, result)
}
Expand Down
4 changes: 2 additions & 2 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -1662,8 +1662,8 @@ func (o *Options) Validate() error {
fmt.Fprintf(&buf, "L0StopWritesThreshold (%d) must be >= L0CompactionThreshold (%d)\n",
o.L0StopWritesThreshold, o.L0CompactionThreshold)
}
if uint64(o.MemTableSize) >= maxMemTableSize {
fmt.Fprintf(&buf, "MemTableSize (%s) must be < %s\n",
if uint64(o.MemTableSize) > maxMemTableSize {
fmt.Fprintf(&buf, "MemTableSize (%s) must be <= %s\n",
humanize.Bytes.Uint64(uint64(o.MemTableSize)), humanize.Bytes.Uint64(maxMemTableSize))
}
if o.MemTableStopWritesThreshold < 2 {
Expand Down
2 changes: 1 addition & 1 deletion options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ func TestOptionsValidate(t *testing.T) {
[Options]
mem_table_size=4294967296
`,
`MemTableSize \(4\.0GB\) must be < [2|4]\.0GB`,
`MemTableSize \(4\.0GB\) must be <= [2|4]\.0GB`,
},
{`
[Options]
Expand Down