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
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.UUID; import java.util.regex.Matcher; import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DuplicateKeyException; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fasterxml.jackson.databind.SerializationFeature; /** * resources service impl */ @Service public class ResourcesServiceImpl extends BaseServiceImpl implements ResourcesService { private static final Logger logger = LoggerFactory.getLogger(ResourcesServiceImpl.class); @Autowired private ResourceMapper resourcesMapper; @Autowired private UdfFuncMapper udfFunctionMapper; @Autowired private TenantMapper tenantMapper;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
@Autowired 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 */ @Override @Transactional(rollbackFor = Exception.class) public Result<Object> createDirectory(User loginUser, String name, String description, ResourceType type, int pid, String currentDir) { Result<Object> result = checkResourceUploadStartupState(); if (!result.getCode().equals(Status.SUCCESS.getCode())) { return result; } String fullName = currentDir.equals("/") ? String.format("%s%s",currentDir,name) : String.format("%s/%s",currentDir,name);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
result = verifyResource(loginUser, type, fullName, pid); if (!result.getCode().equals(Status.SUCCESS.getCode())) { 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<>(); for (Map.Entry<Object, Object> entry: dataMap.entrySet()) { if (!"class".equalsIgnoreCase(entry.getKey().toString())) { resultMap.put(entry.getKey().toString(), entry.getValue()); } } result.setData(resultMap); } catch (DuplicateKeyException e) { logger.error("resource directory {} has exist, can't recreate", fullName); putMsg(result, Status.RESOURCE_EXIST); return result; } catch (Exception e) { logger.error("resource already exists, can't recreate ", e); throw new ServiceException("resource already exists, can't recreate"); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
createDirectory(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 */ @Override @Transactional(rollbackFor = Exception.class) public Result<Object> createResource(User loginUser, String name, String desc, ResourceType type, MultipartFile file, int pid, String currentDir) { Result<Object> result = checkResourceUploadStartupState(); if (!result.getCode().equals(Status.SUCCESS.getCode())) { return result; } result = verifyPid(loginUser, pid);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
if (!result.getCode().equals(Status.SUCCESS.getCode())) { return result; } result = verifyFile(name, type, file); if (!result.getCode().equals(Status.SUCCESS.getCode())) { 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", RegexUtils.escapeNRT(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()) { 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 ServiceException("resource already exists, can't recreate");
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
} if (!upload(loginUser, fullName, file, type)) { logger.error("upload resource: {} file: {} failed.", RegexUtils.escapeNRT(name), RegexUtils.escapeNRT(file.getOriginalFilename())); putMsg(result, Status.HDFS_OPERATION_ERROR); throw new ServiceException(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) { Boolean existResource = resourcesMapper.existResource(fullName, userId, type); return BooleanUtils.isTrue(existResource); } /** * update resource * @param loginUser login user * @param resourceId resource id * @param name name * @param desc description * @param type resource type * @param file resource file * @return update result code
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
*/ @Override @Transactional(rollbackFor = Exception.class) public Result<Object> updateResource(User loginUser, int resourceId, String name, String desc, ResourceType type, MultipartFile file) { Result<Object> result = checkResourceUploadStartupState(); if (!result.getCode().equals(Status.SUCCESS.getCode())) { return result; } Resource resource = resourcesMapper.selectById(resourceId); if (resource == null) { putMsg(result, Status.RESOURCE_NOT_EXIST); return result; } if (!hasPerm(loginUser, resource.getUserId())) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } if (file == null && name.equals(resource.getAlias()) && desc.equals(resource.getDescription())) { putMsg(result, Status.SUCCESS); return result; } String originFullName = resource.getFullName(); String originResourceName = resource.getAlias(); String fullName = String.format("%s%s",originFullName.substring(0,originFullName.lastIndexOf("/") + 1),name);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
if (!originResourceName.equals(name) && checkResourceExists(fullName, 0, type.ordinal())) { logger.error("resource {} already exists, can't recreate", name); putMsg(result, Status.RESOURCE_EXIST); return result; } result = verifyFile(name, type, file); if (!result.getCode().equals(Status.SUCCESS.getCode())) { return result; } String tenantCode = getTenantCode(resource.getUserId(),result); if (StringUtils.isEmpty(tenantCode)) { return result; } String originHdfsFileName = HadoopUtils.getHdfsFileName(resource.getType(),tenantCode,originFullName); try { if (!HadoopUtils.getInstance().exists(originHdfsFileName)) { logger.error("{} not exist", originHdfsFileName); putMsg(result,Status.RESOURCE_NOT_EXIST); return result; } } catch (IOException e) { logger.error(e.getMessage(),e); throw new ServiceException(Status.HDFS_OPERATION_ERROR); } if (!resource.isDirectory()) { String originSuffix = FileUtils.suffix(originFullName);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
String suffix = FileUtils.suffix(fullName); boolean suffixIsChanged = false; if (StringUtils.isBlank(suffix) && StringUtils.isNotBlank(originSuffix)) { suffixIsChanged = true; } if (StringUtils.isNotBlank(suffix) && !suffix.equals(originSuffix)) { suffixIsChanged = true; } if (suffixIsChanged) { Map<String, Object> columnMap = new HashMap<>(); columnMap.put("resources_id", resourceId); List<ResourcesUser> resourcesUsers = resourceUserMapper.selectByMap(columnMap); if (CollectionUtils.isNotEmpty(resourcesUsers)) { List<Integer> userIds = resourcesUsers.stream().map(ResourcesUser::getUserId).collect(Collectors.toList()); List<User> users = userMapper.selectBatchIds(userIds); String userNames = users.stream().map(User::getUserName).collect(Collectors.toList()).toString(); logger.error("resource is authorized to user {},suffix not allowed to be modified", userNames); putMsg(result,Status.RESOURCE_IS_AUTHORIZED,userNames); return result; } } } Date now = new Date(); resource.setAlias(name); resource.setFullName(fullName); resource.setDescription(desc); resource.setUpdateTime(now);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
if (file != null) { resource.setFileName(file.getOriginalFilename()); resource.setSize(file.getSize()); } try { resourcesMapper.updateById(resource); if (resource.isDirectory()) { List<Integer> childrenResource = listAllChildren(resource,false); if (CollectionUtils.isNotEmpty(childrenResource)) { String matcherFullName = Matcher.quoteReplacement(fullName); List<Resource> childResourceList; Integer[] childResIdArray = childrenResource.toArray(new Integer[childrenResource.size()]); List<Resource> resourceList = resourcesMapper.listResourceByIds(childResIdArray); childResourceList = resourceList.stream().map(t -> { t.setFullName(t.getFullName().replaceFirst(originFullName, matcherFullName)); t.setUpdateTime(now); return t; }).collect(Collectors.toList()); resourcesMapper.batchUpdateResource(childResourceList); if (ResourceType.UDF.equals(resource.getType())) { List<UdfFunc> udfFuncs = udfFunctionMapper.listUdfByResourceId(childResIdArray); if (CollectionUtils.isNotEmpty(udfFuncs)) { udfFuncs = udfFuncs.stream().map(t -> { t.setResourceName(t.getResourceName().replaceFirst(originFullName, matcherFullName)); t.setUpdateTime(now); return t; }).collect(Collectors.toList()); udfFunctionMapper.batchUpdateUdfFunc(udfFuncs); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
} } else if (ResourceType.UDF.equals(resource.getType())) { List<UdfFunc> udfFuncs = udfFunctionMapper.listUdfByResourceId(new Integer[]{resourceId}); if (CollectionUtils.isNotEmpty(udfFuncs)) { udfFuncs = udfFuncs.stream().map(t -> { t.setResourceName(fullName); t.setUpdateTime(now); return t; }).collect(Collectors.toList()); udfFunctionMapper.batchUpdateUdfFunc(udfFuncs); } } 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); } catch (Exception e) { logger.error(Status.UPDATE_RESOURCE_ERROR.getMsg(), e); throw new ServiceException(Status.UPDATE_RESOURCE_ERROR); } if (originResourceName.equals(name) && file == null) { return result; } if (file != null) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
if (!upload(loginUser, fullName, file, type)) { logger.error("upload resource: {} file: {} failed.", name, RegexUtils.escapeNRT(file.getOriginalFilename())); putMsg(result, Status.HDFS_OPERATION_ERROR); throw new ServiceException(String.format("upload resource: %s file: %s failed.", name, file.getOriginalFilename())); } if (!fullName.equals(originFullName)) { try { HadoopUtils.getInstance().delete(originHdfsFileName,false); } catch (IOException e) { logger.error(e.getMessage(),e); throw new ServiceException(String.format("delete resource: %s failed.", originFullName)); } } return result; } String destHdfsFileName = HadoopUtils.getHdfsFileName(resource.getType(),tenantCode,fullName); try { logger.info("start hdfs copy {} -> {}", originHdfsFileName, destHdfsFileName); HadoopUtils.getInstance().copy(originHdfsFileName, destHdfsFileName, true, true); } 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; } private Result<Object> verifyFile(String name, ResourceType type, MultipartFile file) { Result<Object> result = new Result<>();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
putMsg(result, Status.SUCCESS); if (file != null) { if (file.isEmpty()) { logger.error("file is empty: {}", RegexUtils.escapeNRT(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))) { logger.error("rename file suffix and original suffix must be consistent: {}", RegexUtils.escapeNRT(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: {}", RegexUtils.escapeNRT(file.getOriginalFilename())); putMsg(result, Status.RESOURCE_SIZE_EXCEED_LIMIT); return result; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
return result; } /** * query resources list paging * * @param loginUser login user * @param type resource type * @param searchVal search value * @param pageNo page number * @param pageSize page size * @return resource list page */ @Override public Map<String, Object> queryResourceListPaging(User loginUser, int directoryId, ResourceType type, String searchVal, Integer pageNo, Integer pageSize) { HashMap<String, Object> result = new HashMap<>(); Page<Resource> page = new Page<>(pageNo, pageSize); int userId = loginUser.getId(); if (isAdmin(loginUser)) { userId = 0; } if (directoryId != -1) { Resource directory = resourcesMapper.selectById(directoryId); if (directory == null) { putMsg(result, Status.RESOURCE_NOT_EXIST); return result; } } IPage<Resource> resourceIPage = resourcesMapper.queryResourcePaging(page, userId,directoryId, type.ordinal(), searchVal); PageInfo<Resource> pageInfo = new PageInfo<>(pageNo, pageSize);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
pageInfo.setTotalCount((int)resourceIPage.getTotal()); pageInfo.setLists(resourceIPage.getRecords()); result.put(Constants.DATA_LIST, pageInfo); putMsg(result,Status.SUCCESS); return result; } /** * create directory * @param loginUser login user * @param fullName full name * @param type resource type * @param result Result */ private void createDirectory(User loginUser,String fullName,ResourceType type,Result<Object> 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 ServiceException(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 ServiceException(String.format("create resource directory: %s failed.", directoryName));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
} } /** * upload file to hdfs * * @param loginUser login user * @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);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
HadoopUtils.getInstance().copyLocalToHdfs(localFilename, hdfsFilename, true, true); } catch (Exception e) { logger.error(e.getMessage(), e); return false; } return true; } /** * query resource list * * @param loginUser login user * @param type resource type * @return resource list */ @Override public Map<String, Object> queryResourceList(User loginUser, ResourceType type) { Map<String, Object> result = new HashMap<>(); 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 by program type *
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
* @param loginUser login user * @param type resource type * @return resource list */ @Override public Map<String, Object> queryResourceByProgramType(User loginUser, ResourceType type, ProgramType programType) { Map<String, Object> result = new HashMap<>(); String suffix = ".jar"; int userId = loginUser.getId(); if (isAdmin(loginUser)) { userId = 0; } if (programType != null) { switch (programType) { case JAVA: case SCALA: break; case PYTHON: suffix = ".py"; break; default: } } List<Resource> allResourceList = resourcesMapper.queryResourceListAuthored(userId, type.ordinal(),0); List<Resource> resources = new ResourceFilter(suffix,new ArrayList<>(allResourceList)).filter(); Visitor resourceTreeVisitor = new ResourceTreeVisitor(resources); result.put(Constants.DATA_LIST, resourceTreeVisitor.visit().getChildren()); putMsg(result,Status.SUCCESS); return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
/** * delete resource * * @param loginUser login user * @param resourceId resource id * @return delete result code * @throws IOException exception */ @Override @Transactional(rollbackFor = Exception.class) public Result<Object> delete(User loginUser, int resourceId) throws IOException { Result<Object> result = checkResourceUploadStartupState(); if (!result.getCode().equals(Status.SUCCESS.getCode())) { return result; } Resource resource = resourcesMapper.selectById(resourceId); if (resource == null) { 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; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
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); putMsg(result,Status.UDF_RESOURCE_IS_BOUND,udfFuncs.get(0).getFuncName()); return result; } } if (resourceIdSet.contains(resource.getPid())) { 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; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
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 */ @Override public Result<Object> verifyResourceName(String fullName, ResourceType type, User loginUser) { Result<Object> 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, RegexUtils.escapeNRT(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);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
if (HadoopUtils.getInstance().exists(hdfsFilename)) { logger.error("resource type:{} name:{} has exist in hdfs {}, can't create again.", type, RegexUtils.escapeNRT(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 * @param id resource id * @param type resource type * @return true if the resource full name or pid not exists, otherwise return false */ @Override public Result<Object> queryResource(String fullName, Integer id, ResourceType type) { Result<Object> result = new Result<>(); if (StringUtils.isBlank(fullName) && id == null) { putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR); return result; } if (StringUtils.isNotBlank(fullName)) { List<Resource> resourceList = resourcesMapper.queryResource(fullName,type.ordinal());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
if (CollectionUtils.isEmpty(resourceList)) { 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) { putMsg(result, Status.RESOURCE_NOT_EXIST); return result; } Resource parentResource = resourcesMapper.selectById(resource.getPid()); if (parentResource == null) { 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 */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
@Override public Result<Object> readResource(int resourceId, int skipLineNum, int limit) { Result<Object> result = checkResourceUploadStartupState(); if (!result.getCode().equals(Status.SUCCESS.getCode())) { return result; } Resource resource = resourcesMapper.selectById(resourceId); if (resource == null) { putMsg(result, Status.RESOURCE_NOT_EXIST); return result; } 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);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
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); } } 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 * @param pid pid * @param currentDir current directory * @return create result code
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
*/ @Override @Transactional(rollbackFor = Exception.class) public Result<Object> onlineCreateResource(User loginUser, ResourceType type, String fileName, String fileSuffix, String desc, String content,int pid,String currentDir) { Result<Object> result = checkResourceUploadStartupState(); if (!result.getCode().equals(Status.SUCCESS.getCode())) { return result; } String nameSuffix = fileSuffix.trim(); 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 create", nameSuffix); putMsg(result, Status.RESOURCE_SUFFIX_NOT_SUPPORT_VIEW); return result; } } String name = fileName.trim() + "." + nameSuffix; String fullName = currentDir.equals("/") ? String.format("%s%s",currentDir,name) : String.format("%s/%s",currentDir,name); result = verifyResource(loginUser, type, fullName, pid); 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);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
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())) { throw new ServiceException(result.getMsg()); } return result; } private Result<Object> checkResourceUploadStartupState() { Result<Object> result = new Result<>(); putMsg(result, Status.SUCCESS); if (!PropertyUtils.getResUploadStartupState()) { logger.error("resource upload startup state: {}", PropertyUtils.getResUploadStartupState()); putMsg(result, Status.HDFS_NOT_STARTUP); return result; } return result; } private Result<Object> verifyResource(User loginUser, ResourceType type, String fullName, int pid) { Result<Object> result = verifyResourceName(fullName, type, loginUser); if (!result.getCode().equals(Status.SUCCESS.getCode())) { return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
} return verifyPid(loginUser, pid); } private Result<Object> verifyPid(User loginUser, int pid) { Result<Object> result = new Result<>(); putMsg(result, Status.SUCCESS); 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; } } return result; } /** * updateProcessInstance resource * * @param resourceId resource id * @param content content * @return update result cod */ @Override @Transactional(rollbackFor = Exception.class) public Result<Object> updateResourceContent(int resourceId, String content) { Result<Object> result = checkResourceUploadStartupState();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
if (!result.getCode().equals(Status.SUCCESS.getCode())) { 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)) { 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 ServiceException(result.getMsg());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
} return result; } /** * @param resourceName resource name * @param tenantCode tenant code * @param content content * @return result */ private Result<Object> uploadContentToHdfs(String resourceName, String tenantCode, String content) { Result<Object> result = new Result<>(); String localFilename = ""; String hdfsFileName = ""; try { localFilename = FileUtils.getUploadFilename(tenantCode, UUID.randomUUID().toString()); if (!FileUtils.writeContent2File(content, localFilename)) { logger.error("file {} fail, content is {}", localFilename, RegexUtils.escapeNRT(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 {}, resource dir is {}", hdfsFileName, resourcePath); HadoopUtils hadoopUtils = HadoopUtils.getInstance(); if (!hadoopUtils.exists(resourcePath)) { createTenantDirIfNotExists(tenantCode); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
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; } /** * download file * * @param resourceId resource id * @return resource content * @throws IOException exception */ @Override public org.springframework.core.io.Resource downloadResource(int resourceId) throws IOException { if (!PropertyUtils.getResUploadStartupState()) { logger.error("resource upload startup state: {}", PropertyUtils.getResUploadStartupState()); throw new ServiceException("hdfs not startup"); } Resource resource = resourcesMapper.selectById(resourceId); if (resource == null) { logger.error("download file not exist, resource id {}", resourceId);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
return null; } if (resource.isDirectory()) { logger.error("resource id {} is directory,can't download it", resourceId); throw new ServiceException("can't download directory"); } int userId = resource.getUserId(); User user = userMapper.selectById(userId); if (user == null) { logger.error("user id {} not exists", userId); throw new ServiceException(String.format("resource owner id %d not exist",userId)); } Tenant tenant = tenantMapper.queryById(user.getTenantId()); if (tenant == null) { logger.error("tenant id {} not exists", user.getTenantId()); throw new ServiceException(String.format("The tenant id %d of resource owner not exist",user.getTenantId())); } String tenantCode = tenant.getTenantCode(); String hdfsFileName = HadoopUtils.getHdfsFileName(resource.getType(), tenantCode, resource.getFullName()); String localFileName = FileUtils.getDownloadFilename(resource.getAlias()); logger.info("resource hdfs path is {}, download local filename is {}", hdfsFileName, localFileName); HadoopUtils.getInstance().copyHdfsToLocal(hdfsFileName, localFileName, false, true); return org.apache.dolphinscheduler.api.utils.FileUtils.file2Resource(localFileName); } /** * list all file * * @param loginUser login user * @param userId user id * @return unauthorized result code
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
*/ @Override public Map<String, Object> authorizeResourceTree(User loginUser, Integer userId) { Map<String, Object> result = new HashMap<>(); if (isNotAdmin(loginUser, result)) { return result; } List<Resource> resourceList = resourcesMapper.queryResourceExceptUserId(userId); List<ResourceComponent> list; if (CollectionUtils.isNotEmpty(resourceList)) { Visitor visitor = new ResourceTreeVisitor(resourceList); list = visitor.visit().getChildren(); } else { list = new ArrayList<>(0); } result.put(Constants.DATA_LIST, list); putMsg(result, Status.SUCCESS); return result; } /** * unauthorized file * * @param loginUser login user * @param userId user id * @return unauthorized result code */ @Override public Map<String, Object> unauthorizedFile(User loginUser, Integer userId) { Map<String, Object> result = new HashMap<>(); if (isNotAdmin(loginUser, result)) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
return result; } List<Resource> resourceList = resourcesMapper.queryResourceExceptUserId(userId); List<Resource> list; if (resourceList != null && !resourceList.isEmpty()) { Set<Resource> resourceSet = new HashSet<>(resourceList); List<Resource> authedResourceList = resourcesMapper.queryAuthorizedResourceList(userId); getAuthorizedResourceList(resourceSet, authedResourceList); list = new ArrayList<>(resourceSet); } else { list = new ArrayList<>(0); } Visitor visitor = new ResourceTreeVisitor(list); result.put(Constants.DATA_LIST, visitor.visit().getChildren()); putMsg(result, Status.SUCCESS); return result; } /** * unauthorized udf function * * @param loginUser login user * @param userId user id * @return unauthorized result code */ @Override public Map<String, Object> unauthorizedUDFFunction(User loginUser, Integer userId) { Map<String, Object> result = new HashMap<>(); if (isNotAdmin(loginUser, result)) { return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
} List<UdfFunc> udfFuncList = udfFunctionMapper.queryUdfFuncExceptUserId(userId); List<UdfFunc> resultList = new ArrayList<>(); Set<UdfFunc> udfFuncSet; if (CollectionUtils.isNotEmpty(udfFuncList)) { udfFuncSet = new HashSet<>(udfFuncList); List<UdfFunc> authedUDFFuncList = udfFunctionMapper.queryAuthedUdfFunc(userId); getAuthorizedResourceList(udfFuncSet, authedUDFFuncList); resultList = new ArrayList<>(udfFuncSet); } result.put(Constants.DATA_LIST, resultList); putMsg(result, Status.SUCCESS); return result; } /** * authorized udf function * * @param loginUser login user * @param userId user id * @return authorized result code */ @Override public Map<String, Object> authorizedUDFFunction(User loginUser, Integer userId) { Map<String, Object> result = new HashMap<>(); if (isNotAdmin(loginUser, result)) { return result; } List<UdfFunc> udfFuncs = udfFunctionMapper.queryAuthedUdfFunc(userId); result.put(Constants.DATA_LIST, udfFuncs); putMsg(result, Status.SUCCESS);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
return result; } /** * authorized file * * @param loginUser login user * @param userId user id * @return authorized result */ @Override public Map<String, Object> authorizedFile(User loginUser, Integer userId) { Map<String, Object> result = new HashMap<>(); if (isNotAdmin(loginUser, result)) { return result; } List<Resource> authedResources = resourcesMapper.queryAuthorizedResourceList(userId); Visitor visitor = new ResourceTreeVisitor(authedResources); String visit = JSONUtils.toJsonString(visitor.visit(), SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS); logger.info(visit); String jsonTreeStr = JSONUtils.toJsonString(visitor.visit().getChildren(), SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS); logger.info(jsonTreeStr); result.put(Constants.DATA_LIST, visitor.visit().getChildren()); putMsg(result,Status.SUCCESS); return result; } /** * get authorized resource list * * @param resourceSet resource set * @param authedResourceList authorized resource list
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
*/ private void getAuthorizedResourceList(Set<?> resourceSet, List<?> authedResourceList) { Set<?> authedResourceSet; if (CollectionUtils.isNotEmpty(authedResourceList)) { authedResourceSet = new HashSet<>(authedResourceList); resourceSet.removeAll(authedResourceSet); } } /** * get tenantCode by UserId * * @param userId user id * @param result return result * @return tenant code */ private String getTenantCode(int userId,Result<Object> result) { User user = userMapper.selectById(userId); if (user == null) { logger.error("user {} not exists", userId); putMsg(result, Status.USER_NOT_EXIST,userId); return null; } Tenant tenant = tenantMapper.queryById(user.getTenantId()); if (tenant == null) { logger.error("tenant not exists"); putMsg(result, Status.TENANT_NOT_EXIST); return null; } return tenant.getTenantCode(); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
/** * list all children id * @param resource resource * @param containSelf whether add self to children list * @return all children id */ List<Integer> listAllChildren(Resource resource,boolean containSelf) { List<Integer> childList = new ArrayList<>(); if (resource.getId() != -1 && containSelf) { childList.add(resource.getId()); } if (resource.isDirectory()) { listAllChildren(resource.getId(),childList); } return childList; } /** * list all children id * @param resourceId resource id * @param childList child list */ void listAllChildren(int resourceId,List<Integer> childList) { List<Integer> children = resourcesMapper.listChildren(resourceId); for (int childId : children) { childList.add(childId); listAllChildren(childId, childList); } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.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.common; import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.utils.OSUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; import java.util.regex.Pattern; /** * Constants */ public final class Constants {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
private Constants() { throw new UnsupportedOperationException("Construct Constants"); } /** * quartz config */ public static final String ORG_QUARTZ_JOBSTORE_DRIVERDELEGATECLASS = "org.quartz.jobStore.driverDelegateClass"; public static final String ORG_QUARTZ_SCHEDULER_INSTANCENAME = "org.quartz.scheduler.instanceName"; public static final String ORG_QUARTZ_SCHEDULER_INSTANCEID = "org.quartz.scheduler.instanceId"; public static final String ORG_QUARTZ_SCHEDULER_MAKESCHEDULERTHREADDAEMON = "org.quartz.scheduler.makeSchedulerThreadDaemon"; public static final String ORG_QUARTZ_JOBSTORE_USEPROPERTIES = "org.quartz.jobStore.useProperties"; public static final String ORG_QUARTZ_THREADPOOL_CLASS = "org.quartz.threadPool.class"; public static final String ORG_QUARTZ_THREADPOOL_THREADCOUNT = "org.quartz.threadPool.threadCount"; public static final String ORG_QUARTZ_THREADPOOL_MAKETHREADSDAEMONS = "org.quartz.threadPool.makeThreadsDaemons"; public static final String ORG_QUARTZ_THREADPOOL_THREADPRIORITY = "org.quartz.threadPool.threadPriority"; public static final String ORG_QUARTZ_JOBSTORE_CLASS = "org.quartz.jobStore.class"; public static final String ORG_QUARTZ_JOBSTORE_TABLEPREFIX = "org.quartz.jobStore.tablePrefix"; public static final String ORG_QUARTZ_JOBSTORE_ISCLUSTERED = "org.quartz.jobStore.isClustered"; public static final String ORG_QUARTZ_JOBSTORE_MISFIRETHRESHOLD = "org.quartz.jobStore.misfireThreshold"; public static final String ORG_QUARTZ_JOBSTORE_CLUSTERCHECKININTERVAL = "org.quartz.jobStore.clusterCheckinInterval"; public static final String ORG_QUARTZ_JOBSTORE_ACQUIRETRIGGERSWITHINLOCK = "org.quartz.jobStore.acquireTriggersWithinLock"; public static final String ORG_QUARTZ_JOBSTORE_DATASOURCE = "org.quartz.jobStore.dataSource"; public static final String ORG_QUARTZ_DATASOURCE_MYDS_CONNECTIONPROVIDER_CLASS = "org.quartz.dataSource.myDs.connectionProvider.class"; /** * quartz config default value
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
*/ public static final String QUARTZ_TABLE_PREFIX = "QRTZ_"; public static final String QUARTZ_MISFIRETHRESHOLD = "60000"; public static final String QUARTZ_CLUSTERCHECKININTERVAL = "5000"; public static final String QUARTZ_DATASOURCE = "myDs"; public static final String QUARTZ_THREADCOUNT = "25"; public static final String QUARTZ_THREADPRIORITY = "5"; public static final String QUARTZ_INSTANCENAME = "DolphinScheduler"; public static final String QUARTZ_INSTANCEID = "AUTO"; public static final String QUARTZ_ACQUIRETRIGGERSWITHINLOCK = "true"; /** * common properties path */ public static final String COMMON_PROPERTIES_PATH = "/common.properties"; /** * fs.defaultFS */ public static final String FS_DEFAULTFS = "fs.defaultFS"; /** * fs s3a endpoint */ public static final String FS_S3A_ENDPOINT = "fs.s3a.endpoint"; /** * fs s3a access key */ public static final String FS_S3A_ACCESS_KEY = "fs.s3a.access.key"; /** * fs s3a secret key */ public static final String FS_S3A_SECRET_KEY = "fs.s3a.secret.key";
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
/** * yarn.resourcemanager.ha.rm.ids */ public static final String YARN_RESOURCEMANAGER_HA_RM_IDS = "yarn.resourcemanager.ha.rm.ids"; public static final String YARN_RESOURCEMANAGER_HA_XX = "xx"; /** * yarn.application.status.address */ public static final String YARN_APPLICATION_STATUS_ADDRESS = "yarn.application.status.address"; /** * yarn.job.history.status.address */ public static final String YARN_JOB_HISTORY_STATUS_ADDRESS = "yarn.job.history.status.address"; /** * hdfs configuration * hdfs.root.user */ public static final String HDFS_ROOT_USER = "hdfs.root.user"; /** * hdfs/s3 configuration * resource.upload.path */ public static final String RESOURCE_UPLOAD_PATH = "resource.upload.path"; /** * data basedir path */ public static final String DATA_BASEDIR_PATH = "data.basedir.path"; /** * dolphinscheduler.env.path */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final String DOLPHINSCHEDULER_ENV_PATH = "dolphinscheduler.env.path"; /** * environment properties default path */ public static final String ENV_PATH = "env/dolphinscheduler_env.sh"; /** * python home */ public static final String PYTHON_HOME = "PYTHON_HOME"; /** * resource.view.suffixs */ public static final String RESOURCE_VIEW_SUFFIXS = "resource.view.suffixs"; public static final String RESOURCE_VIEW_SUFFIXS_DEFAULT_VALUE = "txt,log,sh,bat,conf,cfg,py,java,sql,xml,hql,properties,json,yml,yaml,ini,js"; /** * development.state */ public static final String DEVELOPMENT_STATE = "development.state"; public static final String DEVELOPMENT_STATE_DEFAULT_VALUE = "true"; /** * string true */ public static final String STRING_TRUE = "true"; /** * string false */ public static final String STRING_FALSE = "false"; /** * resource storage type */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final String RESOURCE_STORAGE_TYPE = "resource.storage.type"; /** * MasterServer directory registered in zookeeper */ public static final String ZOOKEEPER_DOLPHINSCHEDULER_MASTERS = "/nodes/master"; /** * WorkerServer directory registered in zookeeper */ public static final String ZOOKEEPER_DOLPHINSCHEDULER_WORKERS = "/nodes/worker"; /** * all servers directory registered in zookeeper */ public static final String ZOOKEEPER_DOLPHINSCHEDULER_DEAD_SERVERS = "/dead-servers"; /** * MasterServer lock directory registered in zookeeper */ public static final String ZOOKEEPER_DOLPHINSCHEDULER_LOCK_MASTERS = "/lock/masters"; /** * MasterServer failover directory registered in zookeeper */ public static final String ZOOKEEPER_DOLPHINSCHEDULER_LOCK_FAILOVER_MASTERS = "/lock/failover/masters"; /** * WorkerServer failover directory registered in zookeeper */ public static final String ZOOKEEPER_DOLPHINSCHEDULER_LOCK_FAILOVER_WORKERS = "/lock/failover/workers"; /** * MasterServer startup failover runing and fault tolerance process */ public static final String ZOOKEEPER_DOLPHINSCHEDULER_LOCK_FAILOVER_STARTUP_MASTERS = "/lock/failover/startup-masters"; /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
* comma , */ public static final String COMMA = ","; /** * slash / */ public static final String SLASH = "/"; /** * COLON : */ public static final String COLON = ":"; /** * SPACE " " */ public static final String SPACE = " "; /** * SINGLE_SLASH / */ public static final String SINGLE_SLASH = "/"; /** * DOUBLE_SLASH // */ public static final String DOUBLE_SLASH = "//"; /** * SINGLE_QUOTES "'" */ public static final String SINGLE_QUOTES = "'"; /** * DOUBLE_QUOTES "\"" */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final String DOUBLE_QUOTES = "\""; /** * SEMICOLON ; */ public static final String SEMICOLON = ";"; /** * EQUAL SIGN */ public static final String EQUAL_SIGN = "="; /** * AT SIGN */ public static final String AT_SIGN = "@"; public static final String WORKER_MAX_CPULOAD_AVG = "worker.max.cpuload.avg"; public static final String WORKER_RESERVED_MEMORY = "worker.reserved.memory"; public static final String MASTER_MAX_CPULOAD_AVG = "master.max.cpuload.avg"; public static final String MASTER_RESERVED_MEMORY = "master.reserved.memory"; /** * date format of yyyy-MM-dd HH:mm:ss */ public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; /** * date format of yyyyMMddHHmmss */ public static final String YYYYMMDDHHMMSS = "yyyyMMddHHmmss"; /** * date format of yyyyMMddHHmmssSSS */ public static final String YYYYMMDDHHMMSSSSS = "yyyyMMddHHmmssSSS"; /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
* http connect time out */ public static final int HTTP_CONNECT_TIMEOUT = 60 * 1000; /** * http connect request time out */ public static final int HTTP_CONNECTION_REQUEST_TIMEOUT = 60 * 1000; /** * httpclient soceket time out */ public static final int SOCKET_TIMEOUT = 60 * 1000; /** * http header */ public static final String HTTP_HEADER_UNKNOWN = "unKnown"; /** * http X-Forwarded-For */ public static final String HTTP_X_FORWARDED_FOR = "X-Forwarded-For"; /** * http X-Real-IP */ public static final String HTTP_X_REAL_IP = "X-Real-IP"; /** * UTF-8 */ public static final String UTF_8 = "UTF-8"; /** * user name regex */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final Pattern REGEX_USER_NAME = Pattern.compile("^[a-zA-Z0-9._-]{3,39}$"); /** * email regex */ public static final Pattern REGEX_MAIL_NAME = Pattern.compile("^([a-z0-9A-Z]+[_|\\-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$"); /** * read permission */ public static final int READ_PERMISSION = 2 * 1; /** * write permission */ public static final int WRITE_PERMISSION = 2 * 2; /** * execute permission */ public static final int EXECUTE_PERMISSION = 1; /** * default admin permission */ public static final int DEFAULT_ADMIN_PERMISSION = 7; /** * all permissions */ public static final int ALL_PERMISSIONS = READ_PERMISSION | WRITE_PERMISSION | EXECUTE_PERMISSION; /** * max task timeout */ public static final int MAX_TASK_TIMEOUT = 24 * 3600; /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
* master cpu load */ public static final int DEFAULT_MASTER_CPU_LOAD = Runtime.getRuntime().availableProcessors() * 2; /** * master reserved memory */ public static final double DEFAULT_MASTER_RESERVED_MEMORY = OSUtils.totalMemorySize() / 10; /** * worker cpu load */ public static final int DEFAULT_WORKER_CPU_LOAD = Runtime.getRuntime().availableProcessors() * 2; /** * worker reserved memory */ public static final double DEFAULT_WORKER_RESERVED_MEMORY = OSUtils.totalMemorySize() / 10; /** * worker host weight */ public static final int DEFAULT_WORKER_HOST_WEIGHT = 100; /** * default log cache rows num,output when reach the number */ public static final int DEFAULT_LOG_ROWS_NUM = 4 * 16; /** * log flush interval?output when reach the interval */ public static final int DEFAULT_LOG_FLUSH_INTERVAL = 1000; /** * time unit secong to minutes */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final int SEC_2_MINUTES_TIME_UNIT = 60; /*** * * rpc port */ public static final int RPC_PORT = 50051; /*** * alert rpc port */ public static final int ALERT_RPC_PORT = 50052; /** * forbid running task */ public static final String FLOWNODE_RUN_FLAG_FORBIDDEN = "FORBIDDEN"; /** * datasource configuration path */ public static final String DATASOURCE_PROPERTIES = "/datasource.properties"; public static final String TASK_RECORD_URL = "task.record.datasource.url"; public static final String TASK_RECORD_FLAG = "task.record.flag"; public static final String TASK_RECORD_USER = "task.record.datasource.username"; public static final String TASK_RECORD_PWD = "task.record.datasource.password"; public static final String DEFAULT = "Default"; public static final String USER = "user"; public static final String PASSWORD = "password"; public static final String XXXXXX = "******"; public static final String NULL = "NULL"; public static final String THREAD_NAME_MASTER_SERVER = "Master-Server"; public static final String THREAD_NAME_WORKER_SERVER = "Worker-Server"; public static final String TASK_RECORD_TABLE_HIVE_LOG = "eamp_hive_log_hd";
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final String TASK_RECORD_TABLE_HISTORY_HIVE_LOG = "eamp_hive_hist_log_hd"; /** * command parameter keys */ public static final String CMD_PARAM_RECOVER_PROCESS_ID_STRING = "ProcessInstanceId"; public static final String CMD_PARAM_RECOVERY_START_NODE_STRING = "StartNodeIdList"; public static final String CMD_PARAM_RECOVERY_WAITING_THREAD = "WaitingThreadInstanceId"; public static final String CMD_PARAM_SUB_PROCESS = "processInstanceId"; public static final String CMD_PARAM_EMPTY_SUB_PROCESS = "0"; public static final String CMD_PARAM_SUB_PROCESS_PARENT_INSTANCE_ID = "parentProcessInstanceId"; public static final String CMD_PARAM_SUB_PROCESS_DEFINE_ID = "processDefinitionId"; public static final String CMD_PARAM_START_NODE_NAMES = "StartNodeNameList"; public static final String CMD_PARAM_START_PARAMS = "StartParams"; public static final String CMD_PARAM_FATHER_PARAMS = "fatherParams"; /** * complement data start date */ public static final String CMDPARAM_COMPLEMENT_DATA_START_DATE = "complementStartDate"; /** * complement data end date */ public static final String CMDPARAM_COMPLEMENT_DATA_END_DATE = "complementEndDate"; /** * hadoop configuration */ public static final String HADOOP_RM_STATE_ACTIVE = "ACTIVE"; public static final String HADOOP_RM_STATE_STANDBY = "STANDBY"; public static final String HADOOP_RESOURCE_MANAGER_HTTPADDRESS_PORT = "resource.manager.httpaddress.port"; /** * data source config
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
*/ public static final String SPRING_DATASOURCE_DRIVER_CLASS_NAME = "spring.datasource.driver-class-name"; public static final String SPRING_DATASOURCE_URL = "spring.datasource.url"; public static final String SPRING_DATASOURCE_USERNAME = "spring.datasource.username"; public static final String SPRING_DATASOURCE_PASSWORD = "spring.datasource.password"; public static final String SPRING_DATASOURCE_VALIDATION_QUERY_TIMEOUT = "spring.datasource.validationQueryTimeout"; public static final String SPRING_DATASOURCE_INITIAL_SIZE = "spring.datasource.initialSize"; public static final String SPRING_DATASOURCE_MIN_IDLE = "spring.datasource.minIdle"; public static final String SPRING_DATASOURCE_MAX_ACTIVE = "spring.datasource.maxActive"; public static final String SPRING_DATASOURCE_MAX_WAIT = "spring.datasource.maxWait"; public static final String SPRING_DATASOURCE_TIME_BETWEEN_EVICTION_RUNS_MILLIS = "spring.datasource.timeBetweenEvictionRunsMillis"; public static final String SPRING_DATASOURCE_TIME_BETWEEN_CONNECT_ERROR_MILLIS = "spring.datasource.timeBetweenConnectErrorMillis"; public static final String SPRING_DATASOURCE_MIN_EVICTABLE_IDLE_TIME_MILLIS = "spring.datasource.minEvictableIdleTimeMillis"; public static final String SPRING_DATASOURCE_VALIDATION_QUERY = "spring.datasource.validationQuery"; public static final String SPRING_DATASOURCE_TEST_WHILE_IDLE = "spring.datasource.testWhileIdle"; public static final String SPRING_DATASOURCE_TEST_ON_BORROW = "spring.datasource.testOnBorrow"; public static final String SPRING_DATASOURCE_TEST_ON_RETURN = "spring.datasource.testOnReturn"; public static final String SPRING_DATASOURCE_POOL_PREPARED_STATEMENTS = "spring.datasource.poolPreparedStatements"; public static final String SPRING_DATASOURCE_DEFAULT_AUTO_COMMIT = "spring.datasource.defaultAutoCommit"; public static final String SPRING_DATASOURCE_KEEP_ALIVE = "spring.datasource.keepAlive"; public static final String SPRING_DATASOURCE_MAX_POOL_PREPARED_STATEMENT_PER_CONNECTION_SIZE = "spring.datasource.maxPoolPreparedStatementPerConnectionSize"; public static final String DEVELOPMENT = "development"; public static final String QUARTZ_PROPERTIES_PATH = "quartz.properties"; /** * sleep time */ public static final int SLEEP_TIME_MILLIS = 1000; /** * heartbeat for zk info length */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final int HEARTBEAT_FOR_ZOOKEEPER_INFO_LENGTH = 10; public static final int HEARTBEAT_WITH_WEIGHT_FOR_ZOOKEEPER_INFO_LENGTH = 11; /** * jar */ public static final String JAR = "jar"; /** * hadoop */ public static final String HADOOP = "hadoop"; /** * -D <property>=<value> */ public static final String D = "-D"; /** * -D mapreduce.job.name=name */ public static final String MR_NAME = "mapreduce.job.name"; /** * -D mapreduce.job.queuename=queuename */ public static final String MR_QUEUE = "mapreduce.job.queuename"; /** * spark params constant */ public static final String MASTER = "--master"; public static final String DEPLOY_MODE = "--deploy-mode"; /** * --class CLASS_NAME */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final String MAIN_CLASS = "--class"; /** * --driver-cores NUM */ public static final String DRIVER_CORES = "--driver-cores"; /** * --driver-memory MEM */ public static final String DRIVER_MEMORY = "--driver-memory"; /** * --num-executors NUM */ public static final String NUM_EXECUTORS = "--num-executors"; /** * --executor-cores NUM */ public static final String EXECUTOR_CORES = "--executor-cores"; /** * --executor-memory MEM */ public static final String EXECUTOR_MEMORY = "--executor-memory"; /** * --name NAME */ public static final String SPARK_NAME = "--name"; /** * --queue QUEUE */ public static final String SPARK_QUEUE = "--queue"; /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
* exit code success */ public static final int EXIT_CODE_SUCCESS = 0; /** * exit code kill */ public static final int EXIT_CODE_KILL = 137; /** * exit code failure */ public static final int EXIT_CODE_FAILURE = -1; /** * date format of yyyyMMdd */ public static final String PARAMETER_FORMAT_DATE = "yyyyMMdd"; /** * date format of yyyyMMddHHmmss */ public static final String PARAMETER_FORMAT_TIME = "yyyyMMddHHmmss"; /** * system date(yyyyMMddHHmmss) */ public static final String PARAMETER_DATETIME = "system.datetime"; /** * system date(yyyymmdd) today */ public static final String PARAMETER_CURRENT_DATE = "system.biz.curdate"; /** * system date(yyyymmdd) yesterday */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final String PARAMETER_BUSINESS_DATE = "system.biz.date"; /** * ACCEPTED */ public static final String ACCEPTED = "ACCEPTED"; /** * SUCCEEDED */ public static final String SUCCEEDED = "SUCCEEDED"; /** * NEW */ public static final String NEW = "NEW"; /** * NEW_SAVING */ public static final String NEW_SAVING = "NEW_SAVING"; /** * SUBMITTED */ public static final String SUBMITTED = "SUBMITTED"; /** * FAILED */ public static final String FAILED = "FAILED"; /** * KILLED */ public static final String KILLED = "KILLED"; /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
* RUNNING */ public static final String RUNNING = "RUNNING"; /** * underline "_" */ public static final String UNDERLINE = "_"; /** * quartz job prifix */ public static final String QUARTZ_JOB_PRIFIX = "job"; /** * quartz job group prifix */ public static final String QUARTZ_JOB_GROUP_PRIFIX = "jobgroup"; /** * projectId */ public static final String PROJECT_ID = "projectId"; /** * processId */ public static final String SCHEDULE_ID = "scheduleId"; /** * schedule */ public static final String SCHEDULE = "schedule"; /** * application regex */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final String APPLICATION_REGEX = "application_\\d+_\\d+"; public static final String PID = OSUtils.isWindows() ? "handle" : "pid"; /** * month_begin */ public static final String MONTH_BEGIN = "month_begin"; /** * add_months */ public static final String ADD_MONTHS = "add_months"; /** * month_end */ public static final String MONTH_END = "month_end"; /** * week_begin */ public static final String WEEK_BEGIN = "week_begin"; /** * week_end */ public static final String WEEK_END = "week_end"; /** * timestamp */ public static final String TIMESTAMP = "timestamp"; public static final char SUBTRACT_CHAR = '-'; public static final char ADD_CHAR = '+'; public static final char MULTIPLY_CHAR = '*'; public static final char DIVISION_CHAR = '/';
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final char LEFT_BRACE_CHAR = '('; public static final char RIGHT_BRACE_CHAR = ')'; public static final String ADD_STRING = "+"; public static final String MULTIPLY_STRING = "*"; public static final String DIVISION_STRING = "/"; public static final String LEFT_BRACE_STRING = "("; public static final char P = 'P'; public static final char N = 'N'; public static final String SUBTRACT_STRING = "-"; public static final String GLOBAL_PARAMS = "globalParams"; public static final String LOCAL_PARAMS = "localParams"; public static final String LOCAL_PARAMS_LIST = "localParamsList"; public static final String SUBPROCESS_INSTANCE_ID = "subProcessInstanceId"; public static final String PROCESS_INSTANCE_STATE = "processInstanceState"; public static final String PARENT_WORKFLOW_INSTANCE = "parentWorkflowInstance"; public static final String TASK_TYPE = "taskType"; public static final String TASK_LIST = "taskList"; public static final String RWXR_XR_X = "rwxr-xr-x"; public static final String QUEUE = "queue"; public static final String QUEUE_NAME = "queueName"; public static final int LOG_QUERY_SKIP_LINE_NUMBER = 0; public static final int LOG_QUERY_LIMIT = 4096; /** * master/worker server use for zk */ public static final String MASTER_PREFIX = "master"; public static final String WORKER_PREFIX = "worker"; public static final String DELETE_ZK_OP = "delete"; public static final String ADD_ZK_OP = "add"; public static final String ALIAS = "alias";
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final String CONTENT = "content"; public static final String DEPENDENT_SPLIT = ":||"; public static final String DEPENDENT_ALL = "ALL"; /** * preview schedule execute count */ public static final int PREVIEW_SCHEDULE_EXECUTE_COUNT = 5; /** * kerberos */ public static final String KERBEROS = "kerberos"; /** * kerberos expire time */ public static final String KERBEROS_EXPIRE_TIME = "kerberos.expire.time"; /** * java.security.krb5.conf */ public static final String JAVA_SECURITY_KRB5_CONF = "java.security.krb5.conf"; /** * java.security.krb5.conf.path */ public static final String JAVA_SECURITY_KRB5_CONF_PATH = "java.security.krb5.conf.path"; /** * hadoop.security.authentication */ public static final String HADOOP_SECURITY_AUTHENTICATION = "hadoop.security.authentication"; /** * hadoop.security.authentication */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final String HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE = "hadoop.security.authentication.startup.state"; /** * com.amazonaws.services.s3.enableV4 */ public static final String AWS_S3_V4 = "com.amazonaws.services.s3.enableV4"; /** * loginUserFromKeytab user */ public static final String LOGIN_USER_KEY_TAB_USERNAME = "login.user.keytab.username"; /** * default worker group id */ public static final int DEFAULT_WORKER_ID = -1; /** * loginUserFromKeytab path */ public static final String LOGIN_USER_KEY_TAB_PATH = "login.user.keytab.path"; /** * task log info format */ public static final String TASK_LOG_INFO_FORMAT = "TaskLogInfo-%s"; /** * hive conf */ public static final String HIVE_CONF = "hiveconf:"; /** * flink */ public static final String FLINK_YARN_CLUSTER = "yarn-cluster"; public static final String FLINK_RUN_MODE = "-m";
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final String FLINK_YARN_SLOT = "-ys"; public static final String FLINK_APP_NAME = "-ynm"; public static final String FLINK_QUEUE = "-yqu"; public static final String FLINK_TASK_MANAGE = "-yn"; public static final String FLINK_JOB_MANAGE_MEM = "-yjm"; public static final String FLINK_TASK_MANAGE_MEM = "-ytm"; public static final String FLINK_MAIN_CLASS = "-c"; public static final String FLINK_PARALLELISM = "-p"; public static final String FLINK_SHUTDOWN_ON_ATTACHED_EXIT = "-sae"; public static final int[] NOT_TERMINATED_STATES = new int[] { ExecutionStatus.SUBMITTED_SUCCESS.ordinal(), ExecutionStatus.RUNNING_EXECUTION.ordinal(), ExecutionStatus.DELAY_EXECUTION.ordinal(), ExecutionStatus.READY_PAUSE.ordinal(), ExecutionStatus.READY_STOP.ordinal(), ExecutionStatus.NEED_FAULT_TOLERANCE.ordinal(), ExecutionStatus.WAITTING_THREAD.ordinal(), ExecutionStatus.WAITTING_DEPEND.ordinal() }; /** * status */ public static final String STATUS = "status"; /** * message */ public static final String MSG = "msg"; /** * data total */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final String COUNT = "count"; /** * page size */ public static final String PAGE_SIZE = "pageSize"; /** * current page no */ public static final String PAGE_NUMBER = "pageNo"; /** * */ public static final String DATA_LIST = "data"; public static final String TOTAL_LIST = "totalList"; public static final String CURRENT_PAGE = "currentPage"; public static final String TOTAL_PAGE = "totalPage"; public static final String TOTAL = "total"; /** * workflow */ public static final String WORKFLOW_LIST = "workFlowList"; public static final String WORKFLOW_RELATION_LIST = "workFlowRelationList"; /** * session user */ public static final String SESSION_USER = "session.user"; public static final String SESSION_ID = "sessionId"; public static final String PASSWORD_DEFAULT = "******"; /** * locale
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
*/ public static final String LOCALE_LANGUAGE = "language"; /** * driver */ public static final String ORG_POSTGRESQL_DRIVER = "org.postgresql.Driver"; public static final String COM_MYSQL_JDBC_DRIVER = "com.mysql.jdbc.Driver"; public static final String ORG_APACHE_HIVE_JDBC_HIVE_DRIVER = "org.apache.hive.jdbc.HiveDriver"; public static final String COM_CLICKHOUSE_JDBC_DRIVER = "ru.yandex.clickhouse.ClickHouseDriver"; public static final String COM_ORACLE_JDBC_DRIVER = "oracle.jdbc.driver.OracleDriver"; public static final String COM_SQLSERVER_JDBC_DRIVER = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; public static final String COM_DB2_JDBC_DRIVER = "com.ibm.db2.jcc.DB2Driver"; public static final String COM_PRESTO_JDBC_DRIVER = "com.facebook.presto.jdbc.PrestoDriver"; /** * database type */ public static final String MYSQL = "MYSQL"; public static final String POSTGRESQL = "POSTGRESQL"; public static final String HIVE = "HIVE"; public static final String SPARK = "SPARK"; public static final String CLICKHOUSE = "CLICKHOUSE"; public static final String ORACLE = "ORACLE"; public static final String SQLSERVER = "SQLSERVER"; public static final String DB2 = "DB2"; public static final String PRESTO = "PRESTO"; /** * jdbc url */ public static final String JDBC_MYSQL = "jdbc:mysql://"; public static final String JDBC_POSTGRESQL = "jdbc:postgresql://";
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final String JDBC_HIVE_2 = "jdbc:hive2://"; public static final String JDBC_CLICKHOUSE = "jdbc:clickhouse://"; public static final String JDBC_ORACLE_SID = "jdbc:oracle:thin:@"; public static final String JDBC_ORACLE_SERVICE_NAME = "jdbc:oracle:thin:@//"; public static final String JDBC_SQLSERVER = "jdbc:sqlserver://"; public static final String JDBC_DB2 = "jdbc:db2://"; public static final String JDBC_PRESTO = "jdbc:presto://"; public static final String ADDRESS = "address"; public static final String DATABASE = "database"; public static final String JDBC_URL = "jdbcUrl"; public static final String PRINCIPAL = "principal"; public static final String OTHER = "other"; public static final String ORACLE_DB_CONNECT_TYPE = "connectType"; public static final String KERBEROS_KRB5_CONF_PATH = "javaSecurityKrb5Conf"; public static final String KERBEROS_KEY_TAB_USERNAME = "loginUserKeytabUsername"; public static final String KERBEROS_KEY_TAB_PATH = "loginUserKeytabPath"; /** * session timeout */ public static final int SESSION_TIME_OUT = 7200; public static final int MAX_FILE_SIZE = 1024 * 1024 * 1024; public static final String UDF = "UDF"; public static final String CLASS = "class"; public static final String RECEIVERS = "receivers"; public static final String RECEIVERS_CC = "receiversCc"; /** * dataSource sensitive param */ public static final String DATASOURCE_PASSWORD_REGEX = "(?<=(\"password\":\")).*?(?=(\"))"; /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
* default worker group */ public static final String DEFAULT_WORKER_GROUP = "default"; public static final Integer TASK_INFO_LENGTH = 5; /** * new * schedule time */ public static final String PARAMETER_SHECDULE_TIME = "schedule.time"; /** * authorize writable perm */ public static final int AUTHORIZE_WRITABLE_PERM = 7; /** * authorize readable perm */ public static final int AUTHORIZE_READABLE_PERM = 4; /** * plugin configurations */ public static final String PLUGIN_JAR_SUFFIX = ".jar"; public static final int NORMAL_NODE_STATUS = 0; public static final int ABNORMAL_NODE_STATUS = 1; public static final String START_TIME = "start time"; public static final String END_TIME = "end time"; public static final String START_END_DATE = "startDate,endDate"; /** * system line separator */ public static final String SYSTEM_LINE_SEPARATOR = System.getProperty("line.separator");
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
/** * net system properties */ public static final String DOLPHIN_SCHEDULER_PREFERRED_NETWORK_INTERFACE = "dolphin.scheduler.network.interface.preferred"; public static final String EXCEL_SUFFIX_XLS = ".xls"; /** * datasource encryption salt */ public static final String DATASOURCE_ENCRYPTION_SALT_DEFAULT = "!@#$%^&*"; public static final String DATASOURCE_ENCRYPTION_ENABLE = "datasource.encryption.enable"; public static final String DATASOURCE_ENCRYPTION_SALT = "datasource.encryption.salt"; /** * Network IP gets priority, default inner outer */ public static final String NETWORK_PRIORITY_STRATEGY = "dolphin.scheduler.network.priority.strategy"; /** * exec shell scripts */ public static final String SH = "sh"; /** * pstree, get pud and sub pid */ public static final String PSTREE = "pstree"; /** * docker & kubernetes */ public static final boolean DOCKER_MODE = StringUtils.isNotEmpty(System.getenv("DOCKER")); public static final boolean KUBERNETES_MODE = StringUtils.isNotEmpty(System.getenv("KUBERNETES_SERVICE_HOST")) && StringUtils.isNotEmpty(System.getenv("KUBERNETES_SERVICE_PORT")); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/sql/SqlParameters.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.common.task.sql; import org.apache.dolphinscheduler.common.process.ResourceInfo; import org.apache.dolphinscheduler.common.task.AbstractParameters; import org.apache.dolphinscheduler.common.utils.StringUtils; import java.util.ArrayList; import java.util.List; /** * Sql/Hql parameter */ public class SqlParameters extends AbstractParameters {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/sql/SqlParameters.java
/** * data source type,eg MYSQL, POSTGRES, HIVE ... */ private String type; /** * datasource id */ private int datasource; /** * sql */ private String sql; /** * sql type * 0 query * 1 NON_QUERY */ private int sqlType; /** * udf list */ private String udfs;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/sql/SqlParameters.java
/** * show type * 0 TABLE * 1 TEXT * 2 attachment * 3 TABLE+attachment */ private String showType; /** * SQL connection parameters */ private String connParams; /** * Pre Statements */ private List<String> preStatements; /** * Post Statements */ private List<String> postStatements; /** * groupId */ private int groupId; /** * title */ private String title; public String getType() { return type;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/sql/SqlParameters.java
} public void setType(String type) { this.type = type; } public int getDatasource() { return datasource; } public void setDatasource(int datasource) { this.datasource = datasource; } public String getSql() { return sql; } public void setSql(String sql) { this.sql = sql; } public String getUdfs() { return udfs; } public void setUdfs(String udfs) { this.udfs = udfs; } public int getSqlType() { return sqlType; } public void setSqlType(int sqlType) { this.sqlType = sqlType; } public String getShowType() { return showType;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/sql/SqlParameters.java
} public void setShowType(String showType) { this.showType = showType; } public String getConnParams() { return connParams; } public void setConnParams(String connParams) { this.connParams = connParams; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public List<String> getPreStatements() { return preStatements; } public void setPreStatements(List<String> preStatements) { this.preStatements = preStatements; } public List<String> getPostStatements() { return postStatements; } public void setPostStatements(List<String> postStatements) { this.postStatements = postStatements; } public int getGroupId() { return groupId;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/sql/SqlParameters.java
} public void setGroupId(int groupId) { this.groupId = groupId; } @Override public boolean checkParameters() { return datasource != 0 && StringUtils.isNotEmpty(type) && StringUtils.isNotEmpty(sql); } @Override public List<ResourceInfo> getResourceFilesList() { return new ArrayList<>(); } @Override public String toString() { return "SqlParameters{" + "type='" + type + '\'' + ", datasource=" + datasource + ", sql='" + sql + '\'' + ", sqlType=" + sqlType + ", udfs='" + udfs + '\'' + ", showType='" + showType + '\'' + ", connParams='" + connParams + '\'' + ", groupId='" + groupId + '\'' + ", title='" + title + '\'' + ", preStatements=" + preStatements + ", postStatements=" + postStatements + '}'; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.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.server.worker.task.sql; import org.apache.dolphinscheduler.common.Constants;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java
import org.apache.dolphinscheduler.common.enums.CommandType; import org.apache.dolphinscheduler.common.enums.DbType; import org.apache.dolphinscheduler.common.enums.Direct; import org.apache.dolphinscheduler.common.enums.TaskTimeoutStrategy; import org.apache.dolphinscheduler.common.process.Property; import org.apache.dolphinscheduler.common.task.AbstractParameters; import org.apache.dolphinscheduler.common.task.sql.SqlBinds; import org.apache.dolphinscheduler.common.task.sql.SqlParameters; import org.apache.dolphinscheduler.common.task.sql.SqlType; import org.apache.dolphinscheduler.common.utils.CollectionUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.ParameterUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.apache.dolphinscheduler.dao.AlertDao; import org.apache.dolphinscheduler.dao.datasource.BaseDataSource; import org.apache.dolphinscheduler.dao.datasource.DataSourceFactory; import org.apache.dolphinscheduler.remote.command.alert.AlertSendResponseCommand; import org.apache.dolphinscheduler.server.entity.SQLTaskExecutionContext; import org.apache.dolphinscheduler.server.entity.TaskExecutionContext; import org.apache.dolphinscheduler.server.utils.ParamUtils; import org.apache.dolphinscheduler.server.utils.UDFUtils; import org.apache.dolphinscheduler.server.worker.task.AbstractTask; import org.apache.dolphinscheduler.service.alert.AlertClientService; import org.apache.dolphinscheduler.service.bean.SpringApplicationContext; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Statement;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; import org.slf4j.Logger; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; /** * sql task */ public class SqlTask extends AbstractTask { /** * sql parameters */ private SqlParameters sqlParameters; /** * alert dao */ private AlertDao alertDao; /** * base datasource */ private BaseDataSource baseDataSource; /** * taskExecutionContext */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java
private TaskExecutionContext taskExecutionContext; /** * default query sql limit */ private static final int LIMIT = 10000; private AlertClientService alertClientService; public SqlTask(TaskExecutionContext taskExecutionContext, Logger logger, AlertClientService alertClientService) { super(taskExecutionContext, logger); this.taskExecutionContext = taskExecutionContext; logger.info("sql task params {}", taskExecutionContext.getTaskParams()); this.sqlParameters = JSONUtils.parseObject(taskExecutionContext.getTaskParams(), SqlParameters.class); if (!sqlParameters.checkParameters()) { throw new RuntimeException("sql task params is not valid"); } this.alertClientService = alertClientService; this.alertDao = SpringApplicationContext.getBean(AlertDao.class); } @Override public void handle() throws Exception { String threadLoggerInfoName = String.format(Constants.TASK_LOG_INFO_FORMAT, taskExecutionContext.getTaskAppId()); Thread.currentThread().setName(threadLoggerInfoName); logger.info("Full sql parameters: {}", sqlParameters); logger.info("sql type : {}, datasource : {}, sql : {} , localParams : {},udfs : {},showType : {},connParams : {}", sqlParameters.getType(), sqlParameters.getDatasource(), sqlParameters.getSql(), sqlParameters.getLocalParams(), sqlParameters.getUdfs(), sqlParameters.getShowType(),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java
sqlParameters.getConnParams()); try { SQLTaskExecutionContext sqlTaskExecutionContext = taskExecutionContext.getSqlTaskExecutionContext(); baseDataSource = DataSourceFactory.getDatasource(DbType.valueOf(sqlParameters.getType()), sqlTaskExecutionContext.getConnectionParams()); SqlBinds mainSqlBinds = getSqlAndSqlParamsMap(sqlParameters.getSql()); List<SqlBinds> preStatementSqlBinds = Optional.ofNullable(sqlParameters.getPreStatements()) .orElse(new ArrayList<>()) .stream() .map(this::getSqlAndSqlParamsMap) .collect(Collectors.toList()); List<SqlBinds> postStatementSqlBinds = Optional.ofNullable(sqlParameters.getPostStatements()) .orElse(new ArrayList<>()) .stream() .map(this::getSqlAndSqlParamsMap) .collect(Collectors.toList()); List<String> createFuncs = UDFUtils.createFuncs(sqlTaskExecutionContext.getUdfFuncTenantCodeMap(), logger); executeFuncAndSql(mainSqlBinds, preStatementSqlBinds, postStatementSqlBinds, createFuncs, sqlParameters.getLocalParams()); setExitStatusCode(Constants.EXIT_CODE_SUCCESS); } catch (Exception e) { setExitStatusCode(Constants.EXIT_CODE_FAILURE); logger.error("sql task error", e); throw e; } } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java
* ready to execute SQL and parameter entity Map * * @return SqlBinds */ private SqlBinds getSqlAndSqlParamsMap(String sql) { Map<Integer, Property> sqlParamsMap = new HashMap<>(); StringBuilder sqlBuilder = new StringBuilder(); Map<String, Property> paramsMap = ParamUtils.convert(ParamUtils.getUserDefParamsMap(taskExecutionContext.getDefinedParams()), taskExecutionContext.getDefinedParams(), sqlParameters.getLocalParametersMap(), CommandType.of(taskExecutionContext.getCmdTypeIfComplement()), taskExecutionContext.getScheduleTime()); if (paramsMap == null) { sqlBuilder.append(sql); return new SqlBinds(sqlBuilder.toString(), sqlParamsMap); } if (StringUtils.isNotEmpty(sqlParameters.getTitle())) { String title = ParameterUtils.convertParameterPlaceholders(sqlParameters.getTitle(), ParamUtils.convert(paramsMap)); logger.info("SQL title : {}", title); sqlParameters.setTitle(title); } sql = ParameterUtils.replaceScheduleTime(sql, taskExecutionContext.getScheduleTime()); String rgex = "['\"]*\\$\\{(.*?)\\}['\"]*"; setSqlParamsMap(sql, rgex, sqlParamsMap, paramsMap);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java
String rgexo = "['\"]*\\!\\{(.*?)\\}['\"]*"; sql = replaceOriginalValue(sql, rgexo, paramsMap); // r String formatSql = sql.replaceAll(rgex, "?"); sqlBuilder.append(formatSql); // p printReplacedSql(sql, formatSql, rgex, sqlParamsMap); return new SqlBinds(sqlBuilder.toString(), sqlParamsMap); } public String replaceOriginalValue(String content, String rgex, Map<String, Property> sqlParamsMap) { Pattern pattern = Pattern.compile(rgex); while (true) { Matcher m = pattern.matcher(content); if (!m.find()) { break; } String paramName = m.group(1); String paramValue = sqlParamsMap.get(paramName).getValue(); content = m.replaceFirst(paramValue); } return content; } @Override public AbstractParameters getParameters() { return this.sqlParameters; } /** * execute function and sql *
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java
* @param mainSqlBinds main sql binds * @param preStatementsBinds pre statements binds * @param postStatementsBinds post statements binds * @param createFuncs create functions */ public void executeFuncAndSql(SqlBinds mainSqlBinds, List<SqlBinds> preStatementsBinds, List<SqlBinds> postStatementsBinds, List<String> createFuncs, List<Property> properties) { Connection connection = null; PreparedStatement stmt = null; ResultSet resultSet = null; try { baseDataSource.setConnParams(sqlParameters.getConnParams()); // c connection = baseDataSource.getConnection(); // c if (CollectionUtils.isNotEmpty(createFuncs)) { createTempFunction(connection, createFuncs); } // p preSql(connection, preStatementsBinds); stmt = prepareStatementAndBind(connection, mainSqlBinds); String result = null; // d if (sqlParameters.getSqlType() == SqlType.QUERY.ordinal()) { // q resultSet = stmt.executeQuery(); result = resultProcess(resultSet);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java
} else if (sqlParameters.getSqlType() == SqlType.NON_QUERY.ordinal()) { // n String updateResult = String.valueOf(stmt.executeUpdate()); result = setNonQuerySqlReturn(updateResult, properties); } postSql(connection, postStatementsBinds); this.setResultString(result); } catch (Exception e) { logger.error("execute sql error", e); throw new RuntimeException("execute sql error"); } finally { close(resultSet, stmt, connection); } } public String setNonQuerySqlReturn(String updateResult, List<Property> properties) { String result = null; for (Property info :properties) { if (Direct.OUT == info.getDirect()) { List<Map<String,String>> updateRL = new ArrayList<>(); Map<String,String> updateRM = new HashMap<>(); updateRM.put(info.getProp(),updateResult); updateRL.add(updateRM); result = JSONUtils.toJsonString(updateRL); break; } } return result; } /** * result process
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java
* * @param resultSet resultSet * @throws Exception Exception */ private String resultProcess(ResultSet resultSet) throws Exception { ArrayNode resultJSONArray = JSONUtils.createArrayNode(); ResultSetMetaData md = resultSet.getMetaData(); int num = md.getColumnCount(); int rowCount = 0; while (rowCount < LIMIT && resultSet.next()) { ObjectNode mapOfColValues = JSONUtils.createObjectNode(); for (int i = 1; i <= num; i++) { mapOfColValues.set(md.getColumnLabel(i), JSONUtils.toJsonNode(resultSet.getObject(i))); } resultJSONArray.add(mapOfColValues); rowCount++; } String result = JSONUtils.toJsonString(resultJSONArray); logger.debug("execute sql : {}", result); try { sendAttachment(sqlParameters.getGroupId(), StringUtils.isNotEmpty(sqlParameters.getTitle()) ? sqlParameters.getTitle() : taskExecutionContext.getTaskName() + " query result sets", JSONUtils.toJsonString(resultJSONArray)); } catch (Exception e) { logger.warn("sql task sendAttachment error! msg : {} ", e.getMessage()); } return result; } /** * p *
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java
* @param connection connection * @param preStatementsBinds preStatementsBinds */ private void preSql(Connection connection, List<SqlBinds> preStatementsBinds) throws Exception { for (SqlBinds sqlBind : preStatementsBinds) { try (PreparedStatement pstmt = prepareStatementAndBind(connection, sqlBind)) { int result = pstmt.executeUpdate(); logger.info("pre statement execute result: {}, for sql: {}", result, sqlBind.getSql()); } } } /** * post sql * * @param connection connection * @param postStatementsBinds postStatementsBinds */ private void postSql(Connection connection, List<SqlBinds> postStatementsBinds) throws Exception { for (SqlBinds sqlBind : postStatementsBinds) { try (PreparedStatement pstmt = prepareStatementAndBind(connection, sqlBind)) { int result = pstmt.executeUpdate(); logger.info("post statement execute result: {},for sql: {}", result, sqlBind.getSql()); } } } /** * c *
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java
* @param connection connection * @param createFuncs createFuncs */ private void createTempFunction(Connection connection, List<String> createFuncs) throws Exception { try (Statement funcStmt = connection.createStatement()) { for (String createFunc : createFuncs) { logger.info("hive create function sql: {}", createFunc); funcStmt.execute(createFunc); } } } /** * close jdbc resource * * @param resultSet resultSet * @param pstmt pstmt * @param connection connection */ private void close(ResultSet resultSet, PreparedStatement pstmt, Connection connection) { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { logger.error("close result set error : {}", e.getMessage(), e); } } if (pstmt != null) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java
try { pstmt.close(); } catch (SQLException e) { logger.error("close prepared statement error : {}", e.getMessage(), e); } } if (connection != null) { try { connection.close(); } catch (SQLException e) { logger.error("close connection error : {}", e.getMessage(), e); } } } /** * preparedStatement bind * * @param connection connection * @param sqlBinds sqlBinds * @return PreparedStatement * @throws Exception Exception */ private PreparedStatement prepareStatementAndBind(Connection connection, SqlBinds sqlBinds) throws Exception { // i boolean timeoutFlag = TaskTimeoutStrategy.of(taskExecutionContext.getTaskTimeoutStrategy()) == TaskTimeoutStrategy.FAILED || TaskTimeoutStrategy.of(taskExecutionContext.getTaskTimeoutStrategy()) == TaskTimeoutStrategy.WARNFAILED; PreparedStatement stmt = connection.prepareStatement(sqlBinds.getSql()); if (timeoutFlag) { stmt.setQueryTimeout(taskExecutionContext.getTaskTimeout()); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java
Map<Integer, Property> params = sqlBinds.getParamsMap(); if (params != null) { for (Map.Entry<Integer, Property> entry : params.entrySet()) { Property prop = entry.getValue(); ParameterUtils.setInParameter(entry.getKey(), stmt, prop.getType(), prop.getValue()); } } logger.info("prepare statement replace sql : {} ", stmt); return stmt; } /** * send mail as an attachment * * @param title title * @param content content */ public void sendAttachment(int groupId, String title, String content) { AlertSendResponseCommand alertSendResponseCommand = alertClientService.sendAlert(groupId, title, content); if (!alertSendResponseCommand.getResStatus()) { throw new RuntimeException("send mail failed!"); } } /** * regular expressions match the contents between two specified strings * * @param content content * @param rgex rgex * @param sqlParamsMap sql params map * @param paramsPropsMap params props map */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,087
[Feature][SqlTask] Add a switch to send mail and print head logs in SqlTask
**Describe the feature** **Add the switch to send mail and print head logs in SqlTask**
https://github.com/apache/dolphinscheduler/issues/5087
https://github.com/apache/dolphinscheduler/pull/5088
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
8ac72e80e6656ab2119f938e038df663765e1379
"2021-03-18T05:17:33Z"
java
"2021-03-19T07:07:39Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java
public void setSqlParamsMap(String content, String rgex, Map<Integer, Property> sqlParamsMap, Map<String, Property> paramsPropsMap) { Pattern pattern = Pattern.compile(rgex); Matcher m = pattern.matcher(content); int index = 1; while (m.find()) { String paramName = m.group(1); Property prop = paramsPropsMap.get(paramName); sqlParamsMap.put(index, prop); index++; } } /** * print replace sql * * @param content content * @param formatSql format sql * @param rgex rgex * @param sqlParamsMap sql params map */ public void printReplacedSql(String content, String formatSql, String rgex, Map<Integer, Property> sqlParamsMap) { //pa logger.info("after replace sql , preparing : {}", formatSql); StringBuilder logPrint = new StringBuilder("replaced sql , parameters:"); for (int i = 1; i <= sqlParamsMap.size(); i++) { logPrint.append(sqlParamsMap.get(i).getValue() + "(" + sqlParamsMap.get(i).getType() + ")"); } logger.info("Sql Params are {}", logPrint); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,048
[Bug][Api] Delete the stopped workflow without deleting the corresponding sub process, the workflow instance name is not displayed in the sub process
1.stop workflow,Workflow contains sub_process 2.delete the workflow, No sub_process were deleted, the workflow instance name is not displayed in the sub process ![image](https://user-images.githubusercontent.com/55787491/111032444-40d24a80-8447-11eb-9bc9-963c9914a06a.png) **Expected results** delete the workflow, need to delete all tasks under the workflow, including sub_process **Which version of Dolphin Scheduler:** -[1.3.6-prepare]
https://github.com/apache/dolphinscheduler/issues/5048
https://github.com/apache/dolphinscheduler/pull/5066
ba039dc252a2ddfe316297a2955f0ea9f966432a
f109a758f8388a0499391f5a87ccd6d1e17db3aa
"2021-03-13T14:00:33Z"
java
"2021-03-23T03:26:11Z"
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapperTest.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
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,048
[Bug][Api] Delete the stopped workflow without deleting the corresponding sub process, the workflow instance name is not displayed in the sub process
1.stop workflow,Workflow contains sub_process 2.delete the workflow, No sub_process were deleted, the workflow instance name is not displayed in the sub process ![image](https://user-images.githubusercontent.com/55787491/111032444-40d24a80-8447-11eb-9bc9-963c9914a06a.png) **Expected results** delete the workflow, need to delete all tasks under the workflow, including sub_process **Which version of Dolphin Scheduler:** -[1.3.6-prepare]
https://github.com/apache/dolphinscheduler/issues/5048
https://github.com/apache/dolphinscheduler/pull/5066
ba039dc252a2ddfe316297a2955f0ea9f966432a
f109a758f8388a0499391f5a87ccd6d1e17db3aa
"2021-03-13T14:00:33Z"
java
"2021-03-23T03:26:11Z"
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapperTest.java
* * 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.dao.mapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.dolphinscheduler.common.enums.CommandType; import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.enums.Flag; import org.apache.dolphinscheduler.common.enums.TaskType; import org.apache.dolphinscheduler.dao.entity.ExecuteStatusCount; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.TaskInstance; import java.util.Date; import java.util.List; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.transaction.annotation.Transactional; @RunWith(SpringRunner.class) @SpringBootTest
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,048
[Bug][Api] Delete the stopped workflow without deleting the corresponding sub process, the workflow instance name is not displayed in the sub process
1.stop workflow,Workflow contains sub_process 2.delete the workflow, No sub_process were deleted, the workflow instance name is not displayed in the sub process ![image](https://user-images.githubusercontent.com/55787491/111032444-40d24a80-8447-11eb-9bc9-963c9914a06a.png) **Expected results** delete the workflow, need to delete all tasks under the workflow, including sub_process **Which version of Dolphin Scheduler:** -[1.3.6-prepare]
https://github.com/apache/dolphinscheduler/issues/5048
https://github.com/apache/dolphinscheduler/pull/5066
ba039dc252a2ddfe316297a2955f0ea9f966432a
f109a758f8388a0499391f5a87ccd6d1e17db3aa
"2021-03-13T14:00:33Z"
java
"2021-03-23T03:26:11Z"
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapperTest.java
@Transactional @Rollback(true) public class TaskInstanceMapperTest { @Autowired TaskInstanceMapper taskInstanceMapper; @Autowired ProcessDefinitionMapper processDefinitionMapper; @Autowired ProcessInstanceMapper processInstanceMapper; @Autowired ProcessInstanceMapMapper processInstanceMapMapper; /** * insert * * @return TaskInstance */ private TaskInstance insertOne() { return insertOne("us task", 1, ExecutionStatus.RUNNING_EXECUTION, TaskType.SHELL.toString()); } /** * construct a task instance and then insert * * @param taskName * @param processInstanceId * @param state * @param taskType * @return */ private TaskInstance insertOne(String taskName, int processInstanceId, ExecutionStatus state, String taskType) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,048
[Bug][Api] Delete the stopped workflow without deleting the corresponding sub process, the workflow instance name is not displayed in the sub process
1.stop workflow,Workflow contains sub_process 2.delete the workflow, No sub_process were deleted, the workflow instance name is not displayed in the sub process ![image](https://user-images.githubusercontent.com/55787491/111032444-40d24a80-8447-11eb-9bc9-963c9914a06a.png) **Expected results** delete the workflow, need to delete all tasks under the workflow, including sub_process **Which version of Dolphin Scheduler:** -[1.3.6-prepare]
https://github.com/apache/dolphinscheduler/issues/5048
https://github.com/apache/dolphinscheduler/pull/5066
ba039dc252a2ddfe316297a2955f0ea9f966432a
f109a758f8388a0499391f5a87ccd6d1e17db3aa
"2021-03-13T14:00:33Z"
java
"2021-03-23T03:26:11Z"
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapperTest.java
TaskInstance taskInstance = new TaskInstance(); taskInstance.setFlag(Flag.YES); taskInstance.setName(taskName); taskInstance.setState(state); taskInstance.setStartTime(new Date()); taskInstance.setEndTime(new Date()); taskInstance.setTaskJson("{}"); taskInstance.setProcessInstanceId(processInstanceId); taskInstance.setTaskType(taskType); taskInstanceMapper.insert(taskInstance); return taskInstance; } /** * test update */ @Test public void testUpdate(){ TaskInstance taskInstance = insertOne(); int update = taskInstanceMapper.updateById(taskInstance); Assert.assertEquals(1, update); taskInstanceMapper.deleteById(taskInstance.getId()); } /** * test delete */ @Test public void testDelete() { TaskInstance taskInstance = insertOne();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,048
[Bug][Api] Delete the stopped workflow without deleting the corresponding sub process, the workflow instance name is not displayed in the sub process
1.stop workflow,Workflow contains sub_process 2.delete the workflow, No sub_process were deleted, the workflow instance name is not displayed in the sub process ![image](https://user-images.githubusercontent.com/55787491/111032444-40d24a80-8447-11eb-9bc9-963c9914a06a.png) **Expected results** delete the workflow, need to delete all tasks under the workflow, including sub_process **Which version of Dolphin Scheduler:** -[1.3.6-prepare]
https://github.com/apache/dolphinscheduler/issues/5048
https://github.com/apache/dolphinscheduler/pull/5066
ba039dc252a2ddfe316297a2955f0ea9f966432a
f109a758f8388a0499391f5a87ccd6d1e17db3aa
"2021-03-13T14:00:33Z"
java
"2021-03-23T03:26:11Z"
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapperTest.java
int delete = taskInstanceMapper.deleteById(taskInstance.getId()); Assert.assertEquals(1, delete); } /** * test query */ @Test public void testQuery() { TaskInstance taskInstance = insertOne(); List<TaskInstance> taskInstances = taskInstanceMapper.selectList(null); taskInstanceMapper.deleteById(taskInstance.getId()); Assert.assertNotEquals(taskInstances.size(), 0); } /** * test query task instance by process instance id and state */ @Test public void testQueryTaskByProcessIdAndState() { TaskInstance task = insertOne(); task.setProcessInstanceId(110); taskInstanceMapper.updateById(task); List<Integer> taskInstances = taskInstanceMapper.queryTaskByProcessIdAndState( task.getProcessInstanceId(), ExecutionStatus.RUNNING_EXECUTION.ordinal() ); taskInstanceMapper.deleteById(task.getId()); Assert.assertNotEquals(taskInstances.size(), 0); } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,048
[Bug][Api] Delete the stopped workflow without deleting the corresponding sub process, the workflow instance name is not displayed in the sub process
1.stop workflow,Workflow contains sub_process 2.delete the workflow, No sub_process were deleted, the workflow instance name is not displayed in the sub process ![image](https://user-images.githubusercontent.com/55787491/111032444-40d24a80-8447-11eb-9bc9-963c9914a06a.png) **Expected results** delete the workflow, need to delete all tasks under the workflow, including sub_process **Which version of Dolphin Scheduler:** -[1.3.6-prepare]
https://github.com/apache/dolphinscheduler/issues/5048
https://github.com/apache/dolphinscheduler/pull/5066
ba039dc252a2ddfe316297a2955f0ea9f966432a
f109a758f8388a0499391f5a87ccd6d1e17db3aa
"2021-03-13T14:00:33Z"
java
"2021-03-23T03:26:11Z"
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapperTest.java
* test find valid task list by process instance id */ @Test public void testFindValidTaskListByProcessId() { TaskInstance task = insertOne(); TaskInstance task2 = insertOne(); task.setProcessInstanceId(110); task2.setProcessInstanceId(110); taskInstanceMapper.updateById(task); taskInstanceMapper.updateById(task2); List<TaskInstance> taskInstances = taskInstanceMapper.findValidTaskListByProcessId( task.getProcessInstanceId(), Flag.YES ); task2.setFlag(Flag.NO); taskInstanceMapper.updateById(task2); List<TaskInstance> taskInstances1 = taskInstanceMapper.findValidTaskListByProcessId(task.getProcessInstanceId(), Flag.NO); taskInstanceMapper.deleteById(task2.getId()); taskInstanceMapper.deleteById(task.getId()); Assert.assertNotEquals(taskInstances.size(), 0); Assert.assertNotEquals(taskInstances1.size(), 0); } /** * test query by host and status */ @Test public void testQueryByHostAndStatus() { TaskInstance task = insertOne(); task.setHost("111.111.11.11");
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,048
[Bug][Api] Delete the stopped workflow without deleting the corresponding sub process, the workflow instance name is not displayed in the sub process
1.stop workflow,Workflow contains sub_process 2.delete the workflow, No sub_process were deleted, the workflow instance name is not displayed in the sub process ![image](https://user-images.githubusercontent.com/55787491/111032444-40d24a80-8447-11eb-9bc9-963c9914a06a.png) **Expected results** delete the workflow, need to delete all tasks under the workflow, including sub_process **Which version of Dolphin Scheduler:** -[1.3.6-prepare]
https://github.com/apache/dolphinscheduler/issues/5048
https://github.com/apache/dolphinscheduler/pull/5066
ba039dc252a2ddfe316297a2955f0ea9f966432a
f109a758f8388a0499391f5a87ccd6d1e17db3aa
"2021-03-13T14:00:33Z"
java
"2021-03-23T03:26:11Z"
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapperTest.java
taskInstanceMapper.updateById(task); List<TaskInstance> taskInstances = taskInstanceMapper.queryByHostAndStatus( task.getHost(), new int[]{ExecutionStatus.RUNNING_EXECUTION.ordinal()} ); taskInstanceMapper.deleteById(task.getId()); Assert.assertNotEquals(taskInstances.size(), 0); } /** * test set failover by host and state array */ @Test public void testSetFailoverByHostAndStateArray() { TaskInstance task = insertOne(); task.setHost("111.111.11.11"); taskInstanceMapper.updateById(task); int setResult = taskInstanceMapper.setFailoverByHostAndStateArray( task.getHost(), new int[]{ExecutionStatus.RUNNING_EXECUTION.ordinal()}, ExecutionStatus.NEED_FAULT_TOLERANCE ); taskInstanceMapper.deleteById(task.getId()); Assert.assertNotEquals(setResult, 0); } /** * test query by task instance id and name */ @Test public void testQueryByInstanceIdAndName() { TaskInstance task = insertOne(); task.setHost("111.111.11.11");
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,048
[Bug][Api] Delete the stopped workflow without deleting the corresponding sub process, the workflow instance name is not displayed in the sub process
1.stop workflow,Workflow contains sub_process 2.delete the workflow, No sub_process were deleted, the workflow instance name is not displayed in the sub process ![image](https://user-images.githubusercontent.com/55787491/111032444-40d24a80-8447-11eb-9bc9-963c9914a06a.png) **Expected results** delete the workflow, need to delete all tasks under the workflow, including sub_process **Which version of Dolphin Scheduler:** -[1.3.6-prepare]
https://github.com/apache/dolphinscheduler/issues/5048
https://github.com/apache/dolphinscheduler/pull/5066
ba039dc252a2ddfe316297a2955f0ea9f966432a
f109a758f8388a0499391f5a87ccd6d1e17db3aa
"2021-03-13T14:00:33Z"
java
"2021-03-23T03:26:11Z"
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapperTest.java
taskInstanceMapper.updateById(task); TaskInstance taskInstance = taskInstanceMapper.queryByInstanceIdAndName( task.getProcessInstanceId(), task.getName() ); taskInstanceMapper.deleteById(task.getId()); Assert.assertNotEquals(taskInstance, null); } /** * test count task instance */ @Test public void testCountTask() { TaskInstance task = insertOne(); ProcessDefinition definition = new ProcessDefinition(); definition.setProjectId(1111); processDefinitionMapper.insert(definition); task.setProcessDefinitionId(definition.getId()); taskInstanceMapper.updateById(task); int countTask = taskInstanceMapper.countTask( new Integer[0], new int[0] ); int countTask2 = taskInstanceMapper.countTask( new Integer[]{definition.getProjectId()}, new int[]{task.getId()} ); taskInstanceMapper.deleteById(task.getId()); processDefinitionMapper.deleteById(definition.getId()); Assert.assertNotEquals(countTask, 0);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,048
[Bug][Api] Delete the stopped workflow without deleting the corresponding sub process, the workflow instance name is not displayed in the sub process
1.stop workflow,Workflow contains sub_process 2.delete the workflow, No sub_process were deleted, the workflow instance name is not displayed in the sub process ![image](https://user-images.githubusercontent.com/55787491/111032444-40d24a80-8447-11eb-9bc9-963c9914a06a.png) **Expected results** delete the workflow, need to delete all tasks under the workflow, including sub_process **Which version of Dolphin Scheduler:** -[1.3.6-prepare]
https://github.com/apache/dolphinscheduler/issues/5048
https://github.com/apache/dolphinscheduler/pull/5066
ba039dc252a2ddfe316297a2955f0ea9f966432a
f109a758f8388a0499391f5a87ccd6d1e17db3aa
"2021-03-13T14:00:33Z"
java
"2021-03-23T03:26:11Z"
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapperTest.java
Assert.assertNotEquals(countTask2, 0); } /** * test count task instance state by user */ @Test public void testCountTaskInstanceStateByUser() { TaskInstance task = insertOne(); ProcessDefinition definition = new ProcessDefinition(); definition.setProjectId(1111); processDefinitionMapper.insert(definition); task.setProcessDefinitionId(definition.getId()); taskInstanceMapper.updateById(task); List<ExecuteStatusCount> count = taskInstanceMapper.countTaskInstanceStateByUser( null, null, new Integer[]{definition.getProjectId()} ); processDefinitionMapper.deleteById(definition.getId()); taskInstanceMapper.deleteById(task.getId()); } /** * test page */ @Test public void testQueryTaskInstanceListPaging() { TaskInstance task = insertOne(); ProcessDefinition definition = new ProcessDefinition(); definition.setProjectId(1111); processDefinitionMapper.insert(definition); ProcessInstance processInstance = new ProcessInstance();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,048
[Bug][Api] Delete the stopped workflow without deleting the corresponding sub process, the workflow instance name is not displayed in the sub process
1.stop workflow,Workflow contains sub_process 2.delete the workflow, No sub_process were deleted, the workflow instance name is not displayed in the sub process ![image](https://user-images.githubusercontent.com/55787491/111032444-40d24a80-8447-11eb-9bc9-963c9914a06a.png) **Expected results** delete the workflow, need to delete all tasks under the workflow, including sub_process **Which version of Dolphin Scheduler:** -[1.3.6-prepare]
https://github.com/apache/dolphinscheduler/issues/5048
https://github.com/apache/dolphinscheduler/pull/5066
ba039dc252a2ddfe316297a2955f0ea9f966432a
f109a758f8388a0499391f5a87ccd6d1e17db3aa
"2021-03-13T14:00:33Z"
java
"2021-03-23T03:26:11Z"
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapperTest.java
processInstance.setProcessDefinitionId(definition.getId()); processInstance.setState(ExecutionStatus.RUNNING_EXECUTION); processInstance.setName("ut process"); processInstance.setStartTime(new Date()); processInstance.setEndTime(new Date()); processInstance.setCommandType(CommandType.START_PROCESS); processInstanceMapper.insert(processInstance); task.setProcessDefinitionId(definition.getId()); task.setProcessInstanceId(processInstance.getId()); taskInstanceMapper.updateById(task); Page<TaskInstance> page = new Page(1,3); IPage<TaskInstance> taskInstanceIPage = taskInstanceMapper.queryTaskInstanceListPaging( page, definition.getProjectId(), task.getProcessInstanceId(), "", "", "", 0, new int[0], "", null,null ); processInstanceMapper.deleteById(processInstance.getId()); taskInstanceMapper.deleteById(task.getId()); processDefinitionMapper.deleteById(definition.getId()); Assert.assertNotEquals(taskInstanceIPage.getTotal(), 0); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,114
[Question] data.basedir.path cleanup problem.
1, I have modified the data. The basedir. Path from/tmp/dolphinscheduler to /mydata/dolphinscheduler/tmp/. 2. Developer mode is false. 3, /mydata/dolphinscheduler/tmp folder read and write access to normal, ds is perfectly normal. 4, after running for a period of time only, find/data/dolphinscheduler files in the/tmp directory cannot be automatically deleted, lead to disk pile up. Q: Can temporary files in this directory only be removed manually?Cannot automatically delete?? 1、我修改了data.basedir.path从/tmp/dolphinscheduler/ 到数据盘/data/dolphinscheduler/tmp. 2、开发者模式为false. 3、/data/dolphinscheduler/tmp文件夹读写权限正常,ds工作完全正常. 4、在运行了一段时间只有,发现/data/dolphinscheduler/tmp目录中的文件不能自动删除,导致磁盘被占满. 问题:这个目录中的临时文件只能手动删除么?不能自动删除???
https://github.com/apache/dolphinscheduler/issues/4114
https://github.com/apache/dolphinscheduler/pull/5123
a8b47e1d4f4ebb9795239ef69b57f2928a81f44c
492b318bd321d35247488e1f181e3ea9d1259963
"2020-11-27T02:11:34Z"
java
"2021-03-26T02:11:56Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/FileUtils.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. */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,114
[Question] data.basedir.path cleanup problem.
1, I have modified the data. The basedir. Path from/tmp/dolphinscheduler to /mydata/dolphinscheduler/tmp/. 2. Developer mode is false. 3, /mydata/dolphinscheduler/tmp folder read and write access to normal, ds is perfectly normal. 4, after running for a period of time only, find/data/dolphinscheduler files in the/tmp directory cannot be automatically deleted, lead to disk pile up. Q: Can temporary files in this directory only be removed manually?Cannot automatically delete?? 1、我修改了data.basedir.path从/tmp/dolphinscheduler/ 到数据盘/data/dolphinscheduler/tmp. 2、开发者模式为false. 3、/data/dolphinscheduler/tmp文件夹读写权限正常,ds工作完全正常. 4、在运行了一段时间只有,发现/data/dolphinscheduler/tmp目录中的文件不能自动删除,导致磁盘被占满. 问题:这个目录中的临时文件只能手动删除么?不能自动删除???
https://github.com/apache/dolphinscheduler/issues/4114
https://github.com/apache/dolphinscheduler/pull/5123
a8b47e1d4f4ebb9795239ef69b57f2928a81f44c
492b318bd321d35247488e1f181e3ea9d1259963
"2020-11-27T02:11:34Z"
java
"2021-03-26T02:11:56Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/FileUtils.java
package org.apache.dolphinscheduler.common.utils; import static org.apache.dolphinscheduler.common.Constants.DATA_BASEDIR_PATH; import static org.apache.dolphinscheduler.common.Constants.RESOURCE_VIEW_SUFFIXS; import static org.apache.dolphinscheduler.common.Constants.RESOURCE_VIEW_SUFFIXS_DEFAULT_VALUE; import static org.apache.dolphinscheduler.common.Constants.YYYYMMDDHHMMSS; import org.apache.commons.io.Charsets; import org.apache.commons.io.IOUtils; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.StringReader; import java.io.UnsupportedEncodingException; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.nio.charset.UnsupportedCharsetException; import java.util.Optional; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * file utils */ public class FileUtils { public static final Logger logger = LoggerFactory.getLogger(FileUtils.class); public static final String DATA_BASEDIR = PropertyUtils.getString(DATA_BASEDIR_PATH, "/tmp/dolphinscheduler");