Skip to content

Commit 0b19670

Browse files
authored
Merge pull request #154707 from rafiss/blathers/backport-release-25.4-154544
release-25.4: roachtest: update DSC mixed-version test for v25.3-v25.4
2 parents 87018f9 + 94d1fb5 commit 0b19670

File tree

1 file changed

+34
-10
lines changed

1 file changed

+34
-10
lines changed

pkg/cmd/roachtest/tests/mixed_version_job_compatibility_in_declarative_schema_changer.go

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
gosql "database/sql"
1111
"math/rand"
1212

13+
"github.com/cockroachdb/cockroach/pkg/clusterversion"
1314
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/cluster"
1415
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/option"
1516
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/registry"
@@ -27,7 +28,7 @@ func registerDeclarativeSchemaChangerJobCompatibilityInMixedVersion(r registry.R
2728
// This test requires us to come back and change the stmts in executeSupportedDDLs to be those
2829
// supported in the "previous" major release.
2930
r.Add(registry.TestSpec{
30-
Name: "declarative_schema_changer/job-compatibility-mixed-version-V242-V243",
31+
Name: "declarative_schema_changer/job-compatibility-mixed-version-V253-V254",
3132
Owner: registry.OwnerSQLFoundations,
3233
Cluster: r.MakeClusterSpec(4),
3334
// Disabled on IBM because s390x is only built on master and mixed-version
@@ -107,13 +108,19 @@ func executeSupportedDDLs(
107108
return err
108109
}
109110

110-
// DDLs supported in V24_2.
111-
// TODO(sql-foundations): uncomment these when the final 24.2 cluster version
112-
// is created.
113-
v242DDLs := []string{
114-
// `ALTER DATABASE testdb CONFIGURE ZONE USING gc.ttlseconds=1000`,
115-
// `ALTER TABLE testdb.testsc.t CONFIGURE ZONE USING gc.ttlseconds=2000`,
116-
// `COMMENT ON TYPE testdb.testsc.typ IS 'comment'`,
111+
// DDLs supported in V25_3.
112+
v253DDLs := []string{
113+
`ALTER TABLE testdb.testsc.t2 ALTER COLUMN i DROP NOT NULL`,
114+
}
115+
116+
// DDLs supported in V25_4.
117+
v254DDLs := []string{
118+
`TRUNCATE testdb.testsc.t3`,
119+
`ALTER TABLE testdb.testsc.t RENAME TO t_renamed`,
120+
`ALTER TABLE testdb.testsc.t_renamed RENAME TO t`,
121+
`ALTER TABLE testdb.testsc.t2 ALTER COLUMN j SET ON UPDATE j + 1`,
122+
`ALTER TABLE testdb.testsc.t2 RENAME COLUMN k TO k_renamed`,
123+
`ALTER TABLE testdb.testsc.t2 RENAME COLUMN k_renamed TO k`,
117124
}
118125

119126
// Used to clean up our CREATE-d elements after we are done with them.
@@ -130,9 +137,26 @@ func executeSupportedDDLs(
130137
`DROP OWNED BY foo`,
131138
}
132139

133-
ddls := append(v242DDLs, cleanup...)
140+
clusterVersion, err := helper.ClusterVersion(r)
141+
if err != nil {
142+
return err
143+
}
144+
if clusterVersion.AtLeast(clusterversion.V25_3.Version()) {
145+
for _, ddl := range v253DDLs {
146+
if err := helper.ExecWithGateway(r, nodes, ddl); err != nil {
147+
return err
148+
}
149+
}
150+
}
151+
if clusterVersion.AtLeast(clusterversion.V25_4.Version()) {
152+
for _, ddl := range v254DDLs {
153+
if err := helper.ExecWithGateway(r, nodes, ddl); err != nil {
154+
return err
155+
}
156+
}
157+
}
134158

135-
for _, ddl := range ddls {
159+
for _, ddl := range cleanup {
136160
if err := helper.ExecWithGateway(r, nodes, ddl); err != nil {
137161
return err
138162
}

0 commit comments

Comments
 (0)