Skip to content

Commit

Permalink
SCDF should be able to migrate a schema from 2.10 to 3.0
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cppwfs committed Aug 23, 2024
1 parent 54fb006 commit c31a8d6
Show file tree
Hide file tree
Showing 39 changed files with 1,129 additions and 712 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright 2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.dataflow.server.db.migration;

import java.util.Arrays;
import java.util.List;

import org.springframework.cloud.dataflow.common.flyway.AbstractMigration;
import org.springframework.cloud.dataflow.common.flyway.SqlCommand;

/**
* Provide indexes to improve aggregate view performance
* @author Corneil du Plessis
*/
public abstract class AbstractCreateBatchIndexesMigration extends AbstractMigration {
protected static final String CREATE_BATCH_STEP_EXECUTION_JOB_EXECUTION_ID_INDEX =
"create index BATCH_STEP_EXECUTION_JOB_EXECUTION_ID_IX on BATCH_STEP_EXECUTION(JOB_EXECUTION_ID)";
protected static final String CREATE_BOOT3_BATCH_STEP_EXECUTION_JOB_EXECUTION_ID_INDEX =
"create index BOOT3_BATCH_STEP_EXECUTION_JOB_EXECUTION_ID_IX on BOOT3_BATCH_STEP_EXECUTION(JOB_EXECUTION_ID)";
protected static final String CREATE_BOOT3_TASK_TASK_BATCH_JOB_EXECUTION_ID_INDEX =
"create index BOOT3_TASK_TASK_BATCH_JOB_EXECUTION_ID_IX on BOOT3_TASK_TASK_BATCH(JOB_EXECUTION_ID)";
protected static final String CREATE_TASK_TASK_BATCH_JOB_EXECUTION_ID_INDEX =
"create index TASK_TASK_BATCH_JOB_EXECUTION_ID_IX on TASK_TASK_BATCH(JOB_EXECUTION_ID)";
protected static final String CREATE_BATCH_JOB_EXECUTION_START_TIME_INDEX =
"create index BATCH_JOB_EXECUTION_START_TIME_IX on BATCH_JOB_EXECUTION(START_TIME)";
protected static final String CREATE_BOOT3_BATCH_JOB_EXECUTION_START_TIME_INDEX =
"create index BOOT3_BATCH_JOB_EXECUTION_START_TIME_IX on BOOT3_BATCH_JOB_EXECUTION(START_TIME)";

public AbstractCreateBatchIndexesMigration() {
super(null);
}

@Override
public List<SqlCommand> getCommands() {
return Arrays.asList(SqlCommand.from(CREATE_BATCH_STEP_EXECUTION_JOB_EXECUTION_ID_INDEX),
SqlCommand.from(CREATE_BOOT3_BATCH_STEP_EXECUTION_JOB_EXECUTION_ID_INDEX),
SqlCommand.from(CREATE_BOOT3_TASK_TASK_BATCH_JOB_EXECUTION_ID_INDEX),
SqlCommand.from(CREATE_TASK_TASK_BATCH_JOB_EXECUTION_ID_INDEX),
SqlCommand.from(CREATE_BATCH_JOB_EXECUTION_START_TIME_INDEX),
SqlCommand.from(CREATE_BOOT3_BATCH_JOB_EXECUTION_START_TIME_INDEX));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright 2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.dataflow.server.db.migration;

import java.util.Arrays;
import java.util.List;

import org.springframework.cloud.dataflow.common.flyway.AbstractMigration;
import org.springframework.cloud.dataflow.common.flyway.SqlCommand;

/**
* Provide indexes to improve performance of finding child tasks.
* @author Corneil du Plessis
*/
public abstract class AbstractCreateTaskParentIndexMigration extends AbstractMigration {
protected static final String CREATE_TASK_PARENT_INDEX =
"create index TASK_EXECUTION_PARENT_IX on TASK_EXECUTION(PARENT_EXECUTION_ID)";
protected static final String CREATE_BOOT3_TASK_PARENT_INDEX =
"create index BOOT3_TASK_EXECUTION_PARENT_IX on BOOT3_TASK_EXECUTION(PARENT_EXECUTION_ID)";

public AbstractCreateTaskParentIndexMigration() {
super(null);
}

@Override
public List<SqlCommand> getCommands() {
return Arrays.asList(
SqlCommand.from(CREATE_TASK_PARENT_INDEX),
SqlCommand.from(CREATE_BOOT3_TASK_PARENT_INDEX)
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright 2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.dataflow.server.db.migration.db2;

import org.springframework.cloud.dataflow.server.db.migration.AbstractCreateBatchIndexesMigration;

public class V10__CreateBatchIndexes extends AbstractCreateBatchIndexesMigration {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.springframework.cloud.dataflow.server.db.migration.db2;

import org.springframework.cloud.dataflow.server.db.migration.AbstractCreateTaskParentIndexMigration;

public class V11__CreateTaskParentIndex extends AbstractCreateTaskParentIndexMigration {

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*
* @author Glenn Renfro
*/
public class V10__Remove_Task2_Batch4_Support extends AbstractRemoveBatch4Task2Tables {
public class V12__Remove_Task2_Batch4_Support extends AbstractRemoveBatch4Task2Tables {

/*
* Scripts to remove views used for Task V2/Batch V4 Task V3/Batch V5 queries.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.springframework.cloud.dataflow.server.db.migration.mariadb;

import org.springframework.cloud.dataflow.server.db.migration.AbstractCreateBatchIndexesMigration;

public class V11__CreateBatchIndexes extends AbstractCreateBatchIndexesMigration {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.springframework.cloud.dataflow.server.db.migration.mariadb;

import org.springframework.cloud.dataflow.server.db.migration.AbstractCreateTaskParentIndexMigration;

public class V12__CreateTaskParentIndex extends AbstractCreateTaskParentIndexMigration {

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*
* @author Glenn Renfro
*/
public class V11__Remove_Task2_Batch4_Support extends AbstractRemoveBatch4Task2Tables {
public class V13__Remove_Task2_Batch4_Support extends AbstractRemoveBatch4Task2Tables {

/*
* Scripts to remove views used for Task V2/Batch V4 Task V3/Batch V5 queries.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright 2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.dataflow.server.db.migration.mysql;

import org.springframework.cloud.dataflow.server.db.migration.AbstractCreateBatchIndexesMigration;

public class V11__CreateBatchIndexes extends AbstractCreateBatchIndexesMigration {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.springframework.cloud.dataflow.server.db.migration.mysql;

import org.springframework.cloud.dataflow.server.db.migration.AbstractCreateTaskParentIndexMigration;

public class V12__CreateTaskParentIndex extends AbstractCreateTaskParentIndexMigration {

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*
* @author Glenn Renfro
*/
public class V11__Remove_Task2_Batch4_Support extends AbstractRemoveBatch4Task2Tables {
public class V13__Remove_Task2_Batch4_Support extends AbstractRemoveBatch4Task2Tables {

/*
* Scripts to remove views used for Task V2/Batch V4 Task V3/Batch V5 queries.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright 2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.dataflow.server.db.migration.oracle;

import org.springframework.cloud.dataflow.server.db.migration.AbstractCreateBatchIndexesMigration;

public class V11__CreateBatchIndexes extends AbstractCreateBatchIndexesMigration {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.springframework.cloud.dataflow.server.db.migration.oracle;

import org.springframework.cloud.dataflow.server.db.migration.AbstractCreateTaskParentIndexMigration;

public class V12__CreateTaskParentIndex extends AbstractCreateTaskParentIndexMigration {

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*
* @author Glenn Renfro
*/
public class V11__Remove_Task2_Batch4_Support extends AbstractRemoveBatch4Task2Tables {
public class V13__Remove_Task2_Batch4_Support extends AbstractRemoveBatch4Task2Tables {

/*
* Scripts to remove views used for Task V2/Batch V4 Task V3/Batch V5 queries.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright 2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.dataflow.server.db.migration.postgresql;

import org.springframework.cloud.dataflow.server.db.migration.AbstractCreateBatchIndexesMigration;

public class V12__CreateBatchIndexes extends AbstractCreateBatchIndexesMigration {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.springframework.cloud.dataflow.server.db.migration.postgresql;

import org.springframework.cloud.dataflow.server.db.migration.AbstractCreateTaskParentIndexMigration;

public class V13__CreateTaskParentIndex extends AbstractCreateTaskParentIndexMigration {

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*
* @author Glenn Renfro
*/
public class V12__Remove_Task2_Batch4_Support extends AbstractRemoveBatch4Task2Tables {
public class V14__Remove_Task2_Batch4_Support extends AbstractRemoveBatch4Task2Tables {

/*
* Scripts to remove views used for Task V2/Batch V4 Task V3/Batch V5 queries.
Expand Down
Loading

0 comments on commit c31a8d6

Please sign in to comment.