Skip to content

Commit

Permalink
Merge #42599
Browse files Browse the repository at this point in the history
42599: storage/engine: fix pebbleExportToSst behavior on empty sstables r=petermattis a=petermattis

Fix `pebbleExportToSst` to return a `nil` sstable if the no records were
added. The previous behavior was a minor behavioral difference from the
C++ version of `ExportToSst` which caused
`TestRandomKeyAndTimestampExport` to be flaky when run on Pebble.

Release note: None

Co-authored-by: Peter Mattis <petermattis@gmail.com>
  • Loading branch information
craig[bot] and petermattis committed Nov 20, 2019
2 parents 0d6f4c3 + 8686721 commit 465ad37
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/storage/engine/pebble.go
Original file line number Diff line number Diff line change
Expand Up @@ -1017,5 +1017,11 @@ func pebbleExportToSst(
return nil, roachpb.BulkOpSummary{}, err
}

if rows.BulkOpSummary.DataSize == 0 {
// If no records were added to the sstable, return an empty sstable. This
// is used by export code to avoid ingestion of empty sstables.
return nil, roachpb.BulkOpSummary{}, nil
}

return sstFile.Data(), rows.BulkOpSummary, nil
}

0 comments on commit 465ad37

Please sign in to comment.