Skip to content

Commit 6bed5da

Browse files
committed
roachtest: adjust costfuzz / unoptimized-query-oracle for schema_locked
Previously, the multi-region variants of costfuzz and unoptimized-query-oracle, and sqlsmith would fail because they would attempt to alter locality on locked tables. This patch disables schema_locked before adjusting locality. Fixes: #149007 Fixes: #148976 Fixes: #148975 Fixes: #149002 Fixes: #148994 Fixes: #148995 Fixes: #149005 Fixes: #149000 Fixes: #148999 Release note: None
1 parent 00a0198 commit 6bed5da

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/cmd/roachtest/tests/sqlsmith.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,12 +420,15 @@ func setupMultiRegionDatabase(t test.Test, conn *gosql.DB, rnd *rand.Rand, logSt
420420
}
421421

422422
for _, table := range tables {
423+
// Locality changes can only be made if schema_locked is toggled.
424+
execStmt(fmt.Sprintf(`ALTER TABLE %s SET (schema_locked=false);`, table.String()))
423425
// Maybe change the locality of the table.
424426
if val := rnd.Intn(3); val == 0 {
425427
execStmt(fmt.Sprintf(`ALTER TABLE %s SET LOCALITY REGIONAL BY ROW;`, table.String()))
426428
} else if val == 1 {
427429
execStmt(fmt.Sprintf(`ALTER TABLE %s SET LOCALITY GLOBAL;`, table.String()))
428430
}
431+
execStmt(fmt.Sprintf(`ALTER TABLE %s SET (schema_locked=true);`, table.String()))
429432
// Else keep the locality as REGIONAL BY TABLE.
430433
}
431434
}

0 commit comments

Comments
 (0)