Skip to content

Commit

Permalink
Merge #74335
Browse files Browse the repository at this point in the history
74335: sqlsmith: make sure we don't call ALTER DATABASE SURVIVE with invalid goal r=yuzefovich a=RichardJCai

Previously we would erroneously call ALTER DATABASE SURVIVE with
SurvivalGoalDefault which was invalid.

Release note: None

Resolves #74327

Co-authored-by: richardjcai <[email protected]>
  • Loading branch information
craig[bot] and RichardJCai committed Dec 30, 2021
2 parents cc22c45 + 64bfd38 commit 3471dc5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/internal/sqlsmith/alter.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,13 @@ func makeAlterDatabaseDropRegion(s *Smither) (tree.Statement, bool) {
}

func makeAlterSurvivalGoal(s *Smither) (tree.Statement, bool) {
const numSurvivalGoals = 3
randInt := rand.Intn(numSurvivalGoals)
const numSurvivalGoals = 2
// Only {1, 2} are valid values for SurvivalGoal.
// 1. SurvivalGoalRegionFailure
// 2. SurvivalGoalZoneFailure
//
// 0. SurvivalGoalDefault is not valid as a value to alter to.
randInt := rand.Intn(numSurvivalGoals) + 1
survivalGoal := tree.SurvivalGoal(randInt)

ast := &tree.AlterDatabaseSurvivalGoal{
Expand Down

0 comments on commit 3471dc5

Please sign in to comment.