Skip to content

Commit 7b30bd8

Browse files
committed
sstable: assert invariant when range key is added to Writer
This pr adds an invariant check behing the invariants.Enabled flag to confirm that the start/end bounds of the range keys added to the Writer are not the same.
1 parent 6189b5c commit 7b30bd8

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

sstable/writer.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -970,6 +970,11 @@ func (w *Writer) AddRangeKey(key InternalKey, value []byte) error {
970970
}
971971

972972
func (w *Writer) addRangeKeySpan(span keyspan.Span) error {
973+
if w.compare(span.Start, span.End) >= 0 {
974+
return errors.Errorf(
975+
"pebble: start key must be strictly less than end key",
976+
)
977+
}
973978
if w.fragmenter.Start() != nil && w.compare(w.fragmenter.Start(), span.Start) > 0 {
974979
return errors.Errorf("pebble: spans must be added in order: %s > %s",
975980
w.formatKey(w.fragmenter.Start()), w.formatKey(span.Start))

0 commit comments

Comments
 (0)