@@ -10,6 +10,7 @@ import (
10
10
gosql "database/sql"
11
11
"math/rand"
12
12
13
+ "github.com/cockroachdb/cockroach/pkg/clusterversion"
13
14
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/cluster"
14
15
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/option"
15
16
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/registry"
@@ -27,7 +28,7 @@ func registerDeclarativeSchemaChangerJobCompatibilityInMixedVersion(r registry.R
27
28
// This test requires us to come back and change the stmts in executeSupportedDDLs to be those
28
29
// supported in the "previous" major release.
29
30
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 " ,
31
32
Owner : registry .OwnerSQLFoundations ,
32
33
Cluster : r .MakeClusterSpec (4 ),
33
34
// Disabled on IBM because s390x is only built on master and mixed-version
@@ -107,13 +108,19 @@ func executeSupportedDDLs(
107
108
return err
108
109
}
109
110
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` ,
117
124
}
118
125
119
126
// Used to clean up our CREATE-d elements after we are done with them.
@@ -130,9 +137,26 @@ func executeSupportedDDLs(
130
137
`DROP OWNED BY foo` ,
131
138
}
132
139
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
+ }
134
158
135
- for _ , ddl := range ddls {
159
+ for _ , ddl := range cleanup {
136
160
if err := helper .ExecWithGateway (r , nodes , ddl ); err != nil {
137
161
return err
138
162
}
0 commit comments