upgrade to 3.0.0 fix
This commit is contained in:
parent
309cde8fee
commit
a00b1503e3
|
|
@ -33,6 +33,12 @@
|
|||
<groupId>org.apache.dolphinscheduler</groupId>
|
||||
<artifactId>dolphinscheduler-dao</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ public class DolphinSchedulerManager {
|
|||
private DbType getCurrentDbType(DataSource dataSource) throws Exception {
|
||||
try (Connection conn = dataSource.getConnection()) {
|
||||
String name = conn.getMetaData().getDatabaseProductName().toUpperCase();
|
||||
logger.info("Current db type: {}", name);
|
||||
return DbType.valueOf(name);
|
||||
}
|
||||
}
|
||||
|
|
@ -101,6 +102,7 @@ public class DolphinSchedulerManager {
|
|||
// The target version of the upgrade
|
||||
String schemaVersion = "";
|
||||
String currentVersion = version;
|
||||
logger.info("Begin upgrading handle schemaList");
|
||||
for (String schemaDir : schemaList) {
|
||||
schemaVersion = schemaDir.split("_")[0];
|
||||
if (SchemaUtils.isAGreatVersion(schemaVersion, version)) {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ public class UpgradeDolphinScheduler {
|
|||
}
|
||||
|
||||
@Component
|
||||
@Profile("upgrade")
|
||||
static class UpgradeRunner implements CommandLineRunner {
|
||||
private static final Logger logger = LoggerFactory.getLogger(UpgradeRunner.class);
|
||||
|
||||
|
|
|
|||
|
|
@ -291,6 +291,10 @@ public abstract class UpgradeDao {
|
|||
String schemaVersion = schemaDir.split("_")[0];
|
||||
Resource sqlFilePath = new ClassPathResource(String.format("sql/upgrade/%s/%s/dolphinscheduler_dml.sql", schemaDir, getDbType().name().toLowerCase()));
|
||||
logger.info("sqlSQLFilePath: {}", sqlFilePath);
|
||||
if (!sqlFilePath.exists()) {
|
||||
logger.info("sqlSQLFilePath: {} not exist", sqlFilePath);
|
||||
return;
|
||||
}
|
||||
Connection conn = null;
|
||||
PreparedStatement pstmt = null;
|
||||
try {
|
||||
|
|
@ -353,6 +357,10 @@ public abstract class UpgradeDao {
|
|||
*/
|
||||
private void upgradeDolphinSchedulerDDL(String schemaDir, String scriptFile) {
|
||||
Resource sqlFilePath = new ClassPathResource(String.format("sql/upgrade/%s/%s/%s", schemaDir, getDbType().name().toLowerCase(), scriptFile));
|
||||
if (!sqlFilePath.exists()) {
|
||||
logger.info("sqlFilePath {} not exist", sqlFilePath);
|
||||
return;
|
||||
}
|
||||
Connection conn = null;
|
||||
PreparedStatement pstmt = null;
|
||||
try {
|
||||
|
|
@ -363,6 +371,7 @@ public abstract class UpgradeDao {
|
|||
// Execute the dolphinscheduler ddl.sql for the upgrade
|
||||
ScriptRunner scriptRunner = new ScriptRunner(conn, true, true);
|
||||
Reader sqlReader = new InputStreamReader(sqlFilePath.getInputStream());
|
||||
logger.info("Start ddl file: {}-{}", schemaDir, scriptFile);
|
||||
scriptRunner.runScript(sqlReader);
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@ spring:
|
|||
main:
|
||||
banner-mode: off
|
||||
datasource:
|
||||
driver-class-name: org.postgresql.Driver
|
||||
url: jdbc:postgresql://127.0.0.1:5432/dolphinscheduler
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://127.0.0.1:3306/whalescheduler?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&useSSL=false
|
||||
username: root
|
||||
password: root
|
||||
password: root@123
|
||||
hikari:
|
||||
connection-test-query: select 1
|
||||
minimum-idle: 5
|
||||
|
|
@ -33,22 +33,3 @@ spring:
|
|||
idle-timeout: 600000
|
||||
leak-detection-threshold: 0
|
||||
initialization-fail-timeout: 1
|
||||
|
||||
# Override by profile
|
||||
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: mysql
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://127.0.0.1:3306/dolphinscheduler?useUnicode=true&characterEncoding=UTF-8
|
||||
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: postgresql
|
||||
datasource:
|
||||
driver-class-name: org.postgresql.Driver
|
||||
|
|
|
|||
Loading…
Reference in New Issue