status
stringclasses
1 value
repo_name
stringclasses
31 values
repo_url
stringclasses
31 values
issue_id
int64
1
104k
title
stringlengths
4
233
body
stringlengths
0
186k
issue_url
stringlengths
38
56
pull_url
stringlengths
37
54
before_fix_sha
stringlengths
40
40
after_fix_sha
stringlengths
40
40
report_datetime
unknown
language
stringclasses
5 values
commit_datetime
unknown
updated_file
stringlengths
7
188
chunk_content
stringlengths
1
1.03M
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,282
this workflow is bug , I think it's a very serious problem
Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild
https://github.com/apache/dolphinscheduler/issues/2282
https://github.com/apache/dolphinscheduler/pull/2329
949b8ef17d2b734b239ce31c997d7084868347b7
69e000b54214e8331ede69bdce9710b8418e960e
"2020-03-23T08:00:51Z"
java
"2020-04-02T16:16:01Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
} /** * query need failover process instance * @param host host * @return process instance list */ public List<ProcessInstance> queryNeedFailoverProcessInstances(String host){ return processInstanceMapper.queryByHostAndStatus(host, stateArray); } /** * process need failover process instance * @param processInstance processInstance */ @Transactional(rollbackFor = Exception.class) public void processNeedFailoverProcessInstances(ProcessInstance processInstance){ // processInstance.setHost("null"); processInstanceMapper.updateById(processInstance); // Command cmd = new Command(); cmd.setProcessDefinitionId(processInstance.getProcessDefinitionId()); cmd.setCommandParam(String.format("{\"%s\":%d}", Constants.CMDPARAM_RECOVER_PROCESS_ID_STRING, processInstance.getId())); cmd.setExecutorId(processInstance.getExecutorId()); cmd.setCommandType(CommandType.RECOVER_TOLERANCE_FAULT_PROCESS); createCommand(cmd); } /** * query all need failover task instances by host * @param host host * @return task instance list
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,282
this workflow is bug , I think it's a very serious problem
Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild
https://github.com/apache/dolphinscheduler/issues/2282
https://github.com/apache/dolphinscheduler/pull/2329
949b8ef17d2b734b239ce31c997d7084868347b7
69e000b54214e8331ede69bdce9710b8418e960e
"2020-03-23T08:00:51Z"
java
"2020-04-02T16:16:01Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
*/ public List<TaskInstance> queryNeedFailoverTaskInstances(String host){ return taskInstanceMapper.queryByHostAndStatus(host, stateArray); } /** * find data source by id * @param id id * @return datasource */ public DataSource findDataSourceById(int id){ return dataSourceMapper.selectById(id); } /** * update process instance state by id * @param processInstanceId processInstanceId * @param executionStatus executionStatus * @return update process result */ public int updateProcessInstanceState(Integer processInstanceId, ExecutionStatus executionStatus) { ProcessInstance instance = processInstanceMapper.selectById(processInstanceId); instance.setState(executionStatus); return processInstanceMapper.updateById(instance); } /** * find process instance by the task id * @param taskId taskId * @return process instance */ public ProcessInstance findProcessInstanceByTaskId(int taskId){
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,282
this workflow is bug , I think it's a very serious problem
Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild
https://github.com/apache/dolphinscheduler/issues/2282
https://github.com/apache/dolphinscheduler/pull/2329
949b8ef17d2b734b239ce31c997d7084868347b7
69e000b54214e8331ede69bdce9710b8418e960e
"2020-03-23T08:00:51Z"
java
"2020-04-02T16:16:01Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
TaskInstance taskInstance = taskInstanceMapper.selectById(taskId); if(taskInstance!= null){ return processInstanceMapper.selectById(taskInstance.getProcessInstanceId()); } return null; } /** * find udf function list by id list string * @param ids ids * @return udf function list */ public List<UdfFunc> queryUdfFunListByids(int[] ids){ return udfFuncMapper.queryUdfByIdStr(ids, null); } /** * find tenant code by resource name * @param resName resource name * @param resourceType resource type * @return tenant code */ public String queryTenantCodeByResName(String resName,ResourceType resourceType){ return resourceMapper.queryTenantCodeByResourceName(resName,resourceType.ordinal()); } /** * find schedule list by process define id. * @param ids ids * @return schedule list */ public List<Schedule> selectAllByProcessDefineId(int[] ids){ return scheduleMapper.selectAllByProcessDefineArray(
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,282
this workflow is bug , I think it's a very serious problem
Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild
https://github.com/apache/dolphinscheduler/issues/2282
https://github.com/apache/dolphinscheduler/pull/2329
949b8ef17d2b734b239ce31c997d7084868347b7
69e000b54214e8331ede69bdce9710b8418e960e
"2020-03-23T08:00:51Z"
java
"2020-04-02T16:16:01Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
ids); } /** * get dependency cycle by work process define id and scheduler fire time * @param masterId masterId * @param processDefinitionId processDefinitionId * @param scheduledFireTime the time the task schedule is expected to trigger * @return CycleDependency * @throws Exception if error throws Exception */ public CycleDependency getCycleDependency(int masterId, int processDefinitionId, Date scheduledFireTime) throws Exception { List<CycleDependency> list = getCycleDependencies(masterId,new int[]{processDefinitionId},scheduledFireTime); return list.size()>0 ? list.get(0) : null; } /** * get dependency cycle list by work process define id list and scheduler fire time * @param masterId masterId * @param ids ids * @param scheduledFireTime the time the task schedule is expected to trigger * @return CycleDependency list * @throws Exception if error throws Exception */ public List<CycleDependency> getCycleDependencies(int masterId,int[] ids,Date scheduledFireTime) throws Exception { List<CycleDependency> cycleDependencyList = new ArrayList<CycleDependency>(); if(ArrayUtils.isEmpty(ids)){ logger.warn("ids[] is empty!is invalid!"); return cycleDependencyList; } if(scheduledFireTime == null){ logger.warn("scheduledFireTime is null!is invalid!");
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,282
this workflow is bug , I think it's a very serious problem
Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild
https://github.com/apache/dolphinscheduler/issues/2282
https://github.com/apache/dolphinscheduler/pull/2329
949b8ef17d2b734b239ce31c997d7084868347b7
69e000b54214e8331ede69bdce9710b8418e960e
"2020-03-23T08:00:51Z"
java
"2020-04-02T16:16:01Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
return cycleDependencyList; } String strCrontab = ""; CronExpression depCronExpression; Cron depCron; List<Date> list; List<Schedule> schedules = this.selectAllByProcessDefineId(ids); // for(Schedule depSchedule:schedules){ strCrontab = depSchedule.getCrontab(); depCronExpression = CronUtils.parse2CronExpression(strCrontab); depCron = CronUtils.parse2Cron(strCrontab); CycleEnum cycleEnum = CronUtils.getMiniCycle(depCron); if(cycleEnum == null){ logger.error("{} is not valid",strCrontab); continue; } Calendar calendar = Calendar.getInstance(); switch (cycleEnum){ /*case MINUTE: calendar.add(Calendar.MINUTE,-61);*/ case HOUR: calendar.add(Calendar.HOUR,-25); break; case DAY: calendar.add(Calendar.DATE,-32); break; case WEEK: calendar.add(Calendar.DATE,-32); break;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,282
this workflow is bug , I think it's a very serious problem
Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild
https://github.com/apache/dolphinscheduler/issues/2282
https://github.com/apache/dolphinscheduler/pull/2329
949b8ef17d2b734b239ce31c997d7084868347b7
69e000b54214e8331ede69bdce9710b8418e960e
"2020-03-23T08:00:51Z"
java
"2020-04-02T16:16:01Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
case MONTH: calendar.add(Calendar.MONTH,-13); break; default: logger.warn("Dependent process definition's cycleEnum is {},not support!!", cycleEnum.name()); continue; } Date start = calendar.getTime(); if(depSchedule.getProcessDefinitionId() == masterId){ list = CronUtils.getSelfFireDateList(start, scheduledFireTime, depCronExpression); }else { list = CronUtils.getFireDateList(start, scheduledFireTime, depCronExpression); } if(list.size()>=1){ start = list.get(list.size()-1); CycleDependency dependency = new CycleDependency(depSchedule.getProcessDefinitionId(),start, CronUtils.getExpirationTime(start, cycleEnum), cycleEnum); cycleDependencyList.add(dependency); } } return cycleDependencyList; } /** * find last scheduler process instance in the date interval * @param definitionId definitionId * @param dateInterval dateInterval * @return process instance */ public ProcessInstance findLastSchedulerProcessInterval(int definitionId, DateInterval dateInterval) { return processInstanceMapper.queryLastSchedulerProcess(definitionId, dateInterval.getStartTime(),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,282
this workflow is bug , I think it's a very serious problem
Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild
https://github.com/apache/dolphinscheduler/issues/2282
https://github.com/apache/dolphinscheduler/pull/2329
949b8ef17d2b734b239ce31c997d7084868347b7
69e000b54214e8331ede69bdce9710b8418e960e
"2020-03-23T08:00:51Z"
java
"2020-04-02T16:16:01Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
dateInterval.getEndTime()); } /** * find last manual process instance interval * @param definitionId process definition id * @param dateInterval dateInterval * @return process instance */ public ProcessInstance findLastManualProcessInterval(int definitionId, DateInterval dateInterval) { return processInstanceMapper.queryLastManualProcess(definitionId, dateInterval.getStartTime(), dateInterval.getEndTime()); } /** * find last running process instance * @param definitionId process definition id * @param dateInterval dateInterval * @return process instance */ public ProcessInstance findLastRunningProcess(int definitionId, DateInterval dateInterval) { return processInstanceMapper.queryLastRunningProcess(definitionId, dateInterval.getStartTime(), dateInterval.getEndTime(), stateArray); } /** * query user queue by process instance id * @param processInstanceId processInstanceId * @return queue */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,282
this workflow is bug , I think it's a very serious problem
Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild
https://github.com/apache/dolphinscheduler/issues/2282
https://github.com/apache/dolphinscheduler/pull/2329
949b8ef17d2b734b239ce31c997d7084868347b7
69e000b54214e8331ede69bdce9710b8418e960e
"2020-03-23T08:00:51Z"
java
"2020-04-02T16:16:01Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
public String queryUserQueueByProcessInstanceId(int processInstanceId){ String queue = ""; ProcessInstance processInstance = processInstanceMapper.selectById(processInstanceId); if(processInstance == null){ return queue; } User executor = userMapper.selectById(processInstance.getExecutorId()); if(executor != null){ queue = executor.getQueue(); } return queue; } /** * query worker group by id * @param workerGroupId workerGroupId * @return WorkerGroup */ public WorkerGroup queryWorkerGroupById(int workerGroupId){ return workerGroupMapper.selectById(workerGroupId); } /** * get task worker group id * @param taskInstance taskInstance * @return workerGroupId */ public int getTaskWorkerGroupId(TaskInstance taskInstance) { int taskWorkerGroupId = taskInstance.getWorkerGroupId(); if(taskWorkerGroupId > 0){ return taskWorkerGroupId; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,282
this workflow is bug , I think it's a very serious problem
Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild
https://github.com/apache/dolphinscheduler/issues/2282
https://github.com/apache/dolphinscheduler/pull/2329
949b8ef17d2b734b239ce31c997d7084868347b7
69e000b54214e8331ede69bdce9710b8418e960e
"2020-03-23T08:00:51Z"
java
"2020-04-02T16:16:01Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
int processInstanceId = taskInstance.getProcessInstanceId(); ProcessInstance processInstance = findProcessInstanceById(processInstanceId); if(processInstance != null){ return processInstance.getWorkerGroupId(); } logger.info("task : {} will use default worker group id", taskInstance.getId()); return Constants.DEFAULT_WORKER_ID; } /** * get have perm project list * @param userId userId * @return project list */ public List<Project> getProjectListHavePerm(int userId){ List<Project> createProjects = projectMapper.queryProjectCreatedByUser(userId); List<Project> authedProjects = projectMapper.queryAuthedProjectListByUserId(userId); if(createProjects == null){ createProjects = new ArrayList<>(); } if(authedProjects != null){ createProjects.addAll(authedProjects); } return createProjects; } /** * get have perm project ids * @param userId userId * @return project ids */ public List<Integer> getProjectIdListHavePerm(int userId){
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,282
this workflow is bug , I think it's a very serious problem
Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild
https://github.com/apache/dolphinscheduler/issues/2282
https://github.com/apache/dolphinscheduler/pull/2329
949b8ef17d2b734b239ce31c997d7084868347b7
69e000b54214e8331ede69bdce9710b8418e960e
"2020-03-23T08:00:51Z"
java
"2020-04-02T16:16:01Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
List<Integer> projectIdList = new ArrayList<>(); for(Project project : getProjectListHavePerm(userId)){ projectIdList.add(project.getId()); } return projectIdList; } /** * list unauthorized udf function * @param userId user id * @param needChecks data source id array * @return unauthorized udf function list */ public <T> List<T> listUnauthorized(int userId,T[] needChecks,AuthorizationType authorizationType){ List<T> resultList = new ArrayList<T>(); if (!ArrayUtils.isEmpty(needChecks)) { Set<T> originResSet = new HashSet<T>(Arrays.asList(needChecks)); switch (authorizationType){ case RESOURCE_FILE_ID: Set<Integer> authorizedResourceFiles = resourceMapper.listAuthorizedResourceById(userId, needChecks).stream().map(t -> t.getId()).collect(toSet()); originResSet.removeAll(authorizedResourceFiles); break; case RESOURCE_FILE_NAME: Set<String> authorizedResources = resourceMapper.listAuthorizedResource(userId, needChecks).stream().map(t -> t.getFullName()).collect(toSet()); originResSet.removeAll(authorizedResources); break; case UDF_FILE: Set<Integer> authorizedUdfFiles = resourceMapper.listAuthorizedResourceById(userId, needChecks).stream().map(t -> t.getId()).collect(toSet()); originResSet.removeAll(authorizedUdfFiles); break; case DATASOURCE:
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,282
this workflow is bug , I think it's a very serious problem
Is I also found a problem, it is a bug, is I have two workflow of a and b, then a workflow Riga, a1 node b work new b1 task dependent nodes, type selection, the chosen today, relying on a1, my situation is such, a workflow, I have the day before the creation of a1 run through a process, and then I run b process, theory should be run failed, but in fact was a success.I am also drunk, similarly I choose the type of b1 yesterday also can run successfully, but the first three days before the election run failed.That logo is faild
https://github.com/apache/dolphinscheduler/issues/2282
https://github.com/apache/dolphinscheduler/pull/2329
949b8ef17d2b734b239ce31c997d7084868347b7
69e000b54214e8331ede69bdce9710b8418e960e
"2020-03-23T08:00:51Z"
java
"2020-04-02T16:16:01Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
Set<Integer> authorizedDatasources = dataSourceMapper.listAuthorizedDataSource(userId,needChecks).stream().map(t -> t.getId()).collect(toSet()); originResSet.removeAll(authorizedDatasources); break; case UDF: Set<Integer> authorizedUdfs = udfFuncMapper.listAuthorizedUdfFunc(userId, needChecks).stream().map(t -> t.getId()).collect(toSet()); originResSet.removeAll(authorizedUdfs); break; } resultList.addAll(originResSet); } return resultList; } /** * get user by user id * @param userId user id * @return User */ public User getUserById(int userId){ return userMapper.queryDetailsById(userId); } /** * get resource by resoruce id * @param resoruceId resource id * @return Resource */ public Resource getResourceById(int resoruceId){ return resourceMapper.selectById(resoruceId); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,350
[BUG] master fault tolerance error
1. Start one master1 and two workers 2. Task setting timing, executed once every 1 minute, online timing 3. There are 3 workflow instances running on the master1 service, and the task shell_task_1 of the workflow instance is also in the "running" state. 4. Start the master2 service, the host of the workflow instance changes from master1 to master2, and the task shell_task_1 also starts fault-tolerant processing, as shown in the following figure, and finally shell_task_1 is executed 3 times: =============================================== 1.启动一台master1 , 2台worker 2.任务设置定时,1分钟执行一次,上线定时 3.有3个工作流实例在master1服务上运行,其中工作流实例的任务shell_task_1也处于“正在运行”状态 4.启动master2服务,工作流实例的host从master1变为master2,任务shell_task_1也开始容错处理,如下图所示,最终shell_task_1被执行3次: =============================================== ![image](https://user-images.githubusercontent.com/55787491/78106433-f4545180-7425-11ea-8bc6-ebcf916236f8.png) ![image](https://user-images.githubusercontent.com/55787491/78106449-fe765000-7425-11ea-8dd8-3c14ec90d4fb.png) ![image](https://user-images.githubusercontent.com/55787491/78106564-3d0c0a80-7426-11ea-956e-42b2b19a01cd.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2350
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T06:38:43Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,350
[BUG] master fault tolerance error
1. Start one master1 and two workers 2. Task setting timing, executed once every 1 minute, online timing 3. There are 3 workflow instances running on the master1 service, and the task shell_task_1 of the workflow instance is also in the "running" state. 4. Start the master2 service, the host of the workflow instance changes from master1 to master2, and the task shell_task_1 also starts fault-tolerant processing, as shown in the following figure, and finally shell_task_1 is executed 3 times: =============================================== 1.启动一台master1 , 2台worker 2.任务设置定时,1分钟执行一次,上线定时 3.有3个工作流实例在master1服务上运行,其中工作流实例的任务shell_task_1也处于“正在运行”状态 4.启动master2服务,工作流实例的host从master1变为master2,任务shell_task_1也开始容错处理,如下图所示,最终shell_task_1被执行3次: =============================================== ![image](https://user-images.githubusercontent.com/55787491/78106433-f4545180-7425-11ea-8bc6-ebcf916236f8.png) ![image](https://user-images.githubusercontent.com/55787491/78106449-fe765000-7425-11ea-8dd8-3c14ec90d4fb.png) ![image](https://user-images.githubusercontent.com/55787491/78106564-3d0c0a80-7426-11ea-956e-42b2b19a01cd.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2350
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T06:38:43Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java
* limitations under the License. */ package org.apache.dolphinscheduler.server.zk; import org.apache.commons.lang.StringUtils; import org.apache.curator.framework.CuratorFramework; import org.apache.curator.framework.recipes.cache.TreeCacheEvent; import org.apache.curator.framework.recipes.locks.InterProcessMutex; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.enums.ZKNodeType; import org.apache.dolphinscheduler.common.model.Server; import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.server.builder.TaskExecutionContextBuilder; import org.apache.dolphinscheduler.server.entity.TaskExecutionContext; import org.apache.dolphinscheduler.server.utils.ProcessUtils; import org.apache.dolphinscheduler.service.process.ProcessService; import org.apache.dolphinscheduler.service.zk.AbstractZKClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.Date; import java.util.List; /** * zookeeper master client * * single instance */ @Component
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,350
[BUG] master fault tolerance error
1. Start one master1 and two workers 2. Task setting timing, executed once every 1 minute, online timing 3. There are 3 workflow instances running on the master1 service, and the task shell_task_1 of the workflow instance is also in the "running" state. 4. Start the master2 service, the host of the workflow instance changes from master1 to master2, and the task shell_task_1 also starts fault-tolerant processing, as shown in the following figure, and finally shell_task_1 is executed 3 times: =============================================== 1.启动一台master1 , 2台worker 2.任务设置定时,1分钟执行一次,上线定时 3.有3个工作流实例在master1服务上运行,其中工作流实例的任务shell_task_1也处于“正在运行”状态 4.启动master2服务,工作流实例的host从master1变为master2,任务shell_task_1也开始容错处理,如下图所示,最终shell_task_1被执行3次: =============================================== ![image](https://user-images.githubusercontent.com/55787491/78106433-f4545180-7425-11ea-8bc6-ebcf916236f8.png) ![image](https://user-images.githubusercontent.com/55787491/78106449-fe765000-7425-11ea-8dd8-3c14ec90d4fb.png) ![image](https://user-images.githubusercontent.com/55787491/78106564-3d0c0a80-7426-11ea-956e-42b2b19a01cd.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2350
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T06:38:43Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java
public class ZKMasterClient extends AbstractZKClient { /** * logger */ private static final Logger logger = LoggerFactory.getLogger(ZKMasterClient.class); /** * process service */ @Autowired private ProcessService processService; public void start() { InterProcessMutex mutex = null; try { String znodeLock = getMasterStartUpLockPath(); mutex = new InterProcessMutex(getZkClient(), znodeLock); mutex.acquire(); this.initSystemZNode();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,350
[BUG] master fault tolerance error
1. Start one master1 and two workers 2. Task setting timing, executed once every 1 minute, online timing 3. There are 3 workflow instances running on the master1 service, and the task shell_task_1 of the workflow instance is also in the "running" state. 4. Start the master2 service, the host of the workflow instance changes from master1 to master2, and the task shell_task_1 also starts fault-tolerant processing, as shown in the following figure, and finally shell_task_1 is executed 3 times: =============================================== 1.启动一台master1 , 2台worker 2.任务设置定时,1分钟执行一次,上线定时 3.有3个工作流实例在master1服务上运行,其中工作流实例的任务shell_task_1也处于“正在运行”状态 4.启动master2服务,工作流实例的host从master1变为master2,任务shell_task_1也开始容错处理,如下图所示,最终shell_task_1被执行3次: =============================================== ![image](https://user-images.githubusercontent.com/55787491/78106433-f4545180-7425-11ea-8bc6-ebcf916236f8.png) ![image](https://user-images.githubusercontent.com/55787491/78106449-fe765000-7425-11ea-8dd8-3c14ec90d4fb.png) ![image](https://user-images.githubusercontent.com/55787491/78106564-3d0c0a80-7426-11ea-956e-42b2b19a01cd.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2350
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T06:38:43Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java
if (getActiveMasterNum() == 1) { failoverWorker(null, true); failoverMaster(null); } }catch (Exception e){ logger.error("master start up exception",e); }finally { releaseMutex(mutex); } } @Override public void close(){ super.close(); } /** * handle path events that this class cares about * @param client zkClient * @param event path event * @param path zk path */ @Override protected void dataChanged(CuratorFramework client, TreeCacheEvent event, String path) { if(path.startsWith(getZNodeParentPath(ZKNodeType.MASTER)+Constants.SINGLE_SLASH)){ handleMasterEvent(event,path); }else if(path.startsWith(getZNodeParentPath(ZKNodeType.WORKER)+Constants.SINGLE_SLASH)){ handleWorkerEvent(event,path); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,350
[BUG] master fault tolerance error
1. Start one master1 and two workers 2. Task setting timing, executed once every 1 minute, online timing 3. There are 3 workflow instances running on the master1 service, and the task shell_task_1 of the workflow instance is also in the "running" state. 4. Start the master2 service, the host of the workflow instance changes from master1 to master2, and the task shell_task_1 also starts fault-tolerant processing, as shown in the following figure, and finally shell_task_1 is executed 3 times: =============================================== 1.启动一台master1 , 2台worker 2.任务设置定时,1分钟执行一次,上线定时 3.有3个工作流实例在master1服务上运行,其中工作流实例的任务shell_task_1也处于“正在运行”状态 4.启动master2服务,工作流实例的host从master1变为master2,任务shell_task_1也开始容错处理,如下图所示,最终shell_task_1被执行3次: =============================================== ![image](https://user-images.githubusercontent.com/55787491/78106433-f4545180-7425-11ea-8bc6-ebcf916236f8.png) ![image](https://user-images.githubusercontent.com/55787491/78106449-fe765000-7425-11ea-8dd8-3c14ec90d4fb.png) ![image](https://user-images.githubusercontent.com/55787491/78106564-3d0c0a80-7426-11ea-956e-42b2b19a01cd.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2350
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T06:38:43Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java
/** * remove zookeeper node path * * @param path zookeeper node path * @param zkNodeType zookeeper node type * @param failover is failover */ private void removeZKNodePath(String path, ZKNodeType zkNodeType, boolean failover) { logger.info("{} node deleted : {}", zkNodeType.toString(), path); InterProcessMutex mutex = null; try { String failoverPath = getFailoverLockPath(zkNodeType); mutex = new InterProcessMutex(getZkClient(), failoverPath); mutex.acquire(); String serverHost = getHostByEventDataPath(path); handleDeadServer(path, zkNodeType, Constants.ADD_ZK_OP); if(failover){ failoverServerWhenDown(serverHost, zkNodeType); } }catch (Exception e){ logger.error("{} server failover failed.", zkNodeType.toString()); logger.error("failover exception ",e); } finally { releaseMutex(mutex); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,350
[BUG] master fault tolerance error
1. Start one master1 and two workers 2. Task setting timing, executed once every 1 minute, online timing 3. There are 3 workflow instances running on the master1 service, and the task shell_task_1 of the workflow instance is also in the "running" state. 4. Start the master2 service, the host of the workflow instance changes from master1 to master2, and the task shell_task_1 also starts fault-tolerant processing, as shown in the following figure, and finally shell_task_1 is executed 3 times: =============================================== 1.启动一台master1 , 2台worker 2.任务设置定时,1分钟执行一次,上线定时 3.有3个工作流实例在master1服务上运行,其中工作流实例的任务shell_task_1也处于“正在运行”状态 4.启动master2服务,工作流实例的host从master1变为master2,任务shell_task_1也开始容错处理,如下图所示,最终shell_task_1被执行3次: =============================================== ![image](https://user-images.githubusercontent.com/55787491/78106433-f4545180-7425-11ea-8bc6-ebcf916236f8.png) ![image](https://user-images.githubusercontent.com/55787491/78106449-fe765000-7425-11ea-8dd8-3c14ec90d4fb.png) ![image](https://user-images.githubusercontent.com/55787491/78106564-3d0c0a80-7426-11ea-956e-42b2b19a01cd.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2350
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T06:38:43Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java
/** * failover server when server down * * @param serverHost server host * @param zkNodeType zookeeper node type * @throws Exception exception */ private void failoverServerWhenDown(String serverHost, ZKNodeType zkNodeType) throws Exception { if(StringUtils.isEmpty(serverHost)){ return ; } switch (zkNodeType){ case MASTER: failoverMaster(serverHost); break; case WORKER: failoverWorker(serverHost, true); default: break; } } /** * get failover lock path * * @param zkNodeType zookeeper node type * @return fail over lock path */ private String getFailoverLockPath(ZKNodeType zkNodeType){ switch (zkNodeType){ case MASTER:
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,350
[BUG] master fault tolerance error
1. Start one master1 and two workers 2. Task setting timing, executed once every 1 minute, online timing 3. There are 3 workflow instances running on the master1 service, and the task shell_task_1 of the workflow instance is also in the "running" state. 4. Start the master2 service, the host of the workflow instance changes from master1 to master2, and the task shell_task_1 also starts fault-tolerant processing, as shown in the following figure, and finally shell_task_1 is executed 3 times: =============================================== 1.启动一台master1 , 2台worker 2.任务设置定时,1分钟执行一次,上线定时 3.有3个工作流实例在master1服务上运行,其中工作流实例的任务shell_task_1也处于“正在运行”状态 4.启动master2服务,工作流实例的host从master1变为master2,任务shell_task_1也开始容错处理,如下图所示,最终shell_task_1被执行3次: =============================================== ![image](https://user-images.githubusercontent.com/55787491/78106433-f4545180-7425-11ea-8bc6-ebcf916236f8.png) ![image](https://user-images.githubusercontent.com/55787491/78106449-fe765000-7425-11ea-8dd8-3c14ec90d4fb.png) ![image](https://user-images.githubusercontent.com/55787491/78106564-3d0c0a80-7426-11ea-956e-42b2b19a01cd.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2350
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T06:38:43Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java
return getMasterFailoverLockPath(); case WORKER: return getWorkerFailoverLockPath(); default: return ""; } } /** * monitor master * @param event event * @param path path */ public void handleMasterEvent(TreeCacheEvent event, String path){ switch (event.getType()) { case NODE_ADDED: logger.info("master node added : {}", path); break; case NODE_REMOVED: removeZKNodePath(path, ZKNodeType.MASTER, true); break; default: break; } } /** * monitor worker * @param event event * @param path path */ public void handleWorkerEvent(TreeCacheEvent event, String path){
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,350
[BUG] master fault tolerance error
1. Start one master1 and two workers 2. Task setting timing, executed once every 1 minute, online timing 3. There are 3 workflow instances running on the master1 service, and the task shell_task_1 of the workflow instance is also in the "running" state. 4. Start the master2 service, the host of the workflow instance changes from master1 to master2, and the task shell_task_1 also starts fault-tolerant processing, as shown in the following figure, and finally shell_task_1 is executed 3 times: =============================================== 1.启动一台master1 , 2台worker 2.任务设置定时,1分钟执行一次,上线定时 3.有3个工作流实例在master1服务上运行,其中工作流实例的任务shell_task_1也处于“正在运行”状态 4.启动master2服务,工作流实例的host从master1变为master2,任务shell_task_1也开始容错处理,如下图所示,最终shell_task_1被执行3次: =============================================== ![image](https://user-images.githubusercontent.com/55787491/78106433-f4545180-7425-11ea-8bc6-ebcf916236f8.png) ![image](https://user-images.githubusercontent.com/55787491/78106449-fe765000-7425-11ea-8dd8-3c14ec90d4fb.png) ![image](https://user-images.githubusercontent.com/55787491/78106564-3d0c0a80-7426-11ea-956e-42b2b19a01cd.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2350
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T06:38:43Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java
switch (event.getType()) { case NODE_ADDED: logger.info("worker node added : {}", path); break; case NODE_REMOVED: logger.info("worker node deleted : {}", path); removeZKNodePath(path, ZKNodeType.WORKER, true); break; default: break; } } /** * task needs failover if task start before worker starts * * @param taskInstance task instance * @return true if task instance need fail over */ private boolean checkTaskInstanceNeedFailover(TaskInstance taskInstance) throws Exception { boolean taskNeedFailover = true; if(taskInstance.getHost() == null){ return false; } if(checkZKNodeExists(taskInstance.getHost(), ZKNodeType.WORKER)){ if(checkTaskAfterWorkerStart(taskInstance)){ taskNeedFailover = false; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,350
[BUG] master fault tolerance error
1. Start one master1 and two workers 2. Task setting timing, executed once every 1 minute, online timing 3. There are 3 workflow instances running on the master1 service, and the task shell_task_1 of the workflow instance is also in the "running" state. 4. Start the master2 service, the host of the workflow instance changes from master1 to master2, and the task shell_task_1 also starts fault-tolerant processing, as shown in the following figure, and finally shell_task_1 is executed 3 times: =============================================== 1.启动一台master1 , 2台worker 2.任务设置定时,1分钟执行一次,上线定时 3.有3个工作流实例在master1服务上运行,其中工作流实例的任务shell_task_1也处于“正在运行”状态 4.启动master2服务,工作流实例的host从master1变为master2,任务shell_task_1也开始容错处理,如下图所示,最终shell_task_1被执行3次: =============================================== ![image](https://user-images.githubusercontent.com/55787491/78106433-f4545180-7425-11ea-8bc6-ebcf916236f8.png) ![image](https://user-images.githubusercontent.com/55787491/78106449-fe765000-7425-11ea-8dd8-3c14ec90d4fb.png) ![image](https://user-images.githubusercontent.com/55787491/78106564-3d0c0a80-7426-11ea-956e-42b2b19a01cd.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2350
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T06:38:43Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java
} return taskNeedFailover; } /** * check task start after the worker server starts. * * @param taskInstance task instance * @return true if task instance start time after worker server start date */ private boolean checkTaskAfterWorkerStart(TaskInstance taskInstance) { if(StringUtils.isEmpty(taskInstance.getHost())){ return false; } Date workerServerStartDate = null; List<Server> workerServers = getServersList(ZKNodeType.WORKER); for(Server workerServer : workerServers){ if(workerServer.getHost().equals(taskInstance.getHost())){ workerServerStartDate = workerServer.getCreateTime(); break; } } if(workerServerStartDate != null){ return taskInstance.getStartTime().after(workerServerStartDate); }else{ return false; } } /** * failover worker tasks *
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,350
[BUG] master fault tolerance error
1. Start one master1 and two workers 2. Task setting timing, executed once every 1 minute, online timing 3. There are 3 workflow instances running on the master1 service, and the task shell_task_1 of the workflow instance is also in the "running" state. 4. Start the master2 service, the host of the workflow instance changes from master1 to master2, and the task shell_task_1 also starts fault-tolerant processing, as shown in the following figure, and finally shell_task_1 is executed 3 times: =============================================== 1.启动一台master1 , 2台worker 2.任务设置定时,1分钟执行一次,上线定时 3.有3个工作流实例在master1服务上运行,其中工作流实例的任务shell_task_1也处于“正在运行”状态 4.启动master2服务,工作流实例的host从master1变为master2,任务shell_task_1也开始容错处理,如下图所示,最终shell_task_1被执行3次: =============================================== ![image](https://user-images.githubusercontent.com/55787491/78106433-f4545180-7425-11ea-8bc6-ebcf916236f8.png) ![image](https://user-images.githubusercontent.com/55787491/78106449-fe765000-7425-11ea-8dd8-3c14ec90d4fb.png) ![image](https://user-images.githubusercontent.com/55787491/78106564-3d0c0a80-7426-11ea-956e-42b2b19a01cd.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2350
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T06:38:43Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java
* 1. kill yarn job if there are yarn jobs in tasks. * 2. change task state from running to need failover. * 3. failover all tasks when workerHost is null * @param workerHost worker host */ /** * failover worker tasks * * 1. kill yarn job if there are yarn jobs in tasks. * 2. change task state from running to need failover. * 3. failover all tasks when workerHost is null * @param workerHost worker host * @param needCheckWorkerAlive need check worker alive * @throws Exception exception */ private void failoverWorker(String workerHost, boolean needCheckWorkerAlive) throws Exception { logger.info("start worker[{}] failover ...", workerHost); List<TaskInstance> needFailoverTaskInstanceList = processService.queryNeedFailoverTaskInstances(workerHost); for(TaskInstance taskInstance : needFailoverTaskInstanceList){ if(needCheckWorkerAlive){ if(!checkTaskInstanceNeedFailover(taskInstance)){ continue; } } ProcessInstance processInstance = processService.findProcessInstanceDetailById(taskInstance.getProcessInstanceId()); if(processInstance != null){ taskInstance.setProcessInstance(processInstance); } TaskExecutionContext taskExecutionContext = TaskExecutionContextBuilder.get() .buildTaskInstanceRelatedInfo(taskInstance)
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,350
[BUG] master fault tolerance error
1. Start one master1 and two workers 2. Task setting timing, executed once every 1 minute, online timing 3. There are 3 workflow instances running on the master1 service, and the task shell_task_1 of the workflow instance is also in the "running" state. 4. Start the master2 service, the host of the workflow instance changes from master1 to master2, and the task shell_task_1 also starts fault-tolerant processing, as shown in the following figure, and finally shell_task_1 is executed 3 times: =============================================== 1.启动一台master1 , 2台worker 2.任务设置定时,1分钟执行一次,上线定时 3.有3个工作流实例在master1服务上运行,其中工作流实例的任务shell_task_1也处于“正在运行”状态 4.启动master2服务,工作流实例的host从master1变为master2,任务shell_task_1也开始容错处理,如下图所示,最终shell_task_1被执行3次: =============================================== ![image](https://user-images.githubusercontent.com/55787491/78106433-f4545180-7425-11ea-8bc6-ebcf916236f8.png) ![image](https://user-images.githubusercontent.com/55787491/78106449-fe765000-7425-11ea-8dd8-3c14ec90d4fb.png) ![image](https://user-images.githubusercontent.com/55787491/78106564-3d0c0a80-7426-11ea-956e-42b2b19a01cd.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2350
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T06:38:43Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java
.buildProcessInstanceRelatedInfo(processInstance) .create(); ProcessUtils.killYarnJob(taskExecutionContext); taskInstance.setState(ExecutionStatus.NEED_FAULT_TOLERANCE); processService.saveTaskInstance(taskInstance); } logger.info("end worker[{}] failover ...", workerHost); } /** * failover master tasks * * @param masterHost master host */ private void failoverMaster(String masterHost) { logger.info("start master failover ..."); List<ProcessInstance> needFailoverProcessInstanceList = processService.queryNeedFailoverProcessInstances(masterHost); for(ProcessInstance processInstance : needFailoverProcessInstanceList){ processService.processNeedFailoverProcessInstances(processInstance); } logger.info("master failover end"); } public InterProcessMutex blockAcquireMutex() throws Exception { InterProcessMutex mutex = new InterProcessMutex(getZkClient(), getMasterLockPath()); mutex.acquire(); return mutex; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,350
[BUG] master fault tolerance error
1. Start one master1 and two workers 2. Task setting timing, executed once every 1 minute, online timing 3. There are 3 workflow instances running on the master1 service, and the task shell_task_1 of the workflow instance is also in the "running" state. 4. Start the master2 service, the host of the workflow instance changes from master1 to master2, and the task shell_task_1 also starts fault-tolerant processing, as shown in the following figure, and finally shell_task_1 is executed 3 times: =============================================== 1.启动一台master1 , 2台worker 2.任务设置定时,1分钟执行一次,上线定时 3.有3个工作流实例在master1服务上运行,其中工作流实例的任务shell_task_1也处于“正在运行”状态 4.启动master2服务,工作流实例的host从master1变为master2,任务shell_task_1也开始容错处理,如下图所示,最终shell_task_1被执行3次: =============================================== ![image](https://user-images.githubusercontent.com/55787491/78106433-f4545180-7425-11ea-8bc6-ebcf916236f8.png) ![image](https://user-images.githubusercontent.com/55787491/78106449-fe765000-7425-11ea-8dd8-3c14ec90d4fb.png) ![image](https://user-images.githubusercontent.com/55787491/78106564-3d0c0a80-7426-11ea-956e-42b2b19a01cd.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2350
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T06:38:43Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/AbstractZKClient.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,350
[BUG] master fault tolerance error
1. Start one master1 and two workers 2. Task setting timing, executed once every 1 minute, online timing 3. There are 3 workflow instances running on the master1 service, and the task shell_task_1 of the workflow instance is also in the "running" state. 4. Start the master2 service, the host of the workflow instance changes from master1 to master2, and the task shell_task_1 also starts fault-tolerant processing, as shown in the following figure, and finally shell_task_1 is executed 3 times: =============================================== 1.启动一台master1 , 2台worker 2.任务设置定时,1分钟执行一次,上线定时 3.有3个工作流实例在master1服务上运行,其中工作流实例的任务shell_task_1也处于“正在运行”状态 4.启动master2服务,工作流实例的host从master1变为master2,任务shell_task_1也开始容错处理,如下图所示,最终shell_task_1被执行3次: =============================================== ![image](https://user-images.githubusercontent.com/55787491/78106433-f4545180-7425-11ea-8bc6-ebcf916236f8.png) ![image](https://user-images.githubusercontent.com/55787491/78106449-fe765000-7425-11ea-8dd8-3c14ec90d4fb.png) ![image](https://user-images.githubusercontent.com/55787491/78106564-3d0c0a80-7426-11ea-956e-42b2b19a01cd.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2350
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T06:38:43Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/AbstractZKClient.java
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.service.zk; import org.apache.curator.framework.recipes.locks.InterProcessMutex; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.ZKNodeType; import org.apache.dolphinscheduler.common.model.Server; import org.apache.dolphinscheduler.common.utils.ResInfo; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import java.util.*; import static org.apache.dolphinscheduler.common.Constants.*; /** * abstract zookeeper client */ @Component public abstract class AbstractZKClient extends ZookeeperCachedOperator { private static final Logger logger = LoggerFactory.getLogger(AbstractZKClient.class); /** * remove dead server by host * @param host host * @param serverType serverType * @throws Exception */ public void removeDeadServerByHost(String host, String serverType) throws Exception { List<String> deadServers = super.getChildrenKeys(getDeadZNodeParentPath());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,350
[BUG] master fault tolerance error
1. Start one master1 and two workers 2. Task setting timing, executed once every 1 minute, online timing 3. There are 3 workflow instances running on the master1 service, and the task shell_task_1 of the workflow instance is also in the "running" state. 4. Start the master2 service, the host of the workflow instance changes from master1 to master2, and the task shell_task_1 also starts fault-tolerant processing, as shown in the following figure, and finally shell_task_1 is executed 3 times: =============================================== 1.启动一台master1 , 2台worker 2.任务设置定时,1分钟执行一次,上线定时 3.有3个工作流实例在master1服务上运行,其中工作流实例的任务shell_task_1也处于“正在运行”状态 4.启动master2服务,工作流实例的host从master1变为master2,任务shell_task_1也开始容错处理,如下图所示,最终shell_task_1被执行3次: =============================================== ![image](https://user-images.githubusercontent.com/55787491/78106433-f4545180-7425-11ea-8bc6-ebcf916236f8.png) ![image](https://user-images.githubusercontent.com/55787491/78106449-fe765000-7425-11ea-8dd8-3c14ec90d4fb.png) ![image](https://user-images.githubusercontent.com/55787491/78106564-3d0c0a80-7426-11ea-956e-42b2b19a01cd.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2350
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T06:38:43Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/AbstractZKClient.java
for(String serverPath : deadServers){ if(serverPath.startsWith(serverType+UNDERLINE+host)){ String server = getDeadZNodeParentPath() + SINGLE_SLASH + serverPath; super.remove(server); logger.info("{} server {} deleted from zk dead server path success" , serverType , host); } } } /** * opType(add): if find dead server , then add to zk deadServerPath * opType(delete): delete path from zk * * @param zNode node path * @param zkNodeType master or worker * @param opType delete or add * @throws Exception errors */ public void handleDeadServer(String zNode, ZKNodeType zkNodeType, String opType) throws Exception { String host = getHostByEventDataPath(zNode); String type = (zkNodeType == ZKNodeType.MASTER) ? MASTER_PREFIX : WORKER_PREFIX; if(opType.equals(DELETE_ZK_OP)){ removeDeadServerByHost(host, type); }else if(opType.equals(ADD_ZK_OP)){ String deadServerPath = getDeadZNodeParentPath() + SINGLE_SLASH + type + UNDERLINE + host; if(!super.isExisted(deadServerPath)){ super.persist(deadServerPath,(type + UNDERLINE + host)); logger.info("{} server dead , and {} added to zk dead server path success" , zkNodeType.toString(), zNode);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,350
[BUG] master fault tolerance error
1. Start one master1 and two workers 2. Task setting timing, executed once every 1 minute, online timing 3. There are 3 workflow instances running on the master1 service, and the task shell_task_1 of the workflow instance is also in the "running" state. 4. Start the master2 service, the host of the workflow instance changes from master1 to master2, and the task shell_task_1 also starts fault-tolerant processing, as shown in the following figure, and finally shell_task_1 is executed 3 times: =============================================== 1.启动一台master1 , 2台worker 2.任务设置定时,1分钟执行一次,上线定时 3.有3个工作流实例在master1服务上运行,其中工作流实例的任务shell_task_1也处于“正在运行”状态 4.启动master2服务,工作流实例的host从master1变为master2,任务shell_task_1也开始容错处理,如下图所示,最终shell_task_1被执行3次: =============================================== ![image](https://user-images.githubusercontent.com/55787491/78106433-f4545180-7425-11ea-8bc6-ebcf916236f8.png) ![image](https://user-images.githubusercontent.com/55787491/78106449-fe765000-7425-11ea-8dd8-3c14ec90d4fb.png) ![image](https://user-images.githubusercontent.com/55787491/78106564-3d0c0a80-7426-11ea-956e-42b2b19a01cd.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2350
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T06:38:43Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/AbstractZKClient.java
} } } /** * get active master num * @return active master number */ public int getActiveMasterNum(){ List<String> childrenList = new ArrayList<>(); try { if(super.isExisted(getZNodeParentPath(ZKNodeType.MASTER))){ childrenList = super.getChildrenKeys(getZNodeParentPath(ZKNodeType.MASTER)); } } catch (Exception e) { logger.error("getActiveMasterNum error",e); } return childrenList.size(); } /** * * @return zookeeper quorum */ public String getZookeeperQuorum(){ return getZookeeperConfig().getServerList(); } /** * get server list. * @param zkNodeType zookeeper node type * @return server list
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,350
[BUG] master fault tolerance error
1. Start one master1 and two workers 2. Task setting timing, executed once every 1 minute, online timing 3. There are 3 workflow instances running on the master1 service, and the task shell_task_1 of the workflow instance is also in the "running" state. 4. Start the master2 service, the host of the workflow instance changes from master1 to master2, and the task shell_task_1 also starts fault-tolerant processing, as shown in the following figure, and finally shell_task_1 is executed 3 times: =============================================== 1.启动一台master1 , 2台worker 2.任务设置定时,1分钟执行一次,上线定时 3.有3个工作流实例在master1服务上运行,其中工作流实例的任务shell_task_1也处于“正在运行”状态 4.启动master2服务,工作流实例的host从master1变为master2,任务shell_task_1也开始容错处理,如下图所示,最终shell_task_1被执行3次: =============================================== ![image](https://user-images.githubusercontent.com/55787491/78106433-f4545180-7425-11ea-8bc6-ebcf916236f8.png) ![image](https://user-images.githubusercontent.com/55787491/78106449-fe765000-7425-11ea-8dd8-3c14ec90d4fb.png) ![image](https://user-images.githubusercontent.com/55787491/78106564-3d0c0a80-7426-11ea-956e-42b2b19a01cd.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2350
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T06:38:43Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/AbstractZKClient.java
*/ public List<Server> getServersList(ZKNodeType zkNodeType){ Map<String, String> masterMap = getServerMaps(zkNodeType); String parentPath = getZNodeParentPath(zkNodeType); List<Server> masterServers = new ArrayList<>(); int i = 0; for (Map.Entry<String, String> entry : masterMap.entrySet()) { Server masterServer = ResInfo.parseHeartbeatForZKInfo(entry.getValue()); masterServer.setZkDirectory( parentPath + "/"+ entry.getKey()); masterServer.setId(i); i ++; masterServers.add(masterServer); } return masterServers; } /** * get master server list map. * @param zkNodeType zookeeper node type * @return result : {host : resource info} */ public Map<String, String> getServerMaps(ZKNodeType zkNodeType){ Map<String, String> masterMap = new HashMap<>(); try { String path = getZNodeParentPath(zkNodeType); List<String> serverList = super.getChildrenKeys(path); for(String server : serverList){ masterMap.putIfAbsent(server, super.get(path + "/" + server)); } } catch (Exception e) { logger.error("get server list failed", e);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,350
[BUG] master fault tolerance error
1. Start one master1 and two workers 2. Task setting timing, executed once every 1 minute, online timing 3. There are 3 workflow instances running on the master1 service, and the task shell_task_1 of the workflow instance is also in the "running" state. 4. Start the master2 service, the host of the workflow instance changes from master1 to master2, and the task shell_task_1 also starts fault-tolerant processing, as shown in the following figure, and finally shell_task_1 is executed 3 times: =============================================== 1.启动一台master1 , 2台worker 2.任务设置定时,1分钟执行一次,上线定时 3.有3个工作流实例在master1服务上运行,其中工作流实例的任务shell_task_1也处于“正在运行”状态 4.启动master2服务,工作流实例的host从master1变为master2,任务shell_task_1也开始容错处理,如下图所示,最终shell_task_1被执行3次: =============================================== ![image](https://user-images.githubusercontent.com/55787491/78106433-f4545180-7425-11ea-8bc6-ebcf916236f8.png) ![image](https://user-images.githubusercontent.com/55787491/78106449-fe765000-7425-11ea-8dd8-3c14ec90d4fb.png) ![image](https://user-images.githubusercontent.com/55787491/78106564-3d0c0a80-7426-11ea-956e-42b2b19a01cd.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2350
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T06:38:43Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/AbstractZKClient.java
} return masterMap; } /** * check the zookeeper node already exists * @param host host * @param zkNodeType zookeeper node type * @return true if exists */ public boolean checkZKNodeExists(String host, ZKNodeType zkNodeType) { String path = getZNodeParentPath(zkNodeType); if(StringUtils.isEmpty(path)){ logger.error("check zk node exists error, host:{}, zk node type:{}", host, zkNodeType.toString()); return false; } Map<String, String> serverMaps = getServerMaps(zkNodeType); for(String hostKey : serverMaps.keySet()){ if(hostKey.startsWith(host)){ return true; } } return false; } /** * * @return get worker node parent path */ protected String getWorkerZNodeParentPath(){ return getZookeeperConfig().getDsRoot() + Constants.ZOOKEEPER_DOLPHINSCHEDULER_WORKERS;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,350
[BUG] master fault tolerance error
1. Start one master1 and two workers 2. Task setting timing, executed once every 1 minute, online timing 3. There are 3 workflow instances running on the master1 service, and the task shell_task_1 of the workflow instance is also in the "running" state. 4. Start the master2 service, the host of the workflow instance changes from master1 to master2, and the task shell_task_1 also starts fault-tolerant processing, as shown in the following figure, and finally shell_task_1 is executed 3 times: =============================================== 1.启动一台master1 , 2台worker 2.任务设置定时,1分钟执行一次,上线定时 3.有3个工作流实例在master1服务上运行,其中工作流实例的任务shell_task_1也处于“正在运行”状态 4.启动master2服务,工作流实例的host从master1变为master2,任务shell_task_1也开始容错处理,如下图所示,最终shell_task_1被执行3次: =============================================== ![image](https://user-images.githubusercontent.com/55787491/78106433-f4545180-7425-11ea-8bc6-ebcf916236f8.png) ![image](https://user-images.githubusercontent.com/55787491/78106449-fe765000-7425-11ea-8dd8-3c14ec90d4fb.png) ![image](https://user-images.githubusercontent.com/55787491/78106564-3d0c0a80-7426-11ea-956e-42b2b19a01cd.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2350
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T06:38:43Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/AbstractZKClient.java
} /** * * @return get master node parent path */ protected String getMasterZNodeParentPath(){ return getZookeeperConfig().getDsRoot() + Constants.ZOOKEEPER_DOLPHINSCHEDULER_MASTERS; } /** * * @return get master lock path */ public String getMasterLockPath(){ return getZookeeperConfig().getDsRoot() + Constants.ZOOKEEPER_DOLPHINSCHEDULER_LOCK_MASTERS; } /** * * @param zkNodeType zookeeper node type * @return get zookeeper node parent path */ public String getZNodeParentPath(ZKNodeType zkNodeType) { String path = ""; switch (zkNodeType){ case MASTER: return getMasterZNodeParentPath(); case WORKER: return getWorkerZNodeParentPath(); case DEAD_SERVER: return getDeadZNodeParentPath(); default:
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,350
[BUG] master fault tolerance error
1. Start one master1 and two workers 2. Task setting timing, executed once every 1 minute, online timing 3. There are 3 workflow instances running on the master1 service, and the task shell_task_1 of the workflow instance is also in the "running" state. 4. Start the master2 service, the host of the workflow instance changes from master1 to master2, and the task shell_task_1 also starts fault-tolerant processing, as shown in the following figure, and finally shell_task_1 is executed 3 times: =============================================== 1.启动一台master1 , 2台worker 2.任务设置定时,1分钟执行一次,上线定时 3.有3个工作流实例在master1服务上运行,其中工作流实例的任务shell_task_1也处于“正在运行”状态 4.启动master2服务,工作流实例的host从master1变为master2,任务shell_task_1也开始容错处理,如下图所示,最终shell_task_1被执行3次: =============================================== ![image](https://user-images.githubusercontent.com/55787491/78106433-f4545180-7425-11ea-8bc6-ebcf916236f8.png) ![image](https://user-images.githubusercontent.com/55787491/78106449-fe765000-7425-11ea-8dd8-3c14ec90d4fb.png) ![image](https://user-images.githubusercontent.com/55787491/78106564-3d0c0a80-7426-11ea-956e-42b2b19a01cd.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2350
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T06:38:43Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/AbstractZKClient.java
break; } return path; } /** * * @return get dead server node parent path */ protected String getDeadZNodeParentPath(){ return getZookeeperConfig().getDsRoot() + Constants.ZOOKEEPER_DOLPHINSCHEDULER_DEAD_SERVERS; } /** * * @return get master start up lock path */ public String getMasterStartUpLockPath(){ return getZookeeperConfig().getDsRoot() + Constants.ZOOKEEPER_DOLPHINSCHEDULER_LOCK_FAILOVER_STARTUP_MASTERS; } /** * * @return get master failover lock path */ public String getMasterFailoverLockPath(){ return getZookeeperConfig().getDsRoot() + Constants.ZOOKEEPER_DOLPHINSCHEDULER_LOCK_FAILOVER_MASTERS; } /** * * @return get worker failover lock path */ public String getWorkerFailoverLockPath(){
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,350
[BUG] master fault tolerance error
1. Start one master1 and two workers 2. Task setting timing, executed once every 1 minute, online timing 3. There are 3 workflow instances running on the master1 service, and the task shell_task_1 of the workflow instance is also in the "running" state. 4. Start the master2 service, the host of the workflow instance changes from master1 to master2, and the task shell_task_1 also starts fault-tolerant processing, as shown in the following figure, and finally shell_task_1 is executed 3 times: =============================================== 1.启动一台master1 , 2台worker 2.任务设置定时,1分钟执行一次,上线定时 3.有3个工作流实例在master1服务上运行,其中工作流实例的任务shell_task_1也处于“正在运行”状态 4.启动master2服务,工作流实例的host从master1变为master2,任务shell_task_1也开始容错处理,如下图所示,最终shell_task_1被执行3次: =============================================== ![image](https://user-images.githubusercontent.com/55787491/78106433-f4545180-7425-11ea-8bc6-ebcf916236f8.png) ![image](https://user-images.githubusercontent.com/55787491/78106449-fe765000-7425-11ea-8dd8-3c14ec90d4fb.png) ![image](https://user-images.githubusercontent.com/55787491/78106564-3d0c0a80-7426-11ea-956e-42b2b19a01cd.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2350
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T06:38:43Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/AbstractZKClient.java
return getZookeeperConfig().getDsRoot() + Constants.ZOOKEEPER_DOLPHINSCHEDULER_LOCK_FAILOVER_WORKERS; } /** * release mutex * @param mutex mutex */ public void releaseMutex(InterProcessMutex mutex) { if (mutex != null){ try { mutex.release(); } catch (Exception e) { if(e.getMessage().equals("instance must be started before calling this method")){ logger.warn("lock release"); }else{ logger.error("lock release failed",e); } } } } /** * init system znode */ protected void initSystemZNode(){ try { persist(getMasterZNodeParentPath(), ""); persist(getWorkerZNodeParentPath(), ""); persist(getDeadZNodeParentPath(), ""); logger.info("initialize server nodes success."); } catch (Exception e) { logger.error("init system znode failed",e);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,350
[BUG] master fault tolerance error
1. Start one master1 and two workers 2. Task setting timing, executed once every 1 minute, online timing 3. There are 3 workflow instances running on the master1 service, and the task shell_task_1 of the workflow instance is also in the "running" state. 4. Start the master2 service, the host of the workflow instance changes from master1 to master2, and the task shell_task_1 also starts fault-tolerant processing, as shown in the following figure, and finally shell_task_1 is executed 3 times: =============================================== 1.启动一台master1 , 2台worker 2.任务设置定时,1分钟执行一次,上线定时 3.有3个工作流实例在master1服务上运行,其中工作流实例的任务shell_task_1也处于“正在运行”状态 4.启动master2服务,工作流实例的host从master1变为master2,任务shell_task_1也开始容错处理,如下图所示,最终shell_task_1被执行3次: =============================================== ![image](https://user-images.githubusercontent.com/55787491/78106433-f4545180-7425-11ea-8bc6-ebcf916236f8.png) ![image](https://user-images.githubusercontent.com/55787491/78106449-fe765000-7425-11ea-8dd8-3c14ec90d4fb.png) ![image](https://user-images.githubusercontent.com/55787491/78106564-3d0c0a80-7426-11ea-956e-42b2b19a01cd.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2350
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T06:38:43Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/AbstractZKClient.java
} } /** * get host ip, string format: masterParentPath/ip * @param path path * @return host ip, string format: masterParentPath/ip */ protected String getHostByEventDataPath(String path) { if(StringUtils.isEmpty(path)){ logger.error("empty path!"); return ""; } String[] pathArray = path.split(SINGLE_SLASH); if(pathArray.length < 1){ logger.error("parse ip error: {}", path); return ""; } return pathArray[pathArray.length - 1]; } @Override public String toString() { return "AbstractZKClient{" + "zkClient=" + zkClient + ", deadServerZNodeParentPath='" + getZNodeParentPath(ZKNodeType.DEAD_SERVER) + '\'' + ", masterZNodeParentPath='" + getZNodeParentPath(ZKNodeType.MASTER) + '\'' + ", workerZNodeParentPath='" + getZNodeParentPath(ZKNodeType.WORKER) + '\'' + '}'; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,349
[BUG]Visit the worker page of the monitoring center, a null pointer occur
![image](https://user-images.githubusercontent.com/55787491/78097549-2a3a0b80-740f-11ea-8302-5c63fa1b79dc.png) ![image](https://user-images.githubusercontent.com/55787491/78097589-3faf3580-740f-11ea-82d2-4249cef0e876.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2349
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T03:53:07Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,349
[BUG]Visit the worker page of the monitoring center, a null pointer occur
![image](https://user-images.githubusercontent.com/55787491/78097549-2a3a0b80-740f-11ea-8302-5c63fa1b79dc.png) ![image](https://user-images.githubusercontent.com/55787491/78097589-3faf3580-740f-11ea-82d2-4249cef0e876.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2349
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T03:53:07Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java
* limitations under the License. */ package org.apache.dolphinscheduler.server.zk; import org.apache.commons.lang.StringUtils; import org.apache.curator.framework.CuratorFramework; import org.apache.curator.framework.recipes.cache.TreeCacheEvent; import org.apache.curator.framework.recipes.locks.InterProcessMutex; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.enums.ZKNodeType; import org.apache.dolphinscheduler.common.model.Server; import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.server.builder.TaskExecutionContextBuilder; import org.apache.dolphinscheduler.server.entity.TaskExecutionContext; import org.apache.dolphinscheduler.server.utils.ProcessUtils; import org.apache.dolphinscheduler.service.process.ProcessService; import org.apache.dolphinscheduler.service.zk.AbstractZKClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.Date; import java.util.List; /** * zookeeper master client * * single instance */ @Component
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,349
[BUG]Visit the worker page of the monitoring center, a null pointer occur
![image](https://user-images.githubusercontent.com/55787491/78097549-2a3a0b80-740f-11ea-8302-5c63fa1b79dc.png) ![image](https://user-images.githubusercontent.com/55787491/78097589-3faf3580-740f-11ea-82d2-4249cef0e876.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2349
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T03:53:07Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java
public class ZKMasterClient extends AbstractZKClient { /** * logger */ private static final Logger logger = LoggerFactory.getLogger(ZKMasterClient.class); /** * process service */ @Autowired private ProcessService processService; public void start() { InterProcessMutex mutex = null; try { String znodeLock = getMasterStartUpLockPath(); mutex = new InterProcessMutex(getZkClient(), znodeLock); mutex.acquire(); this.initSystemZNode();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,349
[BUG]Visit the worker page of the monitoring center, a null pointer occur
![image](https://user-images.githubusercontent.com/55787491/78097549-2a3a0b80-740f-11ea-8302-5c63fa1b79dc.png) ![image](https://user-images.githubusercontent.com/55787491/78097589-3faf3580-740f-11ea-82d2-4249cef0e876.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2349
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T03:53:07Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java
if (getActiveMasterNum() == 1) { failoverWorker(null, true); failoverMaster(null); } }catch (Exception e){ logger.error("master start up exception",e); }finally { releaseMutex(mutex); } } @Override public void close(){ super.close(); } /** * handle path events that this class cares about * @param client zkClient * @param event path event * @param path zk path */ @Override protected void dataChanged(CuratorFramework client, TreeCacheEvent event, String path) { if(path.startsWith(getZNodeParentPath(ZKNodeType.MASTER)+Constants.SINGLE_SLASH)){ handleMasterEvent(event,path); }else if(path.startsWith(getZNodeParentPath(ZKNodeType.WORKER)+Constants.SINGLE_SLASH)){ handleWorkerEvent(event,path); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,349
[BUG]Visit the worker page of the monitoring center, a null pointer occur
![image](https://user-images.githubusercontent.com/55787491/78097549-2a3a0b80-740f-11ea-8302-5c63fa1b79dc.png) ![image](https://user-images.githubusercontent.com/55787491/78097589-3faf3580-740f-11ea-82d2-4249cef0e876.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2349
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T03:53:07Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java
/** * remove zookeeper node path * * @param path zookeeper node path * @param zkNodeType zookeeper node type * @param failover is failover */ private void removeZKNodePath(String path, ZKNodeType zkNodeType, boolean failover) { logger.info("{} node deleted : {}", zkNodeType.toString(), path); InterProcessMutex mutex = null; try { String failoverPath = getFailoverLockPath(zkNodeType); mutex = new InterProcessMutex(getZkClient(), failoverPath); mutex.acquire(); String serverHost = getHostByEventDataPath(path); handleDeadServer(path, zkNodeType, Constants.ADD_ZK_OP); if(failover){ failoverServerWhenDown(serverHost, zkNodeType); } }catch (Exception e){ logger.error("{} server failover failed.", zkNodeType.toString()); logger.error("failover exception ",e); } finally { releaseMutex(mutex); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,349
[BUG]Visit the worker page of the monitoring center, a null pointer occur
![image](https://user-images.githubusercontent.com/55787491/78097549-2a3a0b80-740f-11ea-8302-5c63fa1b79dc.png) ![image](https://user-images.githubusercontent.com/55787491/78097589-3faf3580-740f-11ea-82d2-4249cef0e876.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2349
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T03:53:07Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java
/** * failover server when server down * * @param serverHost server host * @param zkNodeType zookeeper node type * @throws Exception exception */ private void failoverServerWhenDown(String serverHost, ZKNodeType zkNodeType) throws Exception { if(StringUtils.isEmpty(serverHost)){ return ; } switch (zkNodeType){ case MASTER: failoverMaster(serverHost); break; case WORKER: failoverWorker(serverHost, true); default: break; } } /** * get failover lock path * * @param zkNodeType zookeeper node type * @return fail over lock path */ private String getFailoverLockPath(ZKNodeType zkNodeType){ switch (zkNodeType){ case MASTER:
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,349
[BUG]Visit the worker page of the monitoring center, a null pointer occur
![image](https://user-images.githubusercontent.com/55787491/78097549-2a3a0b80-740f-11ea-8302-5c63fa1b79dc.png) ![image](https://user-images.githubusercontent.com/55787491/78097589-3faf3580-740f-11ea-82d2-4249cef0e876.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2349
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T03:53:07Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java
return getMasterFailoverLockPath(); case WORKER: return getWorkerFailoverLockPath(); default: return ""; } } /** * monitor master * @param event event * @param path path */ public void handleMasterEvent(TreeCacheEvent event, String path){ switch (event.getType()) { case NODE_ADDED: logger.info("master node added : {}", path); break; case NODE_REMOVED: removeZKNodePath(path, ZKNodeType.MASTER, true); break; default: break; } } /** * monitor worker * @param event event * @param path path */ public void handleWorkerEvent(TreeCacheEvent event, String path){
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,349
[BUG]Visit the worker page of the monitoring center, a null pointer occur
![image](https://user-images.githubusercontent.com/55787491/78097549-2a3a0b80-740f-11ea-8302-5c63fa1b79dc.png) ![image](https://user-images.githubusercontent.com/55787491/78097589-3faf3580-740f-11ea-82d2-4249cef0e876.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2349
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T03:53:07Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java
switch (event.getType()) { case NODE_ADDED: logger.info("worker node added : {}", path); break; case NODE_REMOVED: logger.info("worker node deleted : {}", path); removeZKNodePath(path, ZKNodeType.WORKER, true); break; default: break; } } /** * task needs failover if task start before worker starts * * @param taskInstance task instance * @return true if task instance need fail over */ private boolean checkTaskInstanceNeedFailover(TaskInstance taskInstance) throws Exception { boolean taskNeedFailover = true; if(taskInstance.getHost() == null){ return false; } if(checkZKNodeExists(taskInstance.getHost(), ZKNodeType.WORKER)){ if(checkTaskAfterWorkerStart(taskInstance)){ taskNeedFailover = false; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,349
[BUG]Visit the worker page of the monitoring center, a null pointer occur
![image](https://user-images.githubusercontent.com/55787491/78097549-2a3a0b80-740f-11ea-8302-5c63fa1b79dc.png) ![image](https://user-images.githubusercontent.com/55787491/78097589-3faf3580-740f-11ea-82d2-4249cef0e876.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2349
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T03:53:07Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java
} return taskNeedFailover; } /** * check task start after the worker server starts. * * @param taskInstance task instance * @return true if task instance start time after worker server start date */ private boolean checkTaskAfterWorkerStart(TaskInstance taskInstance) { if(StringUtils.isEmpty(taskInstance.getHost())){ return false; } Date workerServerStartDate = null; List<Server> workerServers = getServersList(ZKNodeType.WORKER); for(Server workerServer : workerServers){ if(workerServer.getHost().equals(taskInstance.getHost())){ workerServerStartDate = workerServer.getCreateTime(); break; } } if(workerServerStartDate != null){ return taskInstance.getStartTime().after(workerServerStartDate); }else{ return false; } } /** * failover worker tasks *
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,349
[BUG]Visit the worker page of the monitoring center, a null pointer occur
![image](https://user-images.githubusercontent.com/55787491/78097549-2a3a0b80-740f-11ea-8302-5c63fa1b79dc.png) ![image](https://user-images.githubusercontent.com/55787491/78097589-3faf3580-740f-11ea-82d2-4249cef0e876.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2349
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T03:53:07Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java
* 1. kill yarn job if there are yarn jobs in tasks. * 2. change task state from running to need failover. * 3. failover all tasks when workerHost is null * @param workerHost worker host */ /** * failover worker tasks * * 1. kill yarn job if there are yarn jobs in tasks. * 2. change task state from running to need failover. * 3. failover all tasks when workerHost is null * @param workerHost worker host * @param needCheckWorkerAlive need check worker alive * @throws Exception exception */ private void failoverWorker(String workerHost, boolean needCheckWorkerAlive) throws Exception { logger.info("start worker[{}] failover ...", workerHost); List<TaskInstance> needFailoverTaskInstanceList = processService.queryNeedFailoverTaskInstances(workerHost); for(TaskInstance taskInstance : needFailoverTaskInstanceList){ if(needCheckWorkerAlive){ if(!checkTaskInstanceNeedFailover(taskInstance)){ continue; } } ProcessInstance processInstance = processService.findProcessInstanceDetailById(taskInstance.getProcessInstanceId()); if(processInstance != null){ taskInstance.setProcessInstance(processInstance); } TaskExecutionContext taskExecutionContext = TaskExecutionContextBuilder.get() .buildTaskInstanceRelatedInfo(taskInstance)
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,349
[BUG]Visit the worker page of the monitoring center, a null pointer occur
![image](https://user-images.githubusercontent.com/55787491/78097549-2a3a0b80-740f-11ea-8302-5c63fa1b79dc.png) ![image](https://user-images.githubusercontent.com/55787491/78097589-3faf3580-740f-11ea-82d2-4249cef0e876.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2349
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T03:53:07Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java
.buildProcessInstanceRelatedInfo(processInstance) .create(); ProcessUtils.killYarnJob(taskExecutionContext); taskInstance.setState(ExecutionStatus.NEED_FAULT_TOLERANCE); processService.saveTaskInstance(taskInstance); } logger.info("end worker[{}] failover ...", workerHost); } /** * failover master tasks * * @param masterHost master host */ private void failoverMaster(String masterHost) { logger.info("start master failover ..."); List<ProcessInstance> needFailoverProcessInstanceList = processService.queryNeedFailoverProcessInstances(masterHost); for(ProcessInstance processInstance : needFailoverProcessInstanceList){ processService.processNeedFailoverProcessInstances(processInstance); } logger.info("master failover end"); } public InterProcessMutex blockAcquireMutex() throws Exception { InterProcessMutex mutex = new InterProcessMutex(getZkClient(), getMasterLockPath()); mutex.acquire(); return mutex; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,349
[BUG]Visit the worker page of the monitoring center, a null pointer occur
![image](https://user-images.githubusercontent.com/55787491/78097549-2a3a0b80-740f-11ea-8302-5c63fa1b79dc.png) ![image](https://user-images.githubusercontent.com/55787491/78097589-3faf3580-740f-11ea-82d2-4249cef0e876.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2349
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T03:53:07Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/AbstractZKClient.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,349
[BUG]Visit the worker page of the monitoring center, a null pointer occur
![image](https://user-images.githubusercontent.com/55787491/78097549-2a3a0b80-740f-11ea-8302-5c63fa1b79dc.png) ![image](https://user-images.githubusercontent.com/55787491/78097589-3faf3580-740f-11ea-82d2-4249cef0e876.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2349
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T03:53:07Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/AbstractZKClient.java
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.service.zk; import org.apache.curator.framework.recipes.locks.InterProcessMutex; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.ZKNodeType; import org.apache.dolphinscheduler.common.model.Server; import org.apache.dolphinscheduler.common.utils.ResInfo; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import java.util.*; import static org.apache.dolphinscheduler.common.Constants.*; /** * abstract zookeeper client */ @Component public abstract class AbstractZKClient extends ZookeeperCachedOperator { private static final Logger logger = LoggerFactory.getLogger(AbstractZKClient.class); /** * remove dead server by host * @param host host * @param serverType serverType * @throws Exception */ public void removeDeadServerByHost(String host, String serverType) throws Exception { List<String> deadServers = super.getChildrenKeys(getDeadZNodeParentPath());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,349
[BUG]Visit the worker page of the monitoring center, a null pointer occur
![image](https://user-images.githubusercontent.com/55787491/78097549-2a3a0b80-740f-11ea-8302-5c63fa1b79dc.png) ![image](https://user-images.githubusercontent.com/55787491/78097589-3faf3580-740f-11ea-82d2-4249cef0e876.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2349
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T03:53:07Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/AbstractZKClient.java
for(String serverPath : deadServers){ if(serverPath.startsWith(serverType+UNDERLINE+host)){ String server = getDeadZNodeParentPath() + SINGLE_SLASH + serverPath; super.remove(server); logger.info("{} server {} deleted from zk dead server path success" , serverType , host); } } } /** * opType(add): if find dead server , then add to zk deadServerPath * opType(delete): delete path from zk * * @param zNode node path * @param zkNodeType master or worker * @param opType delete or add * @throws Exception errors */ public void handleDeadServer(String zNode, ZKNodeType zkNodeType, String opType) throws Exception { String host = getHostByEventDataPath(zNode); String type = (zkNodeType == ZKNodeType.MASTER) ? MASTER_PREFIX : WORKER_PREFIX; if(opType.equals(DELETE_ZK_OP)){ removeDeadServerByHost(host, type); }else if(opType.equals(ADD_ZK_OP)){ String deadServerPath = getDeadZNodeParentPath() + SINGLE_SLASH + type + UNDERLINE + host; if(!super.isExisted(deadServerPath)){ super.persist(deadServerPath,(type + UNDERLINE + host)); logger.info("{} server dead , and {} added to zk dead server path success" , zkNodeType.toString(), zNode);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,349
[BUG]Visit the worker page of the monitoring center, a null pointer occur
![image](https://user-images.githubusercontent.com/55787491/78097549-2a3a0b80-740f-11ea-8302-5c63fa1b79dc.png) ![image](https://user-images.githubusercontent.com/55787491/78097589-3faf3580-740f-11ea-82d2-4249cef0e876.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2349
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T03:53:07Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/AbstractZKClient.java
} } } /** * get active master num * @return active master number */ public int getActiveMasterNum(){ List<String> childrenList = new ArrayList<>(); try { if(super.isExisted(getZNodeParentPath(ZKNodeType.MASTER))){ childrenList = super.getChildrenKeys(getZNodeParentPath(ZKNodeType.MASTER)); } } catch (Exception e) { logger.error("getActiveMasterNum error",e); } return childrenList.size(); } /** * * @return zookeeper quorum */ public String getZookeeperQuorum(){ return getZookeeperConfig().getServerList(); } /** * get server list. * @param zkNodeType zookeeper node type * @return server list
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,349
[BUG]Visit the worker page of the monitoring center, a null pointer occur
![image](https://user-images.githubusercontent.com/55787491/78097549-2a3a0b80-740f-11ea-8302-5c63fa1b79dc.png) ![image](https://user-images.githubusercontent.com/55787491/78097589-3faf3580-740f-11ea-82d2-4249cef0e876.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2349
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T03:53:07Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/AbstractZKClient.java
*/ public List<Server> getServersList(ZKNodeType zkNodeType){ Map<String, String> masterMap = getServerMaps(zkNodeType); String parentPath = getZNodeParentPath(zkNodeType); List<Server> masterServers = new ArrayList<>(); int i = 0; for (Map.Entry<String, String> entry : masterMap.entrySet()) { Server masterServer = ResInfo.parseHeartbeatForZKInfo(entry.getValue()); masterServer.setZkDirectory( parentPath + "/"+ entry.getKey()); masterServer.setId(i); i ++; masterServers.add(masterServer); } return masterServers; } /** * get master server list map. * @param zkNodeType zookeeper node type * @return result : {host : resource info} */ public Map<String, String> getServerMaps(ZKNodeType zkNodeType){ Map<String, String> masterMap = new HashMap<>(); try { String path = getZNodeParentPath(zkNodeType); List<String> serverList = super.getChildrenKeys(path); for(String server : serverList){ masterMap.putIfAbsent(server, super.get(path + "/" + server)); } } catch (Exception e) { logger.error("get server list failed", e);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,349
[BUG]Visit the worker page of the monitoring center, a null pointer occur
![image](https://user-images.githubusercontent.com/55787491/78097549-2a3a0b80-740f-11ea-8302-5c63fa1b79dc.png) ![image](https://user-images.githubusercontent.com/55787491/78097589-3faf3580-740f-11ea-82d2-4249cef0e876.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2349
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T03:53:07Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/AbstractZKClient.java
} return masterMap; } /** * check the zookeeper node already exists * @param host host * @param zkNodeType zookeeper node type * @return true if exists */ public boolean checkZKNodeExists(String host, ZKNodeType zkNodeType) { String path = getZNodeParentPath(zkNodeType); if(StringUtils.isEmpty(path)){ logger.error("check zk node exists error, host:{}, zk node type:{}", host, zkNodeType.toString()); return false; } Map<String, String> serverMaps = getServerMaps(zkNodeType); for(String hostKey : serverMaps.keySet()){ if(hostKey.startsWith(host)){ return true; } } return false; } /** * * @return get worker node parent path */ protected String getWorkerZNodeParentPath(){ return getZookeeperConfig().getDsRoot() + Constants.ZOOKEEPER_DOLPHINSCHEDULER_WORKERS;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,349
[BUG]Visit the worker page of the monitoring center, a null pointer occur
![image](https://user-images.githubusercontent.com/55787491/78097549-2a3a0b80-740f-11ea-8302-5c63fa1b79dc.png) ![image](https://user-images.githubusercontent.com/55787491/78097589-3faf3580-740f-11ea-82d2-4249cef0e876.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2349
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T03:53:07Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/AbstractZKClient.java
} /** * * @return get master node parent path */ protected String getMasterZNodeParentPath(){ return getZookeeperConfig().getDsRoot() + Constants.ZOOKEEPER_DOLPHINSCHEDULER_MASTERS; } /** * * @return get master lock path */ public String getMasterLockPath(){ return getZookeeperConfig().getDsRoot() + Constants.ZOOKEEPER_DOLPHINSCHEDULER_LOCK_MASTERS; } /** * * @param zkNodeType zookeeper node type * @return get zookeeper node parent path */ public String getZNodeParentPath(ZKNodeType zkNodeType) { String path = ""; switch (zkNodeType){ case MASTER: return getMasterZNodeParentPath(); case WORKER: return getWorkerZNodeParentPath(); case DEAD_SERVER: return getDeadZNodeParentPath(); default:
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,349
[BUG]Visit the worker page of the monitoring center, a null pointer occur
![image](https://user-images.githubusercontent.com/55787491/78097549-2a3a0b80-740f-11ea-8302-5c63fa1b79dc.png) ![image](https://user-images.githubusercontent.com/55787491/78097589-3faf3580-740f-11ea-82d2-4249cef0e876.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2349
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T03:53:07Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/AbstractZKClient.java
break; } return path; } /** * * @return get dead server node parent path */ protected String getDeadZNodeParentPath(){ return getZookeeperConfig().getDsRoot() + Constants.ZOOKEEPER_DOLPHINSCHEDULER_DEAD_SERVERS; } /** * * @return get master start up lock path */ public String getMasterStartUpLockPath(){ return getZookeeperConfig().getDsRoot() + Constants.ZOOKEEPER_DOLPHINSCHEDULER_LOCK_FAILOVER_STARTUP_MASTERS; } /** * * @return get master failover lock path */ public String getMasterFailoverLockPath(){ return getZookeeperConfig().getDsRoot() + Constants.ZOOKEEPER_DOLPHINSCHEDULER_LOCK_FAILOVER_MASTERS; } /** * * @return get worker failover lock path */ public String getWorkerFailoverLockPath(){
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,349
[BUG]Visit the worker page of the monitoring center, a null pointer occur
![image](https://user-images.githubusercontent.com/55787491/78097549-2a3a0b80-740f-11ea-8302-5c63fa1b79dc.png) ![image](https://user-images.githubusercontent.com/55787491/78097589-3faf3580-740f-11ea-82d2-4249cef0e876.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2349
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T03:53:07Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/AbstractZKClient.java
return getZookeeperConfig().getDsRoot() + Constants.ZOOKEEPER_DOLPHINSCHEDULER_LOCK_FAILOVER_WORKERS; } /** * release mutex * @param mutex mutex */ public void releaseMutex(InterProcessMutex mutex) { if (mutex != null){ try { mutex.release(); } catch (Exception e) { if(e.getMessage().equals("instance must be started before calling this method")){ logger.warn("lock release"); }else{ logger.error("lock release failed",e); } } } } /** * init system znode */ protected void initSystemZNode(){ try { persist(getMasterZNodeParentPath(), ""); persist(getWorkerZNodeParentPath(), ""); persist(getDeadZNodeParentPath(), ""); logger.info("initialize server nodes success."); } catch (Exception e) { logger.error("init system znode failed",e);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,349
[BUG]Visit the worker page of the monitoring center, a null pointer occur
![image](https://user-images.githubusercontent.com/55787491/78097549-2a3a0b80-740f-11ea-8302-5c63fa1b79dc.png) ![image](https://user-images.githubusercontent.com/55787491/78097589-3faf3580-740f-11ea-82d2-4249cef0e876.png) **Which version of Dolphin Scheduler:** -[refactor-worker]
https://github.com/apache/dolphinscheduler/issues/2349
https://github.com/apache/dolphinscheduler/pull/2375
c9620ab557ec4c8d0bef1c87c93348b238a7bd8e
785c34bc66b04dbccbd64639850dc44d67957aba
"2020-04-01T03:53:07Z"
java
"2020-04-07T08:23:31Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/AbstractZKClient.java
} } /** * get host ip, string format: masterParentPath/ip * @param path path * @return host ip, string format: masterParentPath/ip */ protected String getHostByEventDataPath(String path) { if(StringUtils.isEmpty(path)){ logger.error("empty path!"); return ""; } String[] pathArray = path.split(SINGLE_SLASH); if(pathArray.length < 1){ logger.error("parse ip error: {}", path); return ""; } return pathArray[pathArray.length - 1]; } @Override public String toString() { return "AbstractZKClient{" + "zkClient=" + zkClient + ", deadServerZNodeParentPath='" + getZNodeParentPath(ZKNodeType.DEAD_SERVER) + '\'' + ", masterZNodeParentPath='" + getZNodeParentPath(ZKNodeType.MASTER) + '\'' + ", workerZNodeParentPath='" + getZNodeParentPath(ZKNodeType.WORKER) + '\'' + '}'; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,450
[BUG] cannot complement data for one day
cannot complement data for one day. ![image](https://user-images.githubusercontent.com/29528966/79549206-443f4380-80c9-11ea-9ec9-678b65095969.png)
https://github.com/apache/dolphinscheduler/issues/2450
https://github.com/apache/dolphinscheduler/pull/2493
2f5427ca33b8e929d58412699699141191c640b4
b5fdce4164385f1df2ddb25c9441b50ea28ce681
"2020-04-17T08:35:59Z"
java
"2020-04-23T02:23:32Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,450
[BUG] cannot complement data for one day
cannot complement data for one day. ![image](https://user-images.githubusercontent.com/29528966/79549206-443f4380-80c9-11ea-9ec9-678b65095969.png)
https://github.com/apache/dolphinscheduler/issues/2450
https://github.com/apache/dolphinscheduler/pull/2493
2f5427ca33b8e929d58412699699141191c640b4
b5fdce4164385f1df2ddb25c9441b50ea28ce681
"2020-04-17T08:35:59Z"
java
"2020-04-23T02:23:32Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.api.service; import org.apache.dolphinscheduler.api.enums.ExecuteType; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.*; import org.apache.dolphinscheduler.common.utils.CollectionUtils; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.apache.dolphinscheduler.dao.entity.*; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessInstanceMapper; import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; import org.apache.dolphinscheduler.service.process.ProcessService; import org.apache.dolphinscheduler.service.quartz.cron.CronUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.text.ParseException; import java.util.*; import static org.apache.dolphinscheduler.common.Constants.*; /** * executor service */ @Service
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,450
[BUG] cannot complement data for one day
cannot complement data for one day. ![image](https://user-images.githubusercontent.com/29528966/79549206-443f4380-80c9-11ea-9ec9-678b65095969.png)
https://github.com/apache/dolphinscheduler/issues/2450
https://github.com/apache/dolphinscheduler/pull/2493
2f5427ca33b8e929d58412699699141191c640b4
b5fdce4164385f1df2ddb25c9441b50ea28ce681
"2020-04-17T08:35:59Z"
java
"2020-04-23T02:23:32Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java
public class ExecutorService extends BaseService{ private static final Logger logger = LoggerFactory.getLogger(ExecutorService.class); @Autowired private ProjectMapper projectMapper; @Autowired private ProjectService projectService; @Autowired private ProcessDefinitionMapper processDefinitionMapper; @Autowired private ProcessDefinitionService processDefinitionService; @Autowired private ProcessInstanceMapper processInstanceMapper; @Autowired private ProcessService processService; /** * execute process instance * * @param loginUser login user * @param projectName project name * @param processDefinitionId process Definition Id * @param cronTime cron time * @param commandType command type
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,450
[BUG] cannot complement data for one day
cannot complement data for one day. ![image](https://user-images.githubusercontent.com/29528966/79549206-443f4380-80c9-11ea-9ec9-678b65095969.png)
https://github.com/apache/dolphinscheduler/issues/2450
https://github.com/apache/dolphinscheduler/pull/2493
2f5427ca33b8e929d58412699699141191c640b4
b5fdce4164385f1df2ddb25c9441b50ea28ce681
"2020-04-17T08:35:59Z"
java
"2020-04-23T02:23:32Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java
* @param failureStrategy failuer strategy * @param startNodeList start nodelist * @param taskDependType node dependency type * @param warningType warning type * @param warningGroupId notify group id * @param receivers receivers * @param receiversCc receivers cc * @param processInstancePriority process instance priority * @param workerGroup worker group name * @param runMode run mode * @param timeout timeout * @return execute process instance code * @throws ParseException Parse Exception */ public Map<String, Object> execProcessInstance(User loginUser, String projectName, int processDefinitionId, String cronTime, CommandType commandType, FailureStrategy failureStrategy, String startNodeList, TaskDependType taskDependType, WarningType warningType, int warningGroupId, String receivers, String receiversCc, RunMode runMode, Priority processInstancePriority, String workerGroup, Integer timeout) throws ParseException { Map<String, Object> result = new HashMap<>(5); if (timeout <= 0 || timeout > MAX_TASK_TIMEOUT) { putMsg(result,Status.TASK_TIMEOUT_PARAMS_ERROR); return result; } Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResultAndAuth = checkResultAndAuth(loginUser, projectName, project); if (checkResultAndAuth != null){ return checkResultAndAuth;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,450
[BUG] cannot complement data for one day
cannot complement data for one day. ![image](https://user-images.githubusercontent.com/29528966/79549206-443f4380-80c9-11ea-9ec9-678b65095969.png)
https://github.com/apache/dolphinscheduler/issues/2450
https://github.com/apache/dolphinscheduler/pull/2493
2f5427ca33b8e929d58412699699141191c640b4
b5fdce4164385f1df2ddb25c9441b50ea28ce681
"2020-04-17T08:35:59Z"
java
"2020-04-23T02:23:32Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java
} ProcessDefinition processDefinition = processDefinitionMapper.selectById(processDefinitionId); result = checkProcessDefinitionValid(processDefinition, processDefinitionId); if(result.get(Constants.STATUS) != Status.SUCCESS){ return result; } if (!checkTenantSuitable(processDefinition)){ logger.error("there is not any valid tenant for the process definition: id:{},name:{}, ", processDefinition.getId(), processDefinition.getName()); putMsg(result, Status.TENANT_NOT_SUITABLE); return result; } /** * create command */ int create = this.createCommand(commandType, processDefinitionId, taskDependType, failureStrategy, startNodeList, cronTime, warningType, loginUser.getId(), warningGroupId, runMode,processInstancePriority, workerGroup); if(create > 0 ){ /** * according to the process definition ID updateProcessInstance and CC recipient */ processDefinition.setReceivers(receivers); processDefinition.setReceiversCc(receiversCc); processDefinitionMapper.updateById(processDefinition); putMsg(result, Status.SUCCESS); } else { putMsg(result, Status.START_PROCESS_INSTANCE_ERROR); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,450
[BUG] cannot complement data for one day
cannot complement data for one day. ![image](https://user-images.githubusercontent.com/29528966/79549206-443f4380-80c9-11ea-9ec9-678b65095969.png)
https://github.com/apache/dolphinscheduler/issues/2450
https://github.com/apache/dolphinscheduler/pull/2493
2f5427ca33b8e929d58412699699141191c640b4
b5fdce4164385f1df2ddb25c9441b50ea28ce681
"2020-04-17T08:35:59Z"
java
"2020-04-23T02:23:32Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java
return result; } /** * check whether the process definition can be executed * * @param processDefinition process definition * @param processDefineId process definition id * @return check result code */ public Map<String, Object> checkProcessDefinitionValid(ProcessDefinition processDefinition, int processDefineId){ Map<String, Object> result = new HashMap<>(5); if (processDefinition == null) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST,processDefineId); } else if (processDefinition.getReleaseState() != ReleaseState.ONLINE) { putMsg(result, Status.PROCESS_DEFINE_NOT_RELEASE,processDefineId); }else{ result.put(Constants.STATUS, Status.SUCCESS); } return result; } /** * do action to process instance:pause, stop, repeat, recover from pause, recover from stop * * @param loginUser login user * @param projectName project name * @param processInstanceId process instance id * @param executeType execute type * @return execute result code
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,450
[BUG] cannot complement data for one day
cannot complement data for one day. ![image](https://user-images.githubusercontent.com/29528966/79549206-443f4380-80c9-11ea-9ec9-678b65095969.png)
https://github.com/apache/dolphinscheduler/issues/2450
https://github.com/apache/dolphinscheduler/pull/2493
2f5427ca33b8e929d58412699699141191c640b4
b5fdce4164385f1df2ddb25c9441b50ea28ce681
"2020-04-17T08:35:59Z"
java
"2020-04-23T02:23:32Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java
*/ public Map<String, Object> execute(User loginUser, String projectName, Integer processInstanceId, ExecuteType executeType) { Map<String, Object> result = new HashMap<>(5); Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResult = checkResultAndAuth(loginUser, projectName, project); if (checkResult != null) { return checkResult; } ProcessInstance processInstance = processService.findProcessInstanceDetailById(processInstanceId); if (processInstance == null) { putMsg(result, Status.PROCESS_INSTANCE_NOT_EXIST, processInstanceId); return result; } ProcessDefinition processDefinition = processService.findProcessDefineById(processInstance.getProcessDefinitionId()); if(executeType != ExecuteType.STOP && executeType != ExecuteType.PAUSE){ result = checkProcessDefinitionValid(processDefinition, processInstance.getProcessDefinitionId()); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } } checkResult = checkExecuteType(processInstance, executeType); Status status = (Status) checkResult.get(Constants.STATUS); if (status != Status.SUCCESS) { return checkResult; } if (!checkTenantSuitable(processDefinition)){ logger.error("there is not any valid tenant for the process definition: id:{},name:{}, ", processDefinition.getId(), processDefinition.getName()); putMsg(result, Status.TENANT_NOT_SUITABLE); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,450
[BUG] cannot complement data for one day
cannot complement data for one day. ![image](https://user-images.githubusercontent.com/29528966/79549206-443f4380-80c9-11ea-9ec9-678b65095969.png)
https://github.com/apache/dolphinscheduler/issues/2450
https://github.com/apache/dolphinscheduler/pull/2493
2f5427ca33b8e929d58412699699141191c640b4
b5fdce4164385f1df2ddb25c9441b50ea28ce681
"2020-04-17T08:35:59Z"
java
"2020-04-23T02:23:32Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java
switch (executeType) { case REPEAT_RUNNING: result = insertCommand(loginUser, processInstanceId, processDefinition.getId(), CommandType.REPEAT_RUNNING); break; case RECOVER_SUSPENDED_PROCESS: result = insertCommand(loginUser, processInstanceId, processDefinition.getId(), CommandType.RECOVER_SUSPENDED_PROCESS); break; case START_FAILURE_TASK_PROCESS: result = insertCommand(loginUser, processInstanceId, processDefinition.getId(), CommandType.START_FAILURE_TASK_PROCESS); break; case STOP: if (processInstance.getState() == ExecutionStatus.READY_STOP) { putMsg(result, Status.PROCESS_INSTANCE_ALREADY_CHANGED, processInstance.getName(), processInstance.getState()); } else { result = updateProcessInstancePrepare(processInstance, CommandType.STOP, ExecutionStatus.READY_STOP); } break; case PAUSE: if (processInstance.getState() == ExecutionStatus.READY_PAUSE) { putMsg(result, Status.PROCESS_INSTANCE_ALREADY_CHANGED, processInstance.getName(), processInstance.getState()); } else { result = updateProcessInstancePrepare(processInstance, CommandType.PAUSE, ExecutionStatus.READY_PAUSE); } break; default: logger.error("unknown execute type : {}", executeType); putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, "unknown execute type"); break; } return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,450
[BUG] cannot complement data for one day
cannot complement data for one day. ![image](https://user-images.githubusercontent.com/29528966/79549206-443f4380-80c9-11ea-9ec9-678b65095969.png)
https://github.com/apache/dolphinscheduler/issues/2450
https://github.com/apache/dolphinscheduler/pull/2493
2f5427ca33b8e929d58412699699141191c640b4
b5fdce4164385f1df2ddb25c9441b50ea28ce681
"2020-04-17T08:35:59Z"
java
"2020-04-23T02:23:32Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java
} /** * check tenant suitable * @param processDefinition process definition * @return true if tenant suitable, otherwise return false */ private boolean checkTenantSuitable(ProcessDefinition processDefinition) { // Tenant tenant = processService.getTenantForProcess(processDefinition.getTenantId(), processDefinition.getUserId()); return tenant != null; } /** * Check the state of process instance and the type of operation match * * @param processInstance process instance * @param executeType execute type * @return check result code */ private Map<String, Object> checkExecuteType(ProcessInstance processInstance, ExecuteType executeType) { Map<String, Object> result = new HashMap<>(5); ExecutionStatus executionStatus = processInstance.getState(); boolean checkResult = false; switch (executeType) { case PAUSE: case STOP: if (executionStatus.typeIsRunning()) { checkResult = true; } break;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,450
[BUG] cannot complement data for one day
cannot complement data for one day. ![image](https://user-images.githubusercontent.com/29528966/79549206-443f4380-80c9-11ea-9ec9-678b65095969.png)
https://github.com/apache/dolphinscheduler/issues/2450
https://github.com/apache/dolphinscheduler/pull/2493
2f5427ca33b8e929d58412699699141191c640b4
b5fdce4164385f1df2ddb25c9441b50ea28ce681
"2020-04-17T08:35:59Z"
java
"2020-04-23T02:23:32Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java
case REPEAT_RUNNING: if (executionStatus.typeIsFinished()) { checkResult = true; } break; case START_FAILURE_TASK_PROCESS: if (executionStatus.typeIsFailure()) { checkResult = true; } break; case RECOVER_SUSPENDED_PROCESS: if (executionStatus.typeIsPause()|| executionStatus.typeIsCancel()) { checkResult = true; } break; default: break; } if (!checkResult) { putMsg(result,Status.PROCESS_INSTANCE_STATE_OPERATION_ERROR, processInstance.getName(), executionStatus.toString(), executeType.toString()); } else { putMsg(result, Status.SUCCESS); } return result; } /** * prepare to update process instance command type and status * * @param processInstance process instance * @param commandType command type
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,450
[BUG] cannot complement data for one day
cannot complement data for one day. ![image](https://user-images.githubusercontent.com/29528966/79549206-443f4380-80c9-11ea-9ec9-678b65095969.png)
https://github.com/apache/dolphinscheduler/issues/2450
https://github.com/apache/dolphinscheduler/pull/2493
2f5427ca33b8e929d58412699699141191c640b4
b5fdce4164385f1df2ddb25c9441b50ea28ce681
"2020-04-17T08:35:59Z"
java
"2020-04-23T02:23:32Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java
* @param executionStatus execute status * @return update result */ private Map<String, Object> updateProcessInstancePrepare(ProcessInstance processInstance, CommandType commandType, ExecutionStatus executionStatus) { Map<String, Object> result = new HashMap<>(5); processInstance.setCommandType(commandType); processInstance.addHistoryCmd(commandType); processInstance.setState(executionStatus); int update = processService.updateProcessInstance(processInstance); // if (update > 0) { putMsg(result, Status.SUCCESS); } else { putMsg(result, Status.EXECUTE_PROCESS_INSTANCE_ERROR); } return result; } /** * insert command, used in the implementation of the page, re run, recovery (pause / failure) execution * * @param loginUser login user * @param instanceId instance id * @param processDefinitionId process definition id * @param commandType command type * @return insert result code */ private Map<String, Object> insertCommand(User loginUser, Integer instanceId, Integer processDefinitionId, CommandType commandType) { Map<String, Object> result = new HashMap<>(5); Command command = new Command(); command.setCommandType(commandType);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,450
[BUG] cannot complement data for one day
cannot complement data for one day. ![image](https://user-images.githubusercontent.com/29528966/79549206-443f4380-80c9-11ea-9ec9-678b65095969.png)
https://github.com/apache/dolphinscheduler/issues/2450
https://github.com/apache/dolphinscheduler/pull/2493
2f5427ca33b8e929d58412699699141191c640b4
b5fdce4164385f1df2ddb25c9441b50ea28ce681
"2020-04-17T08:35:59Z"
java
"2020-04-23T02:23:32Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java
command.setProcessDefinitionId(processDefinitionId); command.setCommandParam(String.format("{\"%s\":%d}", CMDPARAM_RECOVER_PROCESS_ID_STRING, instanceId)); command.setExecutorId(loginUser.getId()); if(!processService.verifyIsNeedCreateCommand(command)){ putMsg(result, Status.PROCESS_INSTANCE_EXECUTING_COMMAND,processDefinitionId); return result; } int create = processService.createCommand(command); if (create > 0) { putMsg(result, Status.SUCCESS); } else { putMsg(result, Status.EXECUTE_PROCESS_INSTANCE_ERROR); } return result; } /** * check if sub processes are offline before starting process definition * @param processDefineId process definition id * @return check result code */ public Map<String, Object> startCheckByProcessDefinedId(int processDefineId) { Map<String, Object> result = new HashMap<>(); if (processDefineId == 0){ logger.error("process definition id is null"); putMsg(result,Status.REQUEST_PARAMS_NOT_VALID_ERROR,"process definition id"); } List<Integer> ids = new ArrayList<>(); processService.recurseFindSubProcessId(processDefineId, ids); Integer[] idArray = ids.toArray(new Integer[ids.size()]);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,450
[BUG] cannot complement data for one day
cannot complement data for one day. ![image](https://user-images.githubusercontent.com/29528966/79549206-443f4380-80c9-11ea-9ec9-678b65095969.png)
https://github.com/apache/dolphinscheduler/issues/2450
https://github.com/apache/dolphinscheduler/pull/2493
2f5427ca33b8e929d58412699699141191c640b4
b5fdce4164385f1df2ddb25c9441b50ea28ce681
"2020-04-17T08:35:59Z"
java
"2020-04-23T02:23:32Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java
if (!ids.isEmpty()){ List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryDefinitionListByIdList(idArray); if (processDefinitionList != null){ for (ProcessDefinition processDefinition : processDefinitionList){ /** * if there is no online process, exit directly */ if (processDefinition.getReleaseState() != ReleaseState.ONLINE){ putMsg(result,Status.PROCESS_DEFINE_NOT_RELEASE, processDefinition.getName()); logger.info("not release process definition id: {} , name : {}", processDefinition.getId(), processDefinition.getName()); return result; } } } } putMsg(result, Status.SUCCESS); return result; } /** * query recipients and copyers by process definition id or processInstanceId * * @param processDefineId process definition id * @param processInstanceId process instance id * @return receivers cc list */ public Map<String, Object> getReceiverCc(Integer processDefineId,Integer processInstanceId) { Map<String, Object> result = new HashMap<>(); logger.info("processInstanceId {}",processInstanceId); if(processDefineId == null && processInstanceId == null){
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,450
[BUG] cannot complement data for one day
cannot complement data for one day. ![image](https://user-images.githubusercontent.com/29528966/79549206-443f4380-80c9-11ea-9ec9-678b65095969.png)
https://github.com/apache/dolphinscheduler/issues/2450
https://github.com/apache/dolphinscheduler/pull/2493
2f5427ca33b8e929d58412699699141191c640b4
b5fdce4164385f1df2ddb25c9441b50ea28ce681
"2020-04-17T08:35:59Z"
java
"2020-04-23T02:23:32Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java
throw new RuntimeException("You must set values for parameters processDefineId or processInstanceId"); } if(processDefineId == null && processInstanceId != null) { ProcessInstance processInstance = processInstanceMapper.selectById(processInstanceId); if (processInstance == null) { throw new RuntimeException("processInstanceId is not exists"); } processDefineId = processInstance.getProcessDefinitionId(); } ProcessDefinition processDefinition = processDefinitionMapper.selectById(processDefineId); if (processDefinition == null){ throw new RuntimeException(String.format("processDefineId %d is not exists",processDefineId)); } String receivers = processDefinition.getReceivers(); String receiversCc = processDefinition.getReceiversCc(); Map<String,String> dataMap = new HashMap<>(); dataMap.put(Constants.RECEIVERS,receivers); dataMap.put(Constants.RECEIVERS_CC,receiversCc); result.put(Constants.DATA_LIST, dataMap); putMsg(result, Status.SUCCESS); return result; } /** * create command * @param commandType commandType * @param processDefineId processDefineId * @param nodeDep nodeDep * @param failureStrategy failureStrategy * @param startNodeList startNodeList * @param schedule schedule
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,450
[BUG] cannot complement data for one day
cannot complement data for one day. ![image](https://user-images.githubusercontent.com/29528966/79549206-443f4380-80c9-11ea-9ec9-678b65095969.png)
https://github.com/apache/dolphinscheduler/issues/2450
https://github.com/apache/dolphinscheduler/pull/2493
2f5427ca33b8e929d58412699699141191c640b4
b5fdce4164385f1df2ddb25c9441b50ea28ce681
"2020-04-17T08:35:59Z"
java
"2020-04-23T02:23:32Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java
* @param warningType warningType * @param executorId executorId * @param warningGroupId warningGroupId * @param runMode runMode * @param processInstancePriority processInstancePriority * @param workerGroup workerGroup * @return command id * @throws ParseException */ private int createCommand(CommandType commandType, int processDefineId, TaskDependType nodeDep, FailureStrategy failureStrategy, String startNodeList, String schedule, WarningType warningType, int executorId, int warningGroupId, RunMode runMode,Priority processInstancePriority, String workerGroup) throws ParseException { /** * instantiate command schedule instance */ Command command = new Command(); Map<String,String> cmdParam = new HashMap<>(); if(commandType == null){ command.setCommandType(CommandType.START_PROCESS); }else{ command.setCommandType(commandType); } command.setProcessDefinitionId(processDefineId); if(nodeDep != null){ command.setTaskDependType(nodeDep); } if(failureStrategy != null){ command.setFailureStrategy(failureStrategy);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,450
[BUG] cannot complement data for one day
cannot complement data for one day. ![image](https://user-images.githubusercontent.com/29528966/79549206-443f4380-80c9-11ea-9ec9-678b65095969.png)
https://github.com/apache/dolphinscheduler/issues/2450
https://github.com/apache/dolphinscheduler/pull/2493
2f5427ca33b8e929d58412699699141191c640b4
b5fdce4164385f1df2ddb25c9441b50ea28ce681
"2020-04-17T08:35:59Z"
java
"2020-04-23T02:23:32Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java
} if(StringUtils.isNotEmpty(startNodeList)){ cmdParam.put(CMDPARAM_START_NODE_NAMES, startNodeList); } if(warningType != null){ command.setWarningType(warningType); } command.setCommandParam(JSONUtils.toJson(cmdParam)); command.setExecutorId(executorId); command.setWarningGroupId(warningGroupId); command.setProcessInstancePriority(processInstancePriority); command.setWorkerGroup(workerGroup); Date start = null; Date end = null; if(StringUtils.isNotEmpty(schedule)){ String[] interval = schedule.split(","); if(interval.length == 2){ start = DateUtils.getScheduleDate(interval[0]); end = DateUtils.getScheduleDate(interval[1]); } } // if(commandType == CommandType.COMPLEMENT_DATA){ runMode = (runMode == null) ? RunMode.RUN_MODE_SERIAL : runMode; if(null != start && null != end && start.before(end)){ if(runMode == RunMode.RUN_MODE_SERIAL){ cmdParam.put(CMDPARAM_COMPLEMENT_DATA_START_DATE, DateUtils.dateToString(start)); cmdParam.put(CMDPARAM_COMPLEMENT_DATA_END_DATE, DateUtils.dateToString(end)); command.setCommandParam(JSONUtils.toJson(cmdParam)); return processService.createCommand(command);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,450
[BUG] cannot complement data for one day
cannot complement data for one day. ![image](https://user-images.githubusercontent.com/29528966/79549206-443f4380-80c9-11ea-9ec9-678b65095969.png)
https://github.com/apache/dolphinscheduler/issues/2450
https://github.com/apache/dolphinscheduler/pull/2493
2f5427ca33b8e929d58412699699141191c640b4
b5fdce4164385f1df2ddb25c9441b50ea28ce681
"2020-04-17T08:35:59Z"
java
"2020-04-23T02:23:32Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java
}else if (runMode == RunMode.RUN_MODE_PARALLEL){ List<Schedule> schedules = processService.queryReleaseSchedulerListByProcessDefinitionId(processDefineId); List<Date> listDate = new LinkedList<>(); if(!CollectionUtils.isEmpty(schedules)){ for (Schedule item : schedules) { listDate.addAll(CronUtils.getSelfFireDateList(start, end, item.getCrontab())); } } if(!CollectionUtils.isEmpty(listDate)){ // for (Date date : listDate) { cmdParam.put(CMDPARAM_COMPLEMENT_DATA_START_DATE, DateUtils.dateToString(date)); cmdParam.put(CMDPARAM_COMPLEMENT_DATA_END_DATE, DateUtils.dateToString(date)); command.setCommandParam(JSONUtils.toJson(cmdParam)); processService.createCommand(command); } return listDate.size(); }else{ // int runCunt = 0; while(!start.after(end)) { runCunt += 1; cmdParam.put(CMDPARAM_COMPLEMENT_DATA_START_DATE, DateUtils.dateToString(start)); cmdParam.put(CMDPARAM_COMPLEMENT_DATA_END_DATE, DateUtils.dateToString(start)); command.setCommandParam(JSONUtils.toJson(cmdParam)); processService.createCommand(command); start = DateUtils.getSomeDay(start, 1); } return runCunt; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,450
[BUG] cannot complement data for one day
cannot complement data for one day. ![image](https://user-images.githubusercontent.com/29528966/79549206-443f4380-80c9-11ea-9ec9-678b65095969.png)
https://github.com/apache/dolphinscheduler/issues/2450
https://github.com/apache/dolphinscheduler/pull/2493
2f5427ca33b8e929d58412699699141191c640b4
b5fdce4164385f1df2ddb25c9441b50ea28ce681
"2020-04-17T08:35:59Z"
java
"2020-04-23T02:23:32Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java
} }else{ logger.error("there is not valid schedule date for the process definition: id:{},date:{}", processDefineId, schedule); } }else{ command.setCommandParam(JSONUtils.toJson(cmdParam)); return processService.createCommand(command); } return 0; } /** * check result and auth * * @param loginUser * @param projectName * @param project * @return */ private Map<String, Object> checkResultAndAuth(User loginUser, String projectName, Project project) { // Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status status = (Status) checkResult.get(Constants.STATUS); if (status != Status.SUCCESS) { return checkResult; } return null; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.api.service; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.serializer.SerializerFeature; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.commons.collections.BeanMap; import org.apache.dolphinscheduler.api.dto.resources.ResourceComponent;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
import org.apache.dolphinscheduler.api.dto.resources.filter.ResourceFilter; import org.apache.dolphinscheduler.api.dto.resources.visitor.ResourceTreeVisitor; import org.apache.dolphinscheduler.api.dto.resources.visitor.Visitor; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.exceptions.ServiceException; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.ResourceType; import org.apache.dolphinscheduler.common.utils.*; import org.apache.dolphinscheduler.dao.entity.Resource; import org.apache.dolphinscheduler.dao.entity.Tenant; import org.apache.dolphinscheduler.dao.entity.UdfFunc; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.*; import org.apache.dolphinscheduler.dao.utils.ResourceProcessDefinitionUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import java.text.MessageFormat; import java.util.*; import java.util.stream.Collectors; import static org.apache.dolphinscheduler.common.Constants.*; /** * resources service */ @Service
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
public class ResourcesService extends BaseService { private static final Logger logger = LoggerFactory.getLogger(ResourcesService.class); @Autowired private ResourceMapper resourcesMapper; @Autowired private UdfFuncMapper udfFunctionMapper; @Autowired private TenantMapper tenantMapper; @Autowired
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
private UserMapper userMapper; @Autowired private ResourceUserMapper resourceUserMapper; @Autowired private ProcessDefinitionMapper processDefinitionMapper; /** * create directory * * @param loginUser login user * @param name alias * @param description description * @param type type * @param pid parent id * @param currentDir current directory * @return create directory result */ @Transactional(rollbackFor = Exception.class) public Result createDirectory(User loginUser, String name, String description, ResourceType type, int pid, String currentDir) { Result result = new Result(); if (!PropertyUtils.getResUploadStartupState()){ logger.error("resource upload startup state: {}", PropertyUtils.getResUploadStartupState()); putMsg(result, Status.HDFS_NOT_STARTUP); return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
String fullName = currentDir.equals("/") ? String.format("%s%s",currentDir,name):String.format("%s/%s",currentDir,name); if (pid != -1) { Resource parentResource = resourcesMapper.selectById(pid); if (parentResource == null) { putMsg(result, Status.PARENT_RESOURCE_NOT_EXIST); return result; } if (!hasPerm(loginUser, parentResource.getUserId())) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } } if (checkResourceExists(fullName, 0, type.ordinal())) { logger.error("resource directory {} has exist, can't recreate", fullName); putMsg(result, Status.RESOURCE_EXIST); return result; } Date now = new Date(); Resource resource = new Resource(pid,name,fullName,true,description,name,loginUser.getId(),type,0,now,now); try { resourcesMapper.insert(resource); putMsg(result, Status.SUCCESS); Map<Object, Object> dataMap = new BeanMap(resource); Map<String, Object> resultMap = new HashMap<String, Object>(); for (Map.Entry<Object, Object> entry: dataMap.entrySet()) { if (!"class".equalsIgnoreCase(entry.getKey().toString())) { resultMap.put(entry.getKey().toString(), entry.getValue()); } } result.setData(resultMap);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
} catch (Exception e) { logger.error("resource already exists, can't recreate ", e); throw new RuntimeException("resource already exists, can't recreate"); } createDirecotry(loginUser,fullName,type,result); return result; } /** * create resource * * @param loginUser login user * @param name alias * @param desc description * @param file file * @param type type * @param pid parent id * @param currentDir current directory * @return create result code */ @Transactional(rollbackFor = Exception.class) public Result createResource(User loginUser, String name, String desc, ResourceType type, MultipartFile file, int pid, String currentDir) { Result result = new Result();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
if (!PropertyUtils.getResUploadStartupState()){ logger.error("resource upload startup state: {}", PropertyUtils.getResUploadStartupState()); putMsg(result, Status.HDFS_NOT_STARTUP); return result; } if (pid != -1) { Resource parentResource = resourcesMapper.selectById(pid); if (parentResource == null) { putMsg(result, Status.PARENT_RESOURCE_NOT_EXIST); return result; } if (!hasPerm(loginUser, parentResource.getUserId())) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } } if (file.isEmpty()) { logger.error("file is empty: {}", file.getOriginalFilename()); putMsg(result, Status.RESOURCE_FILE_IS_EMPTY); return result; } String fileSuffix = FileUtils.suffix(file.getOriginalFilename()); String nameSuffix = FileUtils.suffix(name); if (!(StringUtils.isNotEmpty(fileSuffix) && fileSuffix.equalsIgnoreCase(nameSuffix))) { /** * rename file suffix and original suffix must be consistent */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
logger.error("rename file suffix and original suffix must be consistent: {}", file.getOriginalFilename()); putMsg(result, Status.RESOURCE_SUFFIX_FORBID_CHANGE); return result; } if (Constants.UDF.equals(type.name()) && !JAR.equalsIgnoreCase(fileSuffix)) { logger.error(Status.UDF_RESOURCE_SUFFIX_NOT_JAR.getMsg()); putMsg(result, Status.UDF_RESOURCE_SUFFIX_NOT_JAR); return result; } if (file.getSize() > Constants.MAX_FILE_SIZE) { logger.error("file size is too large: {}", file.getOriginalFilename()); putMsg(result, Status.RESOURCE_SIZE_EXCEED_LIMIT); return result; } String fullName = currentDir.equals("/") ? String.format("%s%s",currentDir,name):String.format("%s/%s",currentDir,name); if (checkResourceExists(fullName, 0, type.ordinal())) { logger.error("resource {} has exist, can't recreate", name); putMsg(result, Status.RESOURCE_EXIST); return result; } Date now = new Date(); Resource resource = new Resource(pid,name,fullName,false,desc,file.getOriginalFilename(),loginUser.getId(),type,file.getSize(),now,now); try { resourcesMapper.insert(resource); putMsg(result, Status.SUCCESS); Map<Object, Object> dataMap = new BeanMap(resource); Map<String, Object> resultMap = new HashMap<>(); for (Map.Entry<Object, Object> entry: dataMap.entrySet()) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
if (!"class".equalsIgnoreCase(entry.getKey().toString())) { resultMap.put(entry.getKey().toString(), entry.getValue()); } } result.setData(resultMap); } catch (Exception e) { logger.error("resource already exists, can't recreate ", e); throw new RuntimeException("resource already exists, can't recreate"); } if (!upload(loginUser, fullName, file, type)) { logger.error("upload resource: {} file: {} failed.", name, file.getOriginalFilename()); putMsg(result, Status.HDFS_OPERATION_ERROR); throw new RuntimeException(String.format("upload resource: %s file: %s failed.", name, file.getOriginalFilename())); } return result; } /** * check resource is exists * * @param fullName fullName * @param userId user id * @param type type * @return true if resource exists */ private boolean checkResourceExists(String fullName, int userId, int type ){ List<Resource> resources = resourcesMapper.queryResourceList(fullName, userId, type); if (resources != null && resources.size() > 0) { return true; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
return false; } /** * update resource * @param loginUser login user * @param resourceId resource id * @param name name * @param desc description * @param type resource type * @return update result code */ @Transactional(rollbackFor = Exception.class) public Result updateResource(User loginUser, int resourceId, String name, String desc, ResourceType type) { Result result = new Result(); if (!PropertyUtils.getResUploadStartupState()){ logger.error("resource upload startup state: {}", PropertyUtils.getResUploadStartupState()); putMsg(result, Status.HDFS_NOT_STARTUP); return result; } Resource resource = resourcesMapper.selectById(resourceId); if (resource == null) { putMsg(result, Status.RESOURCE_NOT_EXIST); return result; } if (!hasPerm(loginUser, resource.getUserId())) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } if (name.equals(resource.getAlias()) && desc.equals(resource.getDescription())) { putMsg(result, Status.SUCCESS); return result; } String originFullName = resource.getFullName(); String fullName = String.format("%s%s",originFullName.substring(0,originFullName.lastIndexOf("/")+1),name); if (!resource.getAlias().equals(name) && checkResourceExists(fullName, 0, type.ordinal())) { logger.error("resource {} already exists, can't recreate", name); putMsg(result, Status.RESOURCE_EXIST); return result; } String tenantCode = getTenantCode(resource.getUserId(),result); if (StringUtils.isEmpty(tenantCode)){ return result; } String nameWithSuffix = name; String originResourceName = resource.getAlias(); if (!resource.isDirectory()) { String suffix = originResourceName.substring(originResourceName.lastIndexOf(".")); if(!name.endsWith(suffix)){ nameWithSuffix = nameWithSuffix + suffix; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
List<Integer> childrenResource = listAllChildren(resource,false); String oldFullName = resource.getFullName(); Date now = new Date(); resource.setAlias(nameWithSuffix); resource.setFullName(fullName); resource.setDescription(desc); resource.setUpdateTime(now); try { resourcesMapper.updateById(resource); if (resource.isDirectory() && CollectionUtils.isNotEmpty(childrenResource)) { List<Resource> childResourceList = new ArrayList<>(); List<Resource> resourceList = resourcesMapper.listResourceByIds(childrenResource.toArray(new Integer[childrenResource.size()])); childResourceList = resourceList.stream().map(t -> { t.setFullName(t.getFullName().replaceFirst(oldFullName, fullName)); t.setUpdateTime(now); return t; }).collect(Collectors.toList()); resourcesMapper.batchUpdateResource(childResourceList); } putMsg(result, Status.SUCCESS); Map<Object, Object> dataMap = new BeanMap(resource); Map<String, Object> resultMap = new HashMap<>(5); for (Map.Entry<Object, Object> entry: dataMap.entrySet()) { if (!Constants.CLASS.equalsIgnoreCase(entry.getKey().toString())) { resultMap.put(entry.getKey().toString(), entry.getValue()); } } result.setData(resultMap); } catch (Exception e) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
logger.error(Status.UPDATE_RESOURCE_ERROR.getMsg(), e); throw new ServiceException(Status.UPDATE_RESOURCE_ERROR); } if (originResourceName.equals(name)) { return result; } String originHdfsFileName = HadoopUtils.getHdfsFileName(resource.getType(),tenantCode,originFullName); String destHdfsFileName = HadoopUtils.getHdfsFileName(resource.getType(),tenantCode,fullName); try { if (HadoopUtils.getInstance().exists(originHdfsFileName)) { logger.info("hdfs copy {} -> {}", originHdfsFileName, destHdfsFileName); HadoopUtils.getInstance().copy(originHdfsFileName, destHdfsFileName, true, true); } else { logger.error("{} not exist", originHdfsFileName); putMsg(result,Status.RESOURCE_NOT_EXIST); } } catch (Exception e) { logger.error(MessageFormat.format("hdfs copy {0} -> {1} fail", originHdfsFileName, destHdfsFileName), e); putMsg(result,Status.HDFS_COPY_FAIL); throw new ServiceException(Status.HDFS_COPY_FAIL); } return result; } /** * query resources list paging * * @param loginUser login user
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
* @param type resource type * @param searchVal search value * @param pageNo page number * @param pageSize page size * @return resource list page */ public Map<String, Object> queryResourceListPaging(User loginUser, int direcotryId, ResourceType type, String searchVal, Integer pageNo, Integer pageSize) { HashMap<String, Object> result = new HashMap<>(5); Page<Resource> page = new Page(pageNo, pageSize); int userId = loginUser.getId(); if (isAdmin(loginUser)) { userId= 0; } if (direcotryId != -1) { Resource directory = resourcesMapper.selectById(direcotryId); if (directory == null) { putMsg(result, Status.RESOURCE_NOT_EXIST); return result; } } IPage<Resource> resourceIPage = resourcesMapper.queryResourcePaging(page, userId,direcotryId, type.ordinal(), searchVal); PageInfo pageInfo = new PageInfo<Resource>(pageNo, pageSize); pageInfo.setTotalCount((int)resourceIPage.getTotal()); pageInfo.setLists(resourceIPage.getRecords()); result.put(Constants.DATA_LIST, pageInfo); putMsg(result,Status.SUCCESS); return result; } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
* create direcoty * @param loginUser login user * @param fullName full name * @param type resource type * @param result Result */ private void createDirecotry(User loginUser,String fullName,ResourceType type,Result result){ String tenantCode = tenantMapper.queryById(loginUser.getTenantId()).getTenantCode(); String directoryName = HadoopUtils.getHdfsFileName(type,tenantCode,fullName); String resourceRootPath = HadoopUtils.getHdfsDir(type,tenantCode); try { if (!HadoopUtils.getInstance().exists(resourceRootPath)) { createTenantDirIfNotExists(tenantCode); } if (!HadoopUtils.getInstance().mkdir(directoryName)) { logger.error("create resource directory {} of hdfs failed",directoryName); putMsg(result,Status.HDFS_OPERATION_ERROR); throw new RuntimeException(String.format("create resource directory: %s failed.", directoryName)); } } catch (Exception e) { logger.error("create resource directory {} of hdfs failed",directoryName); putMsg(result,Status.HDFS_OPERATION_ERROR); throw new RuntimeException(String.format("create resource directory: %s failed.", directoryName)); } } /** * upload file to hdfs * * @param loginUser login user
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
* @param fullName full name * @param file file */ private boolean upload(User loginUser, String fullName, MultipartFile file, ResourceType type) { String fileSuffix = FileUtils.suffix(file.getOriginalFilename()); String nameSuffix = FileUtils.suffix(fullName); if (!(StringUtils.isNotEmpty(fileSuffix) && fileSuffix.equalsIgnoreCase(nameSuffix))) { return false; } String tenantCode = tenantMapper.queryById(loginUser.getTenantId()).getTenantCode(); String localFilename = FileUtils.getUploadFilename(tenantCode, UUID.randomUUID().toString()); String hdfsFilename = HadoopUtils.getHdfsFileName(type,tenantCode,fullName); String resourcePath = HadoopUtils.getHdfsDir(type,tenantCode); try { if (!HadoopUtils.getInstance().exists(resourcePath)) { createTenantDirIfNotExists(tenantCode); } org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(file, localFilename); HadoopUtils.getInstance().copyLocalToHdfs(localFilename, hdfsFilename, true, true); } catch (Exception e) { logger.error(e.getMessage(), e); return false; } return true;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
} /** * query resource list * * @param loginUser login user * @param type resource type * @return resource list */ public Map<String, Object> queryResourceList(User loginUser, ResourceType type) { Map<String, Object> result = new HashMap<>(5); int userId = loginUser.getId(); if(isAdmin(loginUser)){ userId = 0; } List<Resource> allResourceList = resourcesMapper.queryResourceListAuthored(userId, type.ordinal(),0); Visitor resourceTreeVisitor = new ResourceTreeVisitor(allResourceList); result.put(Constants.DATA_LIST, resourceTreeVisitor.visit().getChildren()); putMsg(result,Status.SUCCESS); return result; } /** * query resource list * * @param loginUser login user * @param type resource type * @return resource list */ public Map<String, Object> queryResourceJarList(User loginUser, ResourceType type) { Map<String, Object> result = new HashMap<>(5);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
int userId = loginUser.getId(); if(isAdmin(loginUser)){ userId = 0; } List<Resource> allResourceList = resourcesMapper.queryResourceListAuthored(userId, type.ordinal(),0); List<Resource> resources = new ResourceFilter(".jar",new ArrayList<>(allResourceList)).filter(); Visitor resourceTreeVisitor = new ResourceTreeVisitor(resources); result.put(Constants.DATA_LIST, resourceTreeVisitor.visit().getChildren()); putMsg(result,Status.SUCCESS); return result; } /** * delete resource * * @param loginUser login user * @param resourceId resource id * @return delete result code * @throws Exception exception */ @Transactional(rollbackFor = Exception.class) public Result delete(User loginUser, int resourceId) throws Exception { Result result = new Result(); if (!PropertyUtils.getResUploadStartupState()){ logger.error("resource upload startup state: {}", PropertyUtils.getResUploadStartupState()); putMsg(result, Status.HDFS_NOT_STARTUP); return result; } Resource resource = resourcesMapper.selectById(resourceId);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
if (resource == null) { logger.error("resource file not exist, resource id {}", resourceId); putMsg(result, Status.RESOURCE_NOT_EXIST); return result; } if (!hasPerm(loginUser, resource.getUserId())) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } String tenantCode = getTenantCode(resource.getUserId(),result); if (StringUtils.isEmpty(tenantCode)){ return result; } List<Map<String, Object>> list = processDefinitionMapper.listResources(); Map<Integer, Set<Integer>> resourceProcessMap = ResourceProcessDefinitionUtils.getResourceProcessDefinitionMap(list); Set<Integer> resourceIdSet = resourceProcessMap.keySet(); List<Integer> allChildren = listAllChildren(resource,true); Integer[] needDeleteResourceIdArray = allChildren.toArray(new Integer[allChildren.size()]); if (resource.getType() == (ResourceType.UDF)) { List<UdfFunc> udfFuncs = udfFunctionMapper.listUdfByResourceId(needDeleteResourceIdArray); if (CollectionUtils.isNotEmpty(udfFuncs)) { logger.error("can't be deleted,because it is bound by UDF functions:{}",udfFuncs.toString()); putMsg(result,Status.UDF_RESOURCE_IS_BOUND,udfFuncs.get(0).getFuncName()); return result; } } if (resourceIdSet.contains(resource.getPid())) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
logger.error("can't be deleted,because it is used of process definition"); putMsg(result, Status.RESOURCE_IS_USED); return result; } resourceIdSet.retainAll(allChildren); if (CollectionUtils.isNotEmpty(resourceIdSet)) { logger.error("can't be deleted,because it is used of process definition"); for (Integer resId : resourceIdSet) { logger.error("resource id:{} is used of process definition {}",resId,resourceProcessMap.get(resId)); } putMsg(result, Status.RESOURCE_IS_USED); return result; } String hdfsFilename = HadoopUtils.getHdfsFileName(resource.getType(), tenantCode, resource.getFullName()); resourcesMapper.deleteIds(needDeleteResourceIdArray); resourceUserMapper.deleteResourceUserArray(0, needDeleteResourceIdArray); HadoopUtils.getInstance().delete(hdfsFilename, true); putMsg(result, Status.SUCCESS); return result; } /** * verify resource by name and type * @param loginUser login user * @param fullName resource full name * @param type resource type * @return true if the resource name not exists, otherwise return false */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
public Result verifyResourceName(String fullName, ResourceType type,User loginUser) { Result result = new Result(); putMsg(result, Status.SUCCESS); if (checkResourceExists(fullName, 0, type.ordinal())) { logger.error("resource type:{} name:{} has exist, can't create again.", type, fullName); putMsg(result, Status.RESOURCE_EXIST); } else { Tenant tenant = tenantMapper.queryById(loginUser.getTenantId()); if(tenant != null){ String tenantCode = tenant.getTenantCode(); try { String hdfsFilename = HadoopUtils.getHdfsFileName(type,tenantCode,fullName); if(HadoopUtils.getInstance().exists(hdfsFilename)){ logger.error("resource type:{} name:{} has exist in hdfs {}, can't create again.", type, fullName,hdfsFilename); putMsg(result, Status.RESOURCE_FILE_EXIST,hdfsFilename); } } catch (Exception e) { logger.error(e.getMessage(),e); putMsg(result,Status.HDFS_OPERATION_ERROR); } }else{ putMsg(result,Status.TENANT_NOT_EXIST); } } return result; } /** * verify resource by full name or pid and type * @param fullName resource full name
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
* @param id resource id * @param type resource type * @return true if the resource full name or pid not exists, otherwise return false */ public Result queryResource(String fullName,Integer id,ResourceType type) { Result result = new Result(); if (StringUtils.isBlank(fullName) && id == null) { logger.error("You must input one of fullName and pid"); putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR); return result; } if (StringUtils.isNotBlank(fullName)) { List<Resource> resourceList = resourcesMapper.queryResource(fullName,type.ordinal()); if (CollectionUtils.isEmpty(resourceList)) { logger.error("resource file not exist, resource full name {} ", fullName); putMsg(result, Status.RESOURCE_NOT_EXIST); return result; } putMsg(result, Status.SUCCESS); result.setData(resourceList.get(0)); } else { Resource resource = resourcesMapper.selectById(id); if (resource == null) { logger.error("resource file not exist, resource id {}", id); putMsg(result, Status.RESOURCE_NOT_EXIST); return result; } Resource parentResource = resourcesMapper.selectById(resource.getPid()); if (parentResource == null) { logger.error("parent resource file not exist, resource id {}", id);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
putMsg(result, Status.RESOURCE_NOT_EXIST); return result; } putMsg(result, Status.SUCCESS); result.setData(parentResource); } return result; } /** * view resource file online * * @param resourceId resource id * @param skipLineNum skip line number * @param limit limit * @return resource content */ public Result readResource(int resourceId, int skipLineNum, int limit) { Result result = new Result(); if (!PropertyUtils.getResUploadStartupState()){ logger.error("resource upload startup state: {}", PropertyUtils.getResUploadStartupState()); putMsg(result, Status.HDFS_NOT_STARTUP); return result; } Resource resource = resourcesMapper.selectById(resourceId); if (resource == null) { logger.error("resource file not exist, resource id {}", resourceId); putMsg(result, Status.RESOURCE_NOT_EXIST); return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
} String nameSuffix = FileUtils.suffix(resource.getAlias()); String resourceViewSuffixs = FileUtils.getResourceViewSuffixs(); if (StringUtils.isNotEmpty(resourceViewSuffixs)) { List<String> strList = Arrays.asList(resourceViewSuffixs.split(",")); if (!strList.contains(nameSuffix)) { logger.error("resource suffix {} not support view, resource id {}", nameSuffix, resourceId); putMsg(result, Status.RESOURCE_SUFFIX_NOT_SUPPORT_VIEW); return result; } } String tenantCode = getTenantCode(resource.getUserId(),result); if (StringUtils.isEmpty(tenantCode)){ return result; } String hdfsFileName = HadoopUtils.getHdfsResourceFileName(tenantCode, resource.getFullName()); logger.info("resource hdfs path is {} ", hdfsFileName); try { if(HadoopUtils.getInstance().exists(hdfsFileName)){ List<String> content = HadoopUtils.getInstance().catFile(hdfsFileName, skipLineNum, limit); putMsg(result, Status.SUCCESS); Map<String, Object> map = new HashMap<>(); map.put(ALIAS, resource.getAlias()); map.put(CONTENT, String.join("\n", content)); result.setData(map); }else{ logger.error("read file {} not exist in hdfs", hdfsFileName); putMsg(result, Status.RESOURCE_FILE_NOT_EXIST,hdfsFileName);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
} } catch (Exception e) { logger.error("Resource {} read failed", hdfsFileName, e); putMsg(result, Status.HDFS_OPERATION_ERROR); } return result; } /** * create resource file online * * @param loginUser login user * @param type resource type * @param fileName file name * @param fileSuffix file suffix * @param desc description * @param content content * @return create result code */ @Transactional(rollbackFor = Exception.class) public Result onlineCreateResource(User loginUser, ResourceType type, String fileName, String fileSuffix, String desc, String content,int pid,String currentDirectory) { Result result = new Result(); if (!PropertyUtils.getResUploadStartupState()){ logger.error("resource upload startup state: {}", PropertyUtils.getResUploadStartupState()); putMsg(result, Status.HDFS_NOT_STARTUP); return result; } String nameSuffix = fileSuffix.trim(); String resourceViewSuffixs = FileUtils.getResourceViewSuffixs();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
if (StringUtils.isNotEmpty(resourceViewSuffixs)) { List<String> strList = Arrays.asList(resourceViewSuffixs.split(",")); if (!strList.contains(nameSuffix)) { logger.error("resouce suffix {} not support create", nameSuffix); putMsg(result, Status.RESOURCE_SUFFIX_NOT_SUPPORT_VIEW); return result; } } String name = fileName.trim() + "." + nameSuffix; String fullName = currentDirectory.equals("/") ? String.format("%s%s",currentDirectory,name):String.format("%s/%s",currentDirectory,name); result = verifyResourceName(fullName,type,loginUser); if (!result.getCode().equals(Status.SUCCESS.getCode())) { return result; } Date now = new Date(); Resource resource = new Resource(pid,name,fullName,false,desc,name,loginUser.getId(),type,content.getBytes().length,now,now); resourcesMapper.insert(resource); putMsg(result, Status.SUCCESS); Map<Object, Object> dataMap = new BeanMap(resource); Map<String, Object> resultMap = new HashMap<>(); for (Map.Entry<Object, Object> entry: dataMap.entrySet()) { if (!Constants.CLASS.equalsIgnoreCase(entry.getKey().toString())) { resultMap.put(entry.getKey().toString(), entry.getValue()); } } result.setData(resultMap); String tenantCode = tenantMapper.queryById(loginUser.getTenantId()).getTenantCode(); result = uploadContentToHdfs(fullName, tenantCode, content); if (!result.getCode().equals(Status.SUCCESS.getCode())) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
throw new RuntimeException(result.getMsg()); } return result; } /** * updateProcessInstance resource * * @param resourceId resource id * @param content content * @return update result cod */ @Transactional(rollbackFor = Exception.class) public Result updateResourceContent(int resourceId, String content) { Result result = new Result(); if (!PropertyUtils.getResUploadStartupState()){ logger.error("resource upload startup state: {}", PropertyUtils.getResUploadStartupState()); putMsg(result, Status.HDFS_NOT_STARTUP); return result; } Resource resource = resourcesMapper.selectById(resourceId); if (resource == null) { logger.error("read file not exist, resource id {}", resourceId); putMsg(result, Status.RESOURCE_NOT_EXIST); return result; } String nameSuffix = FileUtils.suffix(resource.getAlias()); String resourceViewSuffixs = FileUtils.getResourceViewSuffixs(); if (StringUtils.isNotEmpty(resourceViewSuffixs)) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
List<String> strList = Arrays.asList(resourceViewSuffixs.split(",")); if (!strList.contains(nameSuffix)) { logger.error("resource suffix {} not support updateProcessInstance, resource id {}", nameSuffix, resourceId); putMsg(result, Status.RESOURCE_SUFFIX_NOT_SUPPORT_VIEW); return result; } } String tenantCode = getTenantCode(resource.getUserId(),result); if (StringUtils.isEmpty(tenantCode)){ return result; } resource.setSize(content.getBytes().length); resource.setUpdateTime(new Date()); resourcesMapper.updateById(resource); result = uploadContentToHdfs(resource.getFullName(), tenantCode, content); if (!result.getCode().equals(Status.SUCCESS.getCode())) { throw new RuntimeException(result.getMsg()); } return result; } /** * @param resourceName resource name * @param tenantCode tenant code * @param content content * @return result */ private Result uploadContentToHdfs(String resourceName, String tenantCode, String content) { Result result = new Result(); String localFilename = ""; String hdfsFileName = "";
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
try { localFilename = FileUtils.getUploadFilename(tenantCode, UUID.randomUUID().toString()); if (!FileUtils.writeContent2File(content, localFilename)) { logger.error("file {} fail, content is {}", localFilename, content); putMsg(result, Status.RESOURCE_NOT_EXIST); return result; } hdfsFileName = HadoopUtils.getHdfsResourceFileName(tenantCode, resourceName); String resourcePath = HadoopUtils.getHdfsResDir(tenantCode); logger.info("resource hdfs path is {} ", hdfsFileName); HadoopUtils hadoopUtils = HadoopUtils.getInstance(); if (!hadoopUtils.exists(resourcePath)) { createTenantDirIfNotExists(tenantCode); } if (hadoopUtils.exists(hdfsFileName)) { hadoopUtils.delete(hdfsFileName, false); } hadoopUtils.copyLocalToHdfs(localFilename, hdfsFileName, true, true); } catch (Exception e) { logger.error(e.getMessage(), e); result.setCode(Status.HDFS_OPERATION_ERROR.getCode()); result.setMsg(String.format("copy %s to hdfs %s fail", localFilename, hdfsFileName)); return result; } putMsg(result, Status.SUCCESS); return result; }