ouyangyewei edited a comment on pull request #8595:
URL: 
https://github.com/apache/dolphinscheduler/pull/8595#issuecomment-1068107190


   @caishunfeng Related. The problem occurs when deploying through kubernetes 
clustering. Recently tested, it happens when upgrading from 2.0.2 to 2.0.5
   
   After a simple analysis of the code, the tracking is as follows:
   
   ### Code Trace
   
   1. docker/build/Dockerfile
   
![image](https://user-images.githubusercontent.com/3365997/158407007-69412f95-d7e4-45fe-9ae9-bbb248312cfe.png)
   
   2. Assign args 'api-server' to container
   
![image](https://user-images.githubusercontent.com/3365997/158407560-e6c519c2-b9cc-4483-91ad-06b6aa92be29.png)
   
   3. docker/build/startup.sh
   
![image](https://user-images.githubusercontent.com/3365997/158407174-1279d875-4601-484e-9af5-e3747bfb7f37.png)
   
   4. Execute CreateDolphinScheduler.main() once
   
![image](https://user-images.githubusercontent.com/3365997/158407911-ffb3d6d8-529a-4935-9904-21dd16a729e5.png)
   
![image](https://user-images.githubusercontent.com/3365997/158409381-089712e8-bbb3-4091-8e02-e35f046c1f62.png)
   
![image](https://user-images.githubusercontent.com/3365997/158409515-9255c632-893f-41fd-9b8d-5dc058e0c44d.png)
   
   ### Log Trace
   ```
   init env variables
   generate dolphinscheduler config
   try to connect zookeeper ...
   zookeeper connection is ok
   try to connect mysql ...
   mysql connection is ok
   import sql data
   
     .   ____          _            __ _ _
    /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
   ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
    \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
     '  |____| .__|_| |_|_| |_\__, | / / / /
    =========|_|==============|___/=/_/_/_/
    :: Spring Boot ::                (v2.5.6)
   
   log4j:WARN No appenders could be found for logger (org.jboss.logging).
   log4j:WARN Please initialize the log4j system properly.
   log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for 
more info.
   2022-03-15 21:20:46.418  INFO 34 --- [           main] 
o.a.d.d.u.shell.CreateDolphinScheduler   : Starting CreateDolphinScheduler 
v2.0.5 using Java 1.8.0_322 on pre-workflow-api-56c459578b-4jm49 with PID 34 
(/opt/apache-dolphinscheduler-2.0.5-bin/lib/dolphinscheduler-dao-2.0.5.jar 
started by root in /opt/apache-dolphinscheduler-2.0.5-bin)
   2022-03-15 21:20:46.421  INFO 34 --- [           main] 
o.a.d.d.u.shell.CreateDolphinScheduler   : The following profiles are active: 
shell-create,shell-cli,default,mysql
   2022-03-15 21:20:47.801  INFO 34 --- [           main] 
ru.yandex.clickhouse.ClickHouseDriver    : Driver registered
   Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver 
class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via 
the SPI and manual loading of the driver class is generally unnecessary.
   2022-03-15 21:20:47.932  INFO 34 --- [           main] 
com.zaxxer.hikari.HikariDataSource       : DolphinScheduler - Starting...
   2022-03-15 21:20:47.937  WARN 34 --- [           main] 
com.zaxxer.hikari.util.DriverDataSource  : Registered driver with 
driverClassName=com.mysql.jdbc.Driver was not found, trying direct 
instantiation.
   2022-03-15 21:20:48.168  INFO 34 --- [           main] 
com.zaxxer.hikari.HikariDataSource       : DolphinScheduler - Start completed.
    _ _   |_  _ _|_. ___ _ |    _
   | | |\/|_)(_| | |_\  |_)||_|_\
        /               |
                           3.2.0
   2022-03-15 21:20:49.977  INFO 34 --- [           main] 
o.a.d.d.u.shell.CreateDolphinScheduler   : Started CreateDolphinScheduler in 
4.171 seconds (JVM running for 4.62)
   2022-03-15 21:20:50.005  INFO 34 --- [           main] 
o.a.d.d.upgrade.DolphinSchedulerManager  : The database has been initialized. 
Skip the initialization step
   2022-03-15 21:20:50.021  INFO 34 --- [           main] 
o.a.d.d.upgrade.DolphinSchedulerManager  : upgrade DolphinScheduler metadata 
version from 2.0.3 to 2.0.4
   2022-03-15 21:20:50.021  INFO 34 --- [           main] 
o.a.d.d.upgrade.DolphinSchedulerManager  : Begin upgrading DolphinScheduler's 
table structure
   2022-03-15 21:20:50.021  INFO 34 --- [           main] 
o.a.d.dao.upgrade.UpgradeDao             : pre_workflow
   2022-03-15 21:20:50.024  INFO 34 --- [           main] 
o.a.d.common.utils.ScriptRunner          : sql: /*  * Licensed to the Apache 
Software Foundation (ASF) under one or more  * contributor license agreements.  
See the NOTICE file distributed with  * this work for additional information 
regarding copyright ownership.  * The ASF licenses this file to You 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  *  *    http://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. */ ALTER 
TABLE `t_ds_task_instance` ADD INDEX `idx_code_version` (`task_code`, 
`task_definition
 _version`) USING BTREE
   2022-03-15 21:20:50.046 ERROR 34 --- [           main] 
o.a.d.common.utils.ScriptRunner          : SQLException
   
   java.sql.SQLSyntaxErrorException: Duplicate key name 'idx_code_version'
        at 
com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120) 
~[mysql-connector-java-8.0.16.jar:8.0.16]
        at 
com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) 
~[mysql-connector-java-8.0.16.jar:8.0.16]
        at 
com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
 ~[mysql-connector-java-8.0.16.jar:8.0.16]
        at 
com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:782) 
~[mysql-connector-java-8.0.16.jar:8.0.16]
        at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:666) 
~[mysql-connector-java-8.0.16.jar:8.0.16]
        at 
com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:94) 
~[HikariCP-4.0.3.jar:na]
        at 
com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java) 
~[HikariCP-4.0.3.jar:na]
        at 
org.apache.dolphinscheduler.common.utils.ScriptRunner.runScript(ScriptRunner.java:117)
 [dolphinscheduler-common-2.0.5.jar:2.0.5]
        at 
org.apache.dolphinscheduler.common.utils.ScriptRunner.runScript(ScriptRunner.java:72)
 [dolphinscheduler-common-2.0.5.jar:2.0.5]
        at 
org.apache.dolphinscheduler.dao.upgrade.UpgradeDao.upgradeDolphinSchedulerDDL(UpgradeDao.java:333)
 [dolphinscheduler-dao-2.0.5.jar:2.0.5]
        at 
org.apache.dolphinscheduler.dao.upgrade.UpgradeDao.upgradeDolphinScheduler(UpgradeDao.java:125)
 [dolphinscheduler-dao-2.0.5.jar:2.0.5]
        at 
org.apache.dolphinscheduler.dao.upgrade.DolphinSchedulerManager.upgradeDolphinScheduler(DolphinSchedulerManager.java:105)
 [dolphinscheduler-dao-2.0.5.jar:2.0.5]
        at 
org.apache.dolphinscheduler.dao.upgrade.shell.CreateDolphinScheduler$CreateRunner.run(CreateDolphinScheduler.java:57)
 [dolphinscheduler-dao-2.0.5.jar:2.0.5]
        at 
org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:791)
 [spring-boot-2.5.6.jar:2.5.6]
        at 
org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:775)
 [spring-boot-2.5.6.jar:2.5.6]
        at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:345) 
[spring-boot-2.5.6.jar:2.5.6]
        at 
org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:143)
 [spring-boot-2.5.6.jar:2.5.6]
        at 
org.apache.dolphinscheduler.dao.upgrade.shell.CreateDolphinScheduler.main(CreateDolphinScheduler.java:40)
 [dolphinscheduler-dao-2.0.5.jar:2.0.5]
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to