@@ -898,19 +898,14 @@ func (o *ingestAndExciseOp) run(t *Test, h historyRecorder) {
898
898
}
899
899
db := t .getDB (o .dbID )
900
900
if b .Empty () {
901
- // Ingestion will be a no-op. But still do a DeleteRange and RangeKeyDelete
902
- // as the generator/key manager expect this to succeed regardless.
903
- //
904
- // TODO(bilal): Take out this case when we support standalone Excises with
905
- // no ingestions.
906
- err = firstError (err , db .DeleteRange (o .exciseStart , o .exciseEnd , t .writeOpts ))
907
- err = firstError (err , db .RangeKeyDelete (o .exciseStart , o .exciseEnd , t .writeOpts ))
908
- h .Recordf ("%s // %v" , o , err )
901
+ h .Recordf ("%s // %v" , o , o .simulateExcise (db , t ))
909
902
return
910
903
}
904
+
911
905
if o .sstContainsExciseTombstone {
912
906
// Add a rangedel and rangekeydel to the batch. This ensures it'll end up
913
- // inside the sstable.
907
+ // inside the sstable. Note that all entries in the sstable will have the
908
+ // same sequence number, so the ordering within the batch doesn't matter.
914
909
err = firstError (err , b .DeleteRange (o .exciseStart , o .exciseEnd , t .writeOpts ))
915
910
err = firstError (err , b .RangeKeyDelete (o .exciseStart , o .exciseEnd , t .writeOpts ))
916
911
}
@@ -919,38 +914,39 @@ func (o *ingestAndExciseOp) run(t *Test, h historyRecorder) {
919
914
h .Recordf ("Build(%s) // %v" , o .batchID , err2 )
920
915
return
921
916
}
922
- err = firstError (err , err2 )
923
917
err = firstError (err , b .Close ())
924
918
925
919
if writerMeta .Properties .NumEntries == 0 && writerMeta .Properties .NumRangeKeys () == 0 {
926
- // No-op.
927
- h .Recordf ("%s // %v" , o , err )
920
+ h .Recordf ("%s // %v" , o , o .simulateExcise (db , t ))
928
921
return
929
922
}
930
- if ! t .testOpts .useExcise {
931
- // Do a rangedel and rangekeydel before the ingestion. This mimics the
932
- // behaviour of an excise.
933
- err = firstError (err , db .DeleteRange (o .exciseStart , o .exciseEnd , t .writeOpts ))
934
- err = firstError (err , db .RangeKeyDelete (o .exciseStart , o .exciseEnd , t .writeOpts ))
935
- }
936
923
937
924
if t .testOpts .useExcise {
938
925
err = firstError (err , t .withRetries (func () error {
939
- _ , err := t . getDB ( o . dbID ) .IngestAndExcise ([]string {path }, nil /* shared */ , nil /* external */ , pebble.KeyRange {
926
+ _ , err := db .IngestAndExcise ([]string {path }, nil /* shared */ , nil /* external */ , pebble.KeyRange {
940
927
Start : o .exciseStart ,
941
928
End : o .exciseEnd ,
942
929
}, o .sstContainsExciseTombstone )
943
930
return err
944
931
}))
945
932
} else {
933
+ err = firstError (err , o .simulateExcise (db , t ))
946
934
err = firstError (err , t .withRetries (func () error {
947
- return t . getDB ( o . dbID ) .Ingest ([]string {path })
935
+ return db .Ingest ([]string {path })
948
936
}))
949
937
}
950
938
951
939
h .Recordf ("%s // %v" , o , err )
952
940
}
953
941
942
+ func (o * ingestAndExciseOp ) simulateExcise (db * pebble.DB , t * Test ) error {
943
+ // Simulate the excise using a DeleteRange and RangeKeyDelete.
944
+ return errors .CombineErrors (
945
+ db .DeleteRange (o .exciseStart , o .exciseEnd , t .writeOpts ),
946
+ db .RangeKeyDelete (o .exciseStart , o .exciseEnd , t .writeOpts ),
947
+ )
948
+ }
949
+
954
950
func (o * ingestAndExciseOp ) receiver () objID { return o .dbID }
955
951
func (o * ingestAndExciseOp ) syncObjs () objIDSlice {
956
952
// Ingest should not be concurrent with mutating the batches that will be
0 commit comments