Skip to content

Commit c31a8d6

Browse files
committed
SCDF should be able to migrate a schema from 2.10 to 3.0
Currently the migration fails with a validation error. The cause of the validation error was that some commits from 2.11.x that contained flyway migration scripts were not ported to the main-3 branch. The following commits that contained flyway migrations were migrated to main-3 from the main branch. * 62ea6c5 * 6f97589 The goal of this PR is to resolve the validation error so DB migrations will work properly. A subsequent PR will be submitted will add the feature code for commit 6f97589.
1 parent 54fb006 commit c31a8d6

39 files changed

+1129
-712
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Copyright 2024 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.cloud.dataflow.server.db.migration;
17+
18+
import java.util.Arrays;
19+
import java.util.List;
20+
21+
import org.springframework.cloud.dataflow.common.flyway.AbstractMigration;
22+
import org.springframework.cloud.dataflow.common.flyway.SqlCommand;
23+
24+
/**
25+
* Provide indexes to improve aggregate view performance
26+
* @author Corneil du Plessis
27+
*/
28+
public abstract class AbstractCreateBatchIndexesMigration extends AbstractMigration {
29+
protected static final String CREATE_BATCH_STEP_EXECUTION_JOB_EXECUTION_ID_INDEX =
30+
"create index BATCH_STEP_EXECUTION_JOB_EXECUTION_ID_IX on BATCH_STEP_EXECUTION(JOB_EXECUTION_ID)";
31+
protected static final String CREATE_BOOT3_BATCH_STEP_EXECUTION_JOB_EXECUTION_ID_INDEX =
32+
"create index BOOT3_BATCH_STEP_EXECUTION_JOB_EXECUTION_ID_IX on BOOT3_BATCH_STEP_EXECUTION(JOB_EXECUTION_ID)";
33+
protected static final String CREATE_BOOT3_TASK_TASK_BATCH_JOB_EXECUTION_ID_INDEX =
34+
"create index BOOT3_TASK_TASK_BATCH_JOB_EXECUTION_ID_IX on BOOT3_TASK_TASK_BATCH(JOB_EXECUTION_ID)";
35+
protected static final String CREATE_TASK_TASK_BATCH_JOB_EXECUTION_ID_INDEX =
36+
"create index TASK_TASK_BATCH_JOB_EXECUTION_ID_IX on TASK_TASK_BATCH(JOB_EXECUTION_ID)";
37+
protected static final String CREATE_BATCH_JOB_EXECUTION_START_TIME_INDEX =
38+
"create index BATCH_JOB_EXECUTION_START_TIME_IX on BATCH_JOB_EXECUTION(START_TIME)";
39+
protected static final String CREATE_BOOT3_BATCH_JOB_EXECUTION_START_TIME_INDEX =
40+
"create index BOOT3_BATCH_JOB_EXECUTION_START_TIME_IX on BOOT3_BATCH_JOB_EXECUTION(START_TIME)";
41+
42+
public AbstractCreateBatchIndexesMigration() {
43+
super(null);
44+
}
45+
46+
@Override
47+
public List<SqlCommand> getCommands() {
48+
return Arrays.asList(SqlCommand.from(CREATE_BATCH_STEP_EXECUTION_JOB_EXECUTION_ID_INDEX),
49+
SqlCommand.from(CREATE_BOOT3_BATCH_STEP_EXECUTION_JOB_EXECUTION_ID_INDEX),
50+
SqlCommand.from(CREATE_BOOT3_TASK_TASK_BATCH_JOB_EXECUTION_ID_INDEX),
51+
SqlCommand.from(CREATE_TASK_TASK_BATCH_JOB_EXECUTION_ID_INDEX),
52+
SqlCommand.from(CREATE_BATCH_JOB_EXECUTION_START_TIME_INDEX),
53+
SqlCommand.from(CREATE_BOOT3_BATCH_JOB_EXECUTION_START_TIME_INDEX));
54+
}
55+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright 2024 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.cloud.dataflow.server.db.migration;
17+
18+
import java.util.Arrays;
19+
import java.util.List;
20+
21+
import org.springframework.cloud.dataflow.common.flyway.AbstractMigration;
22+
import org.springframework.cloud.dataflow.common.flyway.SqlCommand;
23+
24+
/**
25+
* Provide indexes to improve performance of finding child tasks.
26+
* @author Corneil du Plessis
27+
*/
28+
public abstract class AbstractCreateTaskParentIndexMigration extends AbstractMigration {
29+
protected static final String CREATE_TASK_PARENT_INDEX =
30+
"create index TASK_EXECUTION_PARENT_IX on TASK_EXECUTION(PARENT_EXECUTION_ID)";
31+
protected static final String CREATE_BOOT3_TASK_PARENT_INDEX =
32+
"create index BOOT3_TASK_EXECUTION_PARENT_IX on BOOT3_TASK_EXECUTION(PARENT_EXECUTION_ID)";
33+
34+
public AbstractCreateTaskParentIndexMigration() {
35+
super(null);
36+
}
37+
38+
@Override
39+
public List<SqlCommand> getCommands() {
40+
return Arrays.asList(
41+
SqlCommand.from(CREATE_TASK_PARENT_INDEX),
42+
SqlCommand.from(CREATE_BOOT3_TASK_PARENT_INDEX)
43+
);
44+
}
45+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright 2024 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.cloud.dataflow.server.db.migration.db2;
17+
18+
import org.springframework.cloud.dataflow.server.db.migration.AbstractCreateBatchIndexesMigration;
19+
20+
public class V10__CreateBatchIndexes extends AbstractCreateBatchIndexesMigration {
21+
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright 2024 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.cloud.dataflow.server.db.migration.db2;
18+
19+
import org.springframework.cloud.dataflow.server.db.migration.AbstractCreateTaskParentIndexMigration;
20+
21+
public class V11__CreateTaskParentIndex extends AbstractCreateTaskParentIndexMigration {
22+
23+
}
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*
2727
* @author Glenn Renfro
2828
*/
29-
public class V10__Remove_Task2_Batch4_Support extends AbstractRemoveBatch4Task2Tables {
29+
public class V12__Remove_Task2_Batch4_Support extends AbstractRemoveBatch4Task2Tables {
3030

3131
/*
3232
* Scripts to remove views used for Task V2/Batch V4 Task V3/Batch V5 queries.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright 2024 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.cloud.dataflow.server.db.migration.mariadb;
18+
19+
import org.springframework.cloud.dataflow.server.db.migration.AbstractCreateBatchIndexesMigration;
20+
21+
public class V11__CreateBatchIndexes extends AbstractCreateBatchIndexesMigration {
22+
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright 2024 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.cloud.dataflow.server.db.migration.mariadb;
18+
19+
import org.springframework.cloud.dataflow.server.db.migration.AbstractCreateTaskParentIndexMigration;
20+
21+
public class V12__CreateTaskParentIndex extends AbstractCreateTaskParentIndexMigration {
22+
23+
}
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*
2727
* @author Glenn Renfro
2828
*/
29-
public class V11__Remove_Task2_Batch4_Support extends AbstractRemoveBatch4Task2Tables {
29+
public class V13__Remove_Task2_Batch4_Support extends AbstractRemoveBatch4Task2Tables {
3030

3131
/*
3232
* Scripts to remove views used for Task V2/Batch V4 Task V3/Batch V5 queries.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright 2024 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.cloud.dataflow.server.db.migration.mysql;
17+
18+
import org.springframework.cloud.dataflow.server.db.migration.AbstractCreateBatchIndexesMigration;
19+
20+
public class V11__CreateBatchIndexes extends AbstractCreateBatchIndexesMigration {
21+
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright 2024 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.cloud.dataflow.server.db.migration.mysql;
18+
19+
import org.springframework.cloud.dataflow.server.db.migration.AbstractCreateTaskParentIndexMigration;
20+
21+
public class V12__CreateTaskParentIndex extends AbstractCreateTaskParentIndexMigration {
22+
23+
}
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*
2727
* @author Glenn Renfro
2828
*/
29-
public class V11__Remove_Task2_Batch4_Support extends AbstractRemoveBatch4Task2Tables {
29+
public class V13__Remove_Task2_Batch4_Support extends AbstractRemoveBatch4Task2Tables {
3030

3131
/*
3232
* Scripts to remove views used for Task V2/Batch V4 Task V3/Batch V5 queries.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright 2024 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.cloud.dataflow.server.db.migration.oracle;
17+
18+
import org.springframework.cloud.dataflow.server.db.migration.AbstractCreateBatchIndexesMigration;
19+
20+
public class V11__CreateBatchIndexes extends AbstractCreateBatchIndexesMigration {
21+
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright 2024 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.cloud.dataflow.server.db.migration.oracle;
18+
19+
import org.springframework.cloud.dataflow.server.db.migration.AbstractCreateTaskParentIndexMigration;
20+
21+
public class V12__CreateTaskParentIndex extends AbstractCreateTaskParentIndexMigration {
22+
23+
}
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*
2727
* @author Glenn Renfro
2828
*/
29-
public class V11__Remove_Task2_Batch4_Support extends AbstractRemoveBatch4Task2Tables {
29+
public class V13__Remove_Task2_Batch4_Support extends AbstractRemoveBatch4Task2Tables {
3030

3131
/*
3232
* Scripts to remove views used for Task V2/Batch V4 Task V3/Batch V5 queries.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright 2024 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.cloud.dataflow.server.db.migration.postgresql;
17+
18+
import org.springframework.cloud.dataflow.server.db.migration.AbstractCreateBatchIndexesMigration;
19+
20+
public class V12__CreateBatchIndexes extends AbstractCreateBatchIndexesMigration {
21+
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright 2024 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.cloud.dataflow.server.db.migration.postgresql;
18+
19+
import org.springframework.cloud.dataflow.server.db.migration.AbstractCreateTaskParentIndexMigration;
20+
21+
public class V13__CreateTaskParentIndex extends AbstractCreateTaskParentIndexMigration {
22+
23+
}
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*
2727
* @author Glenn Renfro
2828
*/
29-
public class V12__Remove_Task2_Batch4_Support extends AbstractRemoveBatch4Task2Tables {
29+
public class V14__Remove_Task2_Batch4_Support extends AbstractRemoveBatch4Task2Tables {
3030

3131
/*
3232
* Scripts to remove views used for Task V2/Batch V4 Task V3/Batch V5 queries.

0 commit comments

Comments
 (0)