Rubik-W commented on a change in pull request #2730:
URL:
https://github.com/apache/incubator-dolphinscheduler/pull/2730#discussion_r429146105
##########
File path:
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterBaseTaskExecThread.java
##########
@@ -97,82 +100,85 @@ public MasterBaseTaskExecThread(TaskInstance taskInstance){
/**
* get task instance
+ *
* @return TaskInstance
*/
- public TaskInstance getTaskInstance(){
+ public TaskInstance getTaskInstance() {
return this.taskInstance;
}
/**
* kill master base task exec thread
*/
- public void kill(){
+ public void kill() {
this.cancel = true;
}
/**
* submit master base task exec thread
+ *
* @return TaskInstance
*/
- protected TaskInstance submit(){
- Integer commitRetryTimes =
masterConfig.getMasterTaskCommitRetryTimes();
- Integer commitRetryInterval =
masterConfig.getMasterTaskCommitInterval();
+ protected TaskInstance submit() {
+ int commitRetryTimes = masterConfig.getMasterTaskCommitRetryTimes();
+ int commitRetryInterval = masterConfig.getMasterTaskCommitInterval();
- int retryTimes = 1;
boolean submitDB = false;
- boolean submitTask = false;
TaskInstance task = null;
- while (retryTimes <= commitRetryTimes){
+ for (int retryTimes = 1; retryTimes <= commitRetryTimes && !submitDB;
retryTimes++) {
try {
- if(!submitDB){
- // submit task to db
- task = processService.submitTask(taskInstance);
- if(task != null && task.getId() != 0){
- submitDB = true;
- }
+ // submit task to db
+ task = processService.submitTask(taskInstance);
+ if (task != null && task.getId() != 0) {
+ submitDB = true;
+ } else {
+ logger.error("task commit to db failed , taskId {} has
already retry {} times, please check the database",
+ taskInstance.getId(), retryTimes);
+ Thread.sleep(commitRetryInterval);
}
- if(submitDB && !submitTask){
+ } catch (Exception e) {
+ logger.error("task commit to mysql and dispatcht task failed",
e);
Review comment:
It is recommended to optimize the log content, add task information.
##########
File path:
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterBaseTaskExecThread.java
##########
@@ -97,82 +100,85 @@ public MasterBaseTaskExecThread(TaskInstance taskInstance){
/**
* get task instance
+ *
* @return TaskInstance
*/
- public TaskInstance getTaskInstance(){
+ public TaskInstance getTaskInstance() {
return this.taskInstance;
}
/**
* kill master base task exec thread
*/
- public void kill(){
+ public void kill() {
this.cancel = true;
}
/**
* submit master base task exec thread
+ *
* @return TaskInstance
*/
- protected TaskInstance submit(){
- Integer commitRetryTimes =
masterConfig.getMasterTaskCommitRetryTimes();
- Integer commitRetryInterval =
masterConfig.getMasterTaskCommitInterval();
+ protected TaskInstance submit() {
+ int commitRetryTimes = masterConfig.getMasterTaskCommitRetryTimes();
+ int commitRetryInterval = masterConfig.getMasterTaskCommitInterval();
- int retryTimes = 1;
boolean submitDB = false;
- boolean submitTask = false;
TaskInstance task = null;
- while (retryTimes <= commitRetryTimes){
+ for (int retryTimes = 1; retryTimes <= commitRetryTimes && !submitDB;
retryTimes++) {
try {
- if(!submitDB){
- // submit task to db
- task = processService.submitTask(taskInstance);
- if(task != null && task.getId() != 0){
- submitDB = true;
- }
+ // submit task to db
+ task = processService.submitTask(taskInstance);
+ if (task != null && task.getId() != 0) {
+ submitDB = true;
+ } else {
+ logger.error("task commit to db failed , taskId {} has
already retry {} times, please check the database",
+ taskInstance.getId(), retryTimes);
+ Thread.sleep(commitRetryInterval);
}
- if(submitDB && !submitTask){
+ } catch (Exception e) {
+ logger.error("task commit to mysql and dispatcht task failed",
e);
+ }
+ }
+ if (submitDB) {
+ boolean submitTask = false;
+ for (int retryTimes = 1; retryTimes <= commitRetryTimes &&
!submitTask; retryTimes++) {
+ try {
// dispatch task
submitTask = dispatchTask(task);
+ if (!submitTask) {
+ logger.error("task commit failed , taskId {} has
already retry {} times, please check", taskInstance.getId(), retryTimes);
+ Thread.sleep(commitRetryInterval);
+ }
+ } catch (Exception e) {
+ logger.error("task commit to mysql and dispatcht task
failed", e);
Review comment:
It is recommended to optimize the log content, add task information.
"not mysql"
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]