Skip to content

Commit

Permalink
metamorphic: transform percentage of SINGLEDEL ops to DELETE ops
Browse files Browse the repository at this point in the history
Generated SINGLEDEL operations are eligible for transformation into less
restrictive DELETE operations.

Transform a fixed percentage of SINGLEDEL operations at generation time
into DELETEs to further exercise the delete execution paths.

Related to cockroachdb/cockroach#69414.
  • Loading branch information
nicktrav committed Sep 1, 2021
1 parent 47a0129 commit 2981677
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions internal/metamorphic/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -840,10 +840,20 @@ func (g *generator) writerSingleDelete() {
if key == nil {
return
}
g.add(&singleDeleteOp{
writerID: writerID,
key: key,
})

// Keys eligible for single deletes can be removed with a regular delete.
// Mutate a percentage of SINGLEDEL ops into DELETEs.
if g.rng.Float64() < 0.25 {
g.add(&deleteOp{
writerID: writerID,
key: key,
})
} else {
g.add(&singleDeleteOp{
writerID: writerID,
key: key,
})
}
g.tryRepositionBatchIters(writerID)
}

Expand Down

0 comments on commit 2981677

Please sign in to comment.