Skip to content
Merged
Changes from 1 commit
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
Next Next commit
ethdb/pebble: fix range compaction
  • Loading branch information
rjl493456442 committed Feb 27, 2023
commit 3e678c9c96915af1e108c4d5422d7e41e5555125
8 changes: 8 additions & 0 deletions ethdb/pebble/pebble.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package pebble

import (
"bytes"
"fmt"
"runtime"
"sync"
Expand Down Expand Up @@ -361,6 +362,13 @@ func (d *Database) Stat(property string) (string, error) {
// is treated as a key after all keys in the data store. If both is nil then it
// will compact entire data store.
func (d *Database) Compact(start []byte, limit []byte) error {
// There is no special flag to represent the end of key range
// in pebble(nil in leveldb). Use an ugly hack to construct a
// large key to represent it.
// https://github.com/cockroachdb/pebble/issues/2359#issuecomment-1443995833
if limit == nil {
limit = bytes.Repeat([]byte{0xff}, 32)
}
return d.db.Compact(start, limit, true) // Parallelization is preferred
}

Expand Down