Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
bulk: disable two level index in Pebble
Browse files Browse the repository at this point in the history
Setting the IndexBlockSize to MaxInt disables two level indexes. Using
two level indexes cause issues restoring some registration cluster
backups. This change servers as a work-around until
cockroachdb/pebble#285 is resolved.

Release justification: RESTOREs on registration cluster backups started
failing after enabling two level indexes in Pebble. This was a release
blocking bug and this fix allows these backups to be restored again
until more investigation is done in the two level index issue.

Release note: None
  • Loading branch information
pbardea committed Sep 18, 2019
1 parent 8e15411 commit 1a4b8c8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/storage/bulk/sst_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ package bulk
import (
"bytes"
"io"
"math"

"github.com/cockroachdb/cockroach/pkg/storage/engine"
"github.com/cockroachdb/cockroach/pkg/storage/engine/enginepb"
Expand Down Expand Up @@ -108,7 +109,9 @@ var pebbleOpts = func() *pebble.Options {
// MakeSSTWriter creates a new SSTWriter.
func MakeSSTWriter() SSTWriter {
f := &memFile{}
sst := sstable.NewWriter(f, pebbleOpts, pebble.LevelOptions{BlockSize: 64 * 1024})
// Setting the IndexBlockSize to MaxInt disables twoLevelIndexes in Pebble.
// TODO(pbardea): Remove the IndexBlockSize option when https://github.com/cockroachdb/pebble/issues/285 is resolved.
sst := sstable.NewWriter(f, pebbleOpts, pebble.LevelOptions{BlockSize: 64 * 1024, IndexBlockSize: math.MaxInt32})
return SSTWriter{fw: sst, f: f}
}

Expand Down

0 comments on commit 1a4b8c8

Please sign in to comment.