[Bug][sql-script] Error in database initialization script
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** Describe the bug A clear and concise description of what the bug is. 在安装完毕dolphinscheduler之后,创建完成租户,直接到资源管理中心下的文件管理里面创建一个文件夹出现错误。 After the DolphinScheduler is installed, the tenant is created and an error occurred when a folder is created in file management under the Resource Management Center. To Reproduce Steps to reproduce the behavior, for example:
- 登录web管理界面
- 创建租户完毕
- 资源管理中心
- 文件管理创建一个文件夹 这里开始报错
Expected behavior [INFO] 2021-01-20 22:38:35.183 org.apache.dolphinscheduler.common.utils.HadoopUtils:[144] - get property:fs.defaultFS -> hdfs://sv1:8020, from core-site.xml hdfs-site.xml [ERROR] 2021-01-20 22:38:36.064 org.apache.dolphinscheduler.api.service.ResourcesService:[146] - resource already exists, can't recreate org.springframework.jdbc.BadSqlGrammarException:
Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: column "is_directory" is of type integer but expression is of type boolean
Hint: You will need to rewrite or cast the expression. Position: 192
The error may exist in org/apache/dolphinscheduler/dao/mapper/ResourceMapper.java (best guess)
The error may involve org.apache.dolphinscheduler.dao.mapper.ResourceMapper.insert-Inline
The error occurred while setting parameters
SQL: INSERT INTO t_ds_resources ( file_name, size, create_time, description, full_name, alias, update_time, pid, type, user_id, is_directory ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
Cause: org.postgresql.util.PSQLException: ERROR: column "is_directory" is of type integer but expression is of type boolean
Hint: You will need to rewrite or cast the expression.
Position: 192
; bad SQL grammar []; nested exception is org.postgresql.util.PSQLException: ERROR: column "is_directory" is of type integer but expression is of type boolean
Hint: You will need to rewrite or cast the expression.
Position: 192
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:234)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:74)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:440)
at com.sun.proxy.$Proxy89.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:271)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:58)
at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:61)
at com.sun.proxy.$Proxy104.insert(Unknown Source)
at org.apache.dolphinscheduler.api.service.ResourcesService.createDirectory(ResourcesService.java:130)
at org.apache.dolphinscheduler.api.service.ResourcesService$$FastClassBySpringCGLIB$$cfb54838.invoke(
Screenshots If applicable, add screenshots to help explain your problem.
Which version of Dolphin Scheduler: -[1.3.3-preview]
根据错误日志分析得到,t_ds_resources表下的is_directory 字段类型存在问题,初始化postgres数据库之后这个字段是int(32) 根据报错信息把类型改为bool类型之后,解决掉了问题,可以正常创建文件夹。 According to the error log analysis, there is a problem with the type of is_directory field in the T_DS_RESOURCES table, which is int(32) after initializing the Postgres database. After changing the type to bool based on the error message, the problem is solved and the folder can be created normally.
修正t_ds_resources表的表结构初始化脚本
Fixed table structure initialization script for T DS RESOURCES table
Deeply thanks for your feedback, can you submit a PR for this?
which one??
sql/dolphinscheduler-postgre.sql sql/create/release-1.2.0_schema/postgresql/dolphinscheduler-ddl.sql
@CalvinKirs u can assign the issue to me
@CalvinKirs u can assign the issue to me
Looking forward to your PR submission, if you need help with any problems, you can contact me
@CalvinKirs Is this problem solved? If not, I can fix it.
Close by #4595 #4763 #4774