Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
DolphinScheduler
提交
0f3eed9d
DolphinScheduler
项目概览
apache
/
DolphinScheduler
上一次同步 1 年多
通知
704
Star
9572
Fork
3514
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
DolphinScheduler
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
0f3eed9d
编写于
4月 29, 2021
作者:
S
Shiwen Cheng
提交者:
GitHub
4月 29, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Fix-5386][Alert] Fix ERROR: relation t_ds_plugin_define does not exist (#5387)
上级
d45b27ce
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
40 addition
and
10 deletion
+40
-10
dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/AlertServer.java
...n/java/org/apache/dolphinscheduler/alert/AlertServer.java
+18
-5
dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/AlertServerTest.java
...va/org/apache/dolphinscheduler/alert/AlertServerTest.java
+2
-5
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/PluginDao.java
.../main/java/org/apache/dolphinscheduler/dao/PluginDao.java
+9
-0
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/PluginDefineMapper.java
...pache/dolphinscheduler/dao/mapper/PluginDefineMapper.java
+7
-0
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/PluginDefineMapper.xml
...apache/dolphinscheduler/dao/mapper/PluginDefineMapper.xml
+4
-0
未找到文件。
dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/AlertServer.java
浏览文件 @
0f3eed9d
...
...
@@ -30,6 +30,7 @@ import org.apache.dolphinscheduler.common.thread.Stopper;
import
org.apache.dolphinscheduler.common.utils.PropertyUtils
;
import
org.apache.dolphinscheduler.dao.AlertDao
;
import
org.apache.dolphinscheduler.dao.DaoFactory
;
import
org.apache.dolphinscheduler.dao.PluginDao
;
import
org.apache.dolphinscheduler.dao.entity.Alert
;
import
org.apache.dolphinscheduler.remote.NettyRemotingServer
;
import
org.apache.dolphinscheduler.remote.command.CommandType
;
...
...
@@ -47,7 +48,14 @@ import com.google.common.collect.ImmutableList;
* alert of start
*/
public
class
AlertServer
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
AlertServer
.
class
);
/**
* Plugin Dao
*/
private
PluginDao
pluginDao
=
DaoFactory
.
getDaoInstance
(
PluginDao
.
class
);
/**
* Alert Dao
*/
...
...
@@ -55,8 +63,6 @@ public class AlertServer {
private
AlertSender
alertSender
;
private
static
AlertServer
instance
;
private
AlertPluginManager
alertPluginManager
;
private
DolphinPluginManagerConfig
alertPluginManagerConfig
;
...
...
@@ -78,13 +84,19 @@ public class AlertServer {
public
static
final
AlertServer
getInstance
()
{
return
AlertServerHolder
.
INSTANCE
;
}
private
AlertServer
()
{
}
private
void
checkTable
()
{
if
(!
pluginDao
.
checkPluginDefineTableExist
())
{
logger
.
error
(
"Plugin Define Table t_ds_plugin_define Not Exist . Please Create it First !"
);
System
.
exit
(
1
);
}
}
private
void
initPlugin
()
{
alertPluginManager
=
new
AlertPluginManager
();
alertPluginManagerConfig
=
new
DolphinPluginManagerConfig
();
...
...
@@ -101,7 +113,7 @@ public class AlertServer {
try
{
alertPluginLoader
.
loadPlugins
();
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"
l
oad Alert Plugin Failed !"
,
e
);
throw
new
RuntimeException
(
"
L
oad Alert Plugin Failed !"
,
e
);
}
}
...
...
@@ -128,7 +140,7 @@ public class AlertServer {
Thread
.
currentThread
().
interrupt
();
}
if
(
alertPluginManager
==
null
||
alertPluginManager
.
getAlertChannelMap
().
size
()
==
0
)
{
logger
.
warn
(
"No Alert Plugin . Can
not send alert info. "
);
logger
.
warn
(
"No Alert Plugin . Cannot send alert info. "
);
}
else
{
List
<
Alert
>
alerts
=
alertDao
.
listWaitExecutionAlert
();
alertSender
=
new
AlertSender
(
alerts
,
alertDao
,
alertPluginManager
);
...
...
@@ -142,6 +154,7 @@ public class AlertServer {
*/
public
void
start
()
{
PropertyUtils
.
loadPropertyFile
(
ALERT_PROPERTIES_PATH
);
checkTable
();
initPlugin
();
initRemoteServer
();
logger
.
info
(
"alert server ready start "
);
...
...
dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/AlertServerTest.java
浏览文件 @
0f3eed9d
...
...
@@ -56,6 +56,7 @@ public class AlertServerTest {
PluginDao
pluginDao
=
PowerMockito
.
mock
(
PluginDao
.
class
);
PowerMockito
.
when
(
DaoFactory
.
getDaoInstance
(
PluginDao
.
class
)).
thenReturn
(
pluginDao
);
PowerMockito
.
when
(
pluginDao
.
checkPluginDefineTableExist
()).
thenReturn
(
true
);
AlertChannel
alertChannelMock
=
PowerMockito
.
mock
(
AlertChannel
.
class
);
...
...
@@ -80,15 +81,11 @@ public class AlertServerTest {
AlertServer
alertServer
=
AlertServer
.
getInstance
();
Assert
.
assertNotNull
(
alertServer
);
new
Thread
(()
->
{
alertServer
.
start
();
})
.
start
();
new
Thread
(()
->
alertServer
.
start
()).
start
();
Thread
.
sleep
(
5
*
Constants
.
ALERT_SCAN_INTERVAL
);
alertServer
.
stop
();
}
}
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/PluginDao.java
浏览文件 @
0f3eed9d
...
...
@@ -44,6 +44,15 @@ public class PluginDao extends AbstractBaseDao {
pluginDefineMapper
=
ConnectionFactory
.
getInstance
().
getMapper
(
PluginDefineMapper
.
class
);
}
/**
* check plugin define table exist
*
* @return boolean
*/
public
boolean
checkPluginDefineTableExist
()
{
return
pluginDefineMapper
.
checkTableExist
()
>
0
;
}
/**
* add pluginDefine
*
...
...
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/PluginDefineMapper.java
浏览文件 @
0f3eed9d
...
...
@@ -27,6 +27,13 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public
interface
PluginDefineMapper
extends
BaseMapper
<
PluginDefine
>
{
/**
* check table exist
*
* @return boolean
*/
int
checkTableExist
();
/**
* query all plugin define
*
...
...
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/PluginDefineMapper.xml
浏览文件 @
0f3eed9d
...
...
@@ -18,6 +18,10 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"org.apache.dolphinscheduler.dao.mapper.PluginDefineMapper"
>
<select
id=
"checkTableExist"
resultType=
"int"
>
select count(*) from information_schema.TABLES where table_name = 't_ds_plugin_define'
</select>
<select
id=
"queryAllPluginDefineList"
resultType=
"org.apache.dolphinscheduler.dao.entity.PluginDefine"
>
select *
from t_ds_plugin_define
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录