Skip to content

Commit 4ce67ee

Browse files
authored
Merge branch 'dev' into Fix-17773
2 parents b662c2c + cea7c7e commit 4ce67ee

3 files changed

Lines changed: 54 additions & 33 deletions

File tree

docs/docs/en/architecture/configuration.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -332,19 +332,19 @@ This part describes quartz configs and configure them based on your practical si
332332

333333
The default configuration is as follows:
334334

335-
| Parameters | Default value |
336-
|-------------------------------------------------------------------------|-------------------------------------------------|
337-
| spring.quartz.properties.org.quartz.jobStore.isClustered | true |
338-
| spring.quartz.properties.org.quartz.jobStore.class | org.quartz.impl.jdbcjobstore.JobStoreTX |
339-
| spring.quartz.properties.org.quartz.scheduler.instanceId | AUTO |
340-
| spring.quartz.properties.org.quartz.jobStore.tablePrefix | QRTZ_ |
341-
| spring.quartz.properties.org.quartz.jobStore.acquireTriggersWithinLock | true |
342-
| spring.quartz.properties.org.quartz.scheduler.instanceName | DolphinScheduler |
343-
| spring.quartz.properties.org.quartz.jobStore.useProperties | false |
344-
| spring.quartz.properties.org.quartz.jobStore.misfireThreshold | 60000 |
345-
| spring.quartz.properties.org.quartz.scheduler.makeSchedulerThreadDaemon | true |
346-
| spring.quartz.properties.org.quartz.jobStore.driverDelegateClass | org.quartz.impl.jdbcjobstore.PostgreSQLDelegate |
347-
| spring.quartz.properties.org.quartz.jobStore.clusterCheckinInterval | 5000 |
335+
| Parameters | Default value |
336+
|-------------------------------------------------------------------------|---------------------------------------------------------------|
337+
| spring.quartz.properties.org.quartz.jobStore.isClustered | true |
338+
| spring.quartz.properties.org.quartz.jobStore.class | org.springframework.scheduling.quartz.LocalDataSourceJobStore |
339+
| spring.quartz.properties.org.quartz.scheduler.instanceId | AUTO |
340+
| spring.quartz.properties.org.quartz.jobStore.tablePrefix | QRTZ_ |
341+
| spring.quartz.properties.org.quartz.jobStore.acquireTriggersWithinLock | true |
342+
| spring.quartz.properties.org.quartz.scheduler.instanceName | DolphinScheduler |
343+
| spring.quartz.properties.org.quartz.jobStore.useProperties | false |
344+
| spring.quartz.properties.org.quartz.jobStore.misfireThreshold | 60000 |
345+
| spring.quartz.properties.org.quartz.scheduler.makeSchedulerThreadDaemon | true |
346+
| spring.quartz.properties.org.quartz.jobStore.driverDelegateClass | org.quartz.impl.jdbcjobstore.PostgreSQLDelegate |
347+
| spring.quartz.properties.org.quartz.jobStore.clusterCheckinInterval | 5000 |
348348

349349
The above configuration items is the same in *Master Server* and *Api Server*, but their *Quartz Scheduler* threadpool
350350
configuration is different.

docs/docs/zh/architecture/configuration.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -340,19 +340,19 @@ common.properties配置文件目前主要是配置hadoop/s3/yarn/applicationId
340340

341341
默认配置如下:
342342

343-
| 参数 | 默认值 |
344-
|-------------------------------------------------------------------------|-------------------------------------------------|
345-
| spring.quartz.properties.org.quartz.jobStore.isClustered | true |
346-
| spring.quartz.properties.org.quartz.jobStore.class | org.quartz.impl.jdbcjobstore.JobStoreTX |
347-
| spring.quartz.properties.org.quartz.scheduler.instanceId | AUTO |
348-
| spring.quartz.properties.org.quartz.jobStore.tablePrefix | QRTZ_ |
349-
| spring.quartz.properties.org.quartz.jobStore.acquireTriggersWithinLock | true |
350-
| spring.quartz.properties.org.quartz.scheduler.instanceName | DolphinScheduler |
351-
| spring.quartz.properties.org.quartz.jobStore.useProperties | false |
352-
| spring.quartz.properties.org.quartz.jobStore.misfireThreshold | 60000 |
353-
| spring.quartz.properties.org.quartz.scheduler.makeSchedulerThreadDaemon | true |
354-
| spring.quartz.properties.org.quartz.jobStore.driverDelegateClass | org.quartz.impl.jdbcjobstore.PostgreSQLDelegate |
355-
| spring.quartz.properties.org.quartz.jobStore.clusterCheckinInterval | 5000 |
343+
| 参数 | 默认值 |
344+
|-------------------------------------------------------------------------|---------------------------------------------------------------|
345+
| spring.quartz.properties.org.quartz.jobStore.isClustered | true |
346+
| spring.quartz.properties.org.quartz.jobStore.class | org.springframework.scheduling.quartz.LocalDataSourceJobStore |
347+
| spring.quartz.properties.org.quartz.scheduler.instanceId | AUTO |
348+
| spring.quartz.properties.org.quartz.jobStore.tablePrefix | QRTZ_ |
349+
| spring.quartz.properties.org.quartz.jobStore.acquireTriggersWithinLock | true |
350+
| spring.quartz.properties.org.quartz.scheduler.instanceName | DolphinScheduler |
351+
| spring.quartz.properties.org.quartz.jobStore.useProperties | false |
352+
| spring.quartz.properties.org.quartz.jobStore.misfireThreshold | 60000 |
353+
| spring.quartz.properties.org.quartz.scheduler.makeSchedulerThreadDaemon | true |
354+
| spring.quartz.properties.org.quartz.jobStore.driverDelegateClass | org.quartz.impl.jdbcjobstore.PostgreSQLDelegate |
355+
| spring.quartz.properties.org.quartz.jobStore.clusterCheckinInterval | 5000 |
356356

357357
上述配置项在*Master Server**Api Server*是相同的,但他们的Quartz线程池配置部分却是不一样的。
358358
*Master Server* 的Quartz线程池默认配置如下:

dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTask.java

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import java.sql.CallableStatement;
4444
import java.sql.Connection;
4545
import java.sql.SQLException;
46+
import java.sql.Statement;
4647
import java.sql.Types;
4748
import java.util.HashMap;
4849
import java.util.Map;
@@ -60,6 +61,8 @@ public class ProcedureTask extends AbstractTask {
6061

6162
private final ProcedureTaskExecutionContext procedureTaskExecutionContext;
6263

64+
private volatile Statement sessionStatement;
65+
6366
/**
6467
* constructor
6568
*
@@ -105,30 +108,48 @@ public void handle(TaskCallBack taskCallBack) throws TaskException {
105108
}
106109
String proceduerSql = formatSql(sqlParamsMap, paramsMap);
107110
// call method
108-
try (CallableStatement stmt = connection.prepareCall(proceduerSql)) {
111+
try (CallableStatement tmpStatement = connection.prepareCall(proceduerSql)) {
112+
sessionStatement = tmpStatement;
109113
// set timeout
110-
setTimeout(stmt);
114+
setTimeout(tmpStatement);
111115

112116
// outParameterMap
113-
Map<Integer, Property> outParameterMap = getOutParameterMap(stmt, sqlParamsMap, paramsMap);
117+
Map<Integer, Property> outParameterMap = getOutParameterMap(tmpStatement, sqlParamsMap, paramsMap);
114118

115-
stmt.executeUpdate();
119+
tmpStatement.executeUpdate();
116120

117121
// print the output parameters to the log
118-
printOutParameter(stmt, outParameterMap);
122+
printOutParameter(tmpStatement, outParameterMap);
119123

120124
setExitStatusCode(EXIT_CODE_SUCCESS);
121125
}
122126
} catch (Exception e) {
127+
if (exitStatusCode == TaskConstants.EXIT_CODE_KILL) {
128+
log.info("This procedure task has been killed");
129+
return;
130+
}
123131
setExitStatusCode(EXIT_CODE_FAILURE);
124-
log.error("procedure task error", e);
132+
log.error("Failed to execute this procedure task", e);
125133
throw new TaskException("Execute procedure task failed", e);
126134
}
127135
}
128136

129137
@Override
130138
public void cancel() throws TaskException {
131-
139+
if (sessionStatement != null) {
140+
try {
141+
log.info("Try to cancel this procedure task");
142+
sessionStatement.cancel();
143+
setExitStatusCode(TaskConstants.EXIT_CODE_KILL);
144+
log.info("This procedure task was canceled");
145+
} catch (Exception ex) {
146+
log.warn("Failed to cancel this procedure task", ex);
147+
throw new TaskException("Cancel this procedure task failed", ex);
148+
}
149+
} else {
150+
log.info(
151+
"Attempted to cancel this procedure task, but no active statement exists. Possible reasons: task not started, already completed, or canceled.");
152+
}
132153
}
133154

134155
private String formatSql(Map<Integer, Property> sqlParamsMap, Map<String, Property> paramsMap) {

0 commit comments

Comments
 (0)