Skip to content

Commit

Permalink
db: introduce Download API
Browse files Browse the repository at this point in the history
This commit introduces a `DB.Download()` API which is used during
online restore to copy off external data.
  • Loading branch information
RaduBerinde committed Jul 28, 2023
1 parent ce43e65 commit 5e7f885
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -1743,6 +1743,30 @@ func (d *DB) splitManualCompaction(
return splitCompactions
}

// DownloadSpan is a key range passed to the Download method.
type DownloadSpan struct {
StartKey []byte
// EndKey is exclusive.
EndKey []byte
}

// Download ensures that the LSM does not use any external sstables for the
// given key ranges. It does so by performing appropriate compactions so that
// all external data becomes available locally.
//
// Note that calling this method does not imply that all other compactions stop;
// it simply informs Pebble of a list of spans for which external data should be
// downloaded with high priority.
//
// The method returns once no external sstasbles overlap the given spans, the
// context is canceled, or an error is hit.
//
// TODO(radu): consider passing a priority/impact knob to express how important
// the download is (versus live traffic performance, LSM health).
func (d *DB) Download(ctx context.Context, spans []DownloadSpan) error {
return errors.Errorf("not implemented")
}

// Flush the memtable to stable storage.
func (d *DB) Flush() error {
flushDone, err := d.AsyncFlush()
Expand Down

0 comments on commit 5e7f885

Please sign in to comment.