Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
DolphinScheduler
提交
9b698df7
DolphinScheduler
项目概览
apache
/
DolphinScheduler
上一次同步 1 年多
通知
707
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,发现更多精彩内容 >>
提交
9b698df7
编写于
8月 14, 2022
作者:
W
WangJPLeo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cp [Fix-11465] RPC requests are placed after transaction commit
上级
553f781f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
33 addition
and
13 deletion
+33
-13
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerBootstrap.java
...eduler/server/master/runner/MasterSchedulerBootstrap.java
+31
-0
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
.../dolphinscheduler/service/process/ProcessServiceImpl.java
+2
-13
未找到文件。
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerBootstrap.java
浏览文件 @
9b698df7
...
...
@@ -26,7 +26,13 @@ import org.apache.dolphinscheduler.common.utils.LoggerUtils;
import
org.apache.dolphinscheduler.common.utils.NetUtils
;
import
org.apache.dolphinscheduler.common.utils.OSUtils
;
import
org.apache.dolphinscheduler.dao.entity.Command
;
import
org.apache.dolphinscheduler.dao.entity.ProcessDefinition
;
import
org.apache.dolphinscheduler.dao.entity.ProcessInstance
;
import
org.apache.dolphinscheduler.dao.mapper.ProcessInstanceMapper
;
import
org.apache.dolphinscheduler.plugin.task.api.enums.ExecutionStatus
;
import
org.apache.dolphinscheduler.remote.command.StateEventChangeCommand
;
import
org.apache.dolphinscheduler.remote.processor.StateEventCallbackService
;
import
org.apache.dolphinscheduler.remote.utils.Host
;
import
org.apache.dolphinscheduler.server.master.cache.ProcessInstanceExecCacheManager
;
import
org.apache.dolphinscheduler.server.master.config.MasterConfig
;
import
org.apache.dolphinscheduler.server.master.dispatch.executor.NettyExecutorManager
;
...
...
@@ -94,6 +100,12 @@ public class MasterSchedulerBootstrap extends BaseDaemonThread {
@Autowired
private
WorkflowEventLooper
workflowEventLooper
;
@Autowired
private
ProcessInstanceMapper
processInstanceMapper
;
@Autowired
private
StateEventCallbackService
stateEventCallbackService
;
private
String
masterAddress
;
protected
MasterSchedulerBootstrap
()
{
...
...
@@ -202,6 +214,7 @@ public class MasterSchedulerBootstrap extends BaseDaemonThread {
if
(
processInstance
!=
null
)
{
processInstances
.
add
(
processInstance
);
logger
.
info
(
"Master handle command {} end, create process instance {}"
,
command
.
getId
(),
processInstance
.
getId
());
sendRpcCommand
(
processInstance
);
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"Master handle command {} error "
,
command
.
getId
(),
e
);
...
...
@@ -220,6 +233,24 @@ public class MasterSchedulerBootstrap extends BaseDaemonThread {
return
processInstances
;
}
private
void
sendRpcCommand
(
ProcessInstance
processInstance
)
{
ProcessDefinition
processDefinition
=
processInstance
.
getProcessDefinition
();
if
(
processDefinition
.
getExecutionType
().
typeIsSerialPriority
()){
List
<
ProcessInstance
>
runningProcessInstances
=
processInstanceMapper
.
queryByProcessDefineCodeAndProcessDefinitionVersionAndStatusAndNextId
(
processInstance
.
getProcessDefinitionCode
(),
processInstance
.
getProcessDefinitionVersion
(),
new
int
[]{
ExecutionStatus
.
READY_STOP
.
getCode
()},
processInstance
.
getId
());
for
(
ProcessInstance
runningProcessInstance
:
runningProcessInstances
)
{
StateEventChangeCommand
workflowStateEventChangeCommand
=
new
StateEventChangeCommand
(
runningProcessInstance
.
getId
(),
0
,
runningProcessInstance
.
getState
(),
runningProcessInstance
.
getId
(),
0
);
Host
host
=
new
Host
(
runningProcessInstance
.
getHost
());
stateEventCallbackService
.
sendResult
(
host
,
workflowStateEventChangeCommand
.
convert2Command
());
}
}
}
private
List
<
Command
>
findCommands
()
throws
MasterException
{
try
{
long
scheduleStartTime
=
System
.
currentTimeMillis
();
...
...
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
浏览文件 @
9b698df7
...
...
@@ -340,19 +340,8 @@ public class ProcessServiceImpl implements ProcessService {
info
.
setCommandType
(
CommandType
.
STOP
);
info
.
addHistoryCmd
(
CommandType
.
STOP
);
info
.
setState
(
ExecutionStatus
.
READY_STOP
);
int
update
=
updateProcessInstance
(
info
);
// determine whether the process is normal
if
(
update
>
0
)
{
StateEventChangeCommand
stateEventChangeCommand
=
new
StateEventChangeCommand
(
info
.
getId
(),
0
,
info
.
getState
(),
info
.
getId
(),
0
);
try
{
Host
host
=
new
Host
(
info
.
getHost
());
stateEventCallbackService
.
sendResult
(
host
,
stateEventChangeCommand
.
convert2Command
());
}
catch
(
Exception
e
)
{
logger
.
error
(
"sendResultError"
,
e
);
}
}
processService
.
updateProcessInstance
(
info
);
// TODO rpc after command handle complete, but this is not better
}
processInstance
.
setState
(
ExecutionStatus
.
SUBMITTED_SUCCESS
);
saveProcessInstance
(
processInstance
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录