status
stringclasses 1
value | repo_name
stringclasses 31
values | repo_url
stringclasses 31
values | issue_id
int64 1
104k
| title
stringlengths 4
233
| body
stringlengths 0
186k
⌀ | issue_url
stringlengths 38
56
| pull_url
stringlengths 37
54
| before_fix_sha
stringlengths 40
40
| after_fix_sha
stringlengths 40
40
| report_datetime
unknown | language
stringclasses 5
values | commit_datetime
unknown | updated_file
stringlengths 7
188
| chunk_content
stringlengths 1
1.03M
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,638 | Improve the security of datasource management | **Is your feature request related to a problem? Please describe.**
Company database account management is relatively strict. We found that when the data source management is updated, the original password is actually brought out.
(公司数据库账号管理比较严格,我们发现目前数据源管理更新得时候实际上是把原始密码给带出来了。)
**Describe the solution you'd like**
The datasources / update-ui interface should not take out the password. The datasources / updateDataSource interface does not update this field without passing the password. You can call the query one more time when the server is updated.
(datasources/update-ui 接口不要将密码带出去,datasources/updateDataSource 接口不传 密码就不更新该字段,服务端更新时可以先多调用一次查询。)
| https://github.com/apache/dolphinscheduler/issues/2638 | https://github.com/apache/dolphinscheduler/pull/2844 | fbb8ff438ad0c0db1bfc78d33bbc73b2c7d40683 | 1c153454423f4b967f3fcd8fb906a4626799872f | "2020-05-08T08:42:20Z" | java | "2020-05-30T07:03:10Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataSourceService.java | || Constants.CLICKHOUSE.equals(type.name())
|| Constants.ORACLE.equals(type.name())) {
separator = "&";
} else if (Constants.HIVE.equals(type.name())
|| Constants.SPARK.equals(type.name())
|| Constants.DB2.equals(type.name())
|| Constants.SQLSERVER.equals(type.name())) {
separator = ";";
}
Map<String, Object> parameterMap = new LinkedHashMap<String, Object>(6);
parameterMap.put(Constants.ADDRESS, address);
parameterMap.put(Constants.DATABASE, database);
parameterMap.put(Constants.JDBC_URL, jdbcUrl);
parameterMap.put(Constants.USER, userName);
parameterMap.put(Constants.PASSWORD, password);
if (CommonUtils.getKerberosStartupState() &&
(type == DbType.HIVE || type == DbType.SPARK)){
parameterMap.put(Constants.PRINCIPAL,principal);
}
if (other != null && !"".equals(other)) {
LinkedHashMap<String, String> map = JSON.parseObject(other, new TypeReference<LinkedHashMap<String, String>>() {
});
if (map.size() > 0) {
StringBuilder otherSb = new StringBuilder();
for (Map.Entry<String, String> entry: map.entrySet()) {
otherSb.append(String.format("%s=%s%s", entry.getKey(), entry.getValue(), separator));
}
if (!Constants.DB2.equals(type.name())) {
otherSb.deleteCharAt(otherSb.length() - 1);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,638 | Improve the security of datasource management | **Is your feature request related to a problem? Please describe.**
Company database account management is relatively strict. We found that when the data source management is updated, the original password is actually brought out.
(公司数据库账号管理比较严格,我们发现目前数据源管理更新得时候实际上是把原始密码给带出来了。)
**Describe the solution you'd like**
The datasources / update-ui interface should not take out the password. The datasources / updateDataSource interface does not update this field without passing the password. You can call the query one more time when the server is updated.
(datasources/update-ui 接口不要将密码带出去,datasources/updateDataSource 接口不传 密码就不更新该字段,服务端更新时可以先多调用一次查询。)
| https://github.com/apache/dolphinscheduler/issues/2638 | https://github.com/apache/dolphinscheduler/pull/2844 | fbb8ff438ad0c0db1bfc78d33bbc73b2c7d40683 | 1c153454423f4b967f3fcd8fb906a4626799872f | "2020-05-08T08:42:20Z" | java | "2020-05-30T07:03:10Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataSourceService.java | parameterMap.put(Constants.OTHER, otherSb);
}
}
if(logger.isDebugEnabled()){
logger.info("parameters map-----" + JSON.toJSONString(parameterMap));
}
return JSON.toJSONString(parameterMap);
}
private String buildAddress(DbType type, String host, String port, DbConnectType connectType) {
StringBuilder sb = new StringBuilder();
if (Constants.MYSQL.equals(type.name())) {
sb.append(Constants.JDBC_MYSQL);
sb.append(host).append(":").append(port);
} else if (Constants.POSTGRESQL.equals(type.name())) {
sb.append(Constants.JDBC_POSTGRESQL);
sb.append(host).append(":").append(port);
} else if (Constants.HIVE.equals(type.name()) || Constants.SPARK.equals(type.name())) {
sb.append(Constants.JDBC_HIVE_2);
String[] hostArray = host.split(",");
if (hostArray.length > 0) {
for (String zkHost : hostArray) {
sb.append(String.format("%s:%s,", zkHost, port));
}
sb.deleteCharAt(sb.length() - 1);
}
} else if (Constants.CLICKHOUSE.equals(type.name())) {
sb.append(Constants.JDBC_CLICKHOUSE);
sb.append(host).append(":").append(port);
} else if (Constants.ORACLE.equals(type.name())) {
if (connectType == DbConnectType.ORACLE_SID) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,638 | Improve the security of datasource management | **Is your feature request related to a problem? Please describe.**
Company database account management is relatively strict. We found that when the data source management is updated, the original password is actually brought out.
(公司数据库账号管理比较严格,我们发现目前数据源管理更新得时候实际上是把原始密码给带出来了。)
**Describe the solution you'd like**
The datasources / update-ui interface should not take out the password. The datasources / updateDataSource interface does not update this field without passing the password. You can call the query one more time when the server is updated.
(datasources/update-ui 接口不要将密码带出去,datasources/updateDataSource 接口不传 密码就不更新该字段,服务端更新时可以先多调用一次查询。)
| https://github.com/apache/dolphinscheduler/issues/2638 | https://github.com/apache/dolphinscheduler/pull/2844 | fbb8ff438ad0c0db1bfc78d33bbc73b2c7d40683 | 1c153454423f4b967f3fcd8fb906a4626799872f | "2020-05-08T08:42:20Z" | java | "2020-05-30T07:03:10Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataSourceService.java | sb.append(Constants.JDBC_ORACLE_SID);
} else {
sb.append(Constants.JDBC_ORACLE_SERVICE_NAME);
}
sb.append(host).append(":").append(port);
} else if (Constants.SQLSERVER.equals(type.name())) {
sb.append(Constants.JDBC_SQLSERVER);
sb.append(host).append(":").append(port);
}else if (Constants.DB2.equals(type.name())) {
sb.append(Constants.JDBC_DB2);
sb.append(host).append(":").append(port);
}
return sb.toString();
}
/**
* delete datasource
*
* @param loginUser login user
* @param datasourceId data source id
* @return delete result code
*/
@Transactional(rollbackFor = Exception.class)
public Result delete(User loginUser, int datasourceId) {
Result result = new Result();
try {
DataSource dataSource = dataSourceMapper.selectById(datasourceId);
if(dataSource == null){
logger.error("resource id {} not exist", datasourceId);
putMsg(result, Status.RESOURCE_NOT_EXIST); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,638 | Improve the security of datasource management | **Is your feature request related to a problem? Please describe.**
Company database account management is relatively strict. We found that when the data source management is updated, the original password is actually brought out.
(公司数据库账号管理比较严格,我们发现目前数据源管理更新得时候实际上是把原始密码给带出来了。)
**Describe the solution you'd like**
The datasources / update-ui interface should not take out the password. The datasources / updateDataSource interface does not update this field without passing the password. You can call the query one more time when the server is updated.
(datasources/update-ui 接口不要将密码带出去,datasources/updateDataSource 接口不传 密码就不更新该字段,服务端更新时可以先多调用一次查询。)
| https://github.com/apache/dolphinscheduler/issues/2638 | https://github.com/apache/dolphinscheduler/pull/2844 | fbb8ff438ad0c0db1bfc78d33bbc73b2c7d40683 | 1c153454423f4b967f3fcd8fb906a4626799872f | "2020-05-08T08:42:20Z" | java | "2020-05-30T07:03:10Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataSourceService.java | return result;
}
if(!hasPerm(loginUser, dataSource.getUserId())){
putMsg(result, Status.USER_NO_OPERATION_PERM);
return result;
}
dataSourceMapper.deleteById(datasourceId);
datasourceUserMapper.deleteByDatasourceId(datasourceId);
putMsg(result, Status.SUCCESS);
} catch (Exception e) {
logger.error("delete datasource error",e);
throw new RuntimeException("delete datasource error");
}
return result;
}
/**
* unauthorized datasource
*
* @param loginUser login user
* @param userId user id
* @return unauthed data source result code
*/
public Map<String, Object> unauthDatasource(User loginUser, Integer userId) {
Map<String, Object> result = new HashMap<>();
if (!isAdmin(loginUser)) {
putMsg(result, Status.USER_NO_OPERATION_PERM);
return result;
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,638 | Improve the security of datasource management | **Is your feature request related to a problem? Please describe.**
Company database account management is relatively strict. We found that when the data source management is updated, the original password is actually brought out.
(公司数据库账号管理比较严格,我们发现目前数据源管理更新得时候实际上是把原始密码给带出来了。)
**Describe the solution you'd like**
The datasources / update-ui interface should not take out the password. The datasources / updateDataSource interface does not update this field without passing the password. You can call the query one more time when the server is updated.
(datasources/update-ui 接口不要将密码带出去,datasources/updateDataSource 接口不传 密码就不更新该字段,服务端更新时可以先多调用一次查询。)
| https://github.com/apache/dolphinscheduler/issues/2638 | https://github.com/apache/dolphinscheduler/pull/2844 | fbb8ff438ad0c0db1bfc78d33bbc73b2c7d40683 | 1c153454423f4b967f3fcd8fb906a4626799872f | "2020-05-08T08:42:20Z" | java | "2020-05-30T07:03:10Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataSourceService.java | * query all data sources except userId
*/
List<DataSource> resultList = new ArrayList<>();
List<DataSource> datasourceList = dataSourceMapper.queryDatasourceExceptUserId(userId);
Set<DataSource> datasourceSet = null;
if (datasourceList != null && datasourceList.size() > 0) {
datasourceSet = new HashSet<>(datasourceList);
List<DataSource> authedDataSourceList = dataSourceMapper.queryAuthedDatasource(userId);
Set<DataSource> authedDataSourceSet = null;
if (authedDataSourceList != null && authedDataSourceList.size() > 0) {
authedDataSourceSet = new HashSet<>(authedDataSourceList);
datasourceSet.removeAll(authedDataSourceSet);
}
resultList = new ArrayList<>(datasourceSet);
}
result.put(Constants.DATA_LIST, resultList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* authorized datasource
*
* @param loginUser login user
* @param userId user id
* @return authorized result code
*/
public Map<String, Object> authedDatasource(User loginUser, Integer userId) {
Map<String, Object> result = new HashMap<>(5);
if (!isAdmin(loginUser)) {
putMsg(result, Status.USER_NO_OPERATION_PERM); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,638 | Improve the security of datasource management | **Is your feature request related to a problem? Please describe.**
Company database account management is relatively strict. We found that when the data source management is updated, the original password is actually brought out.
(公司数据库账号管理比较严格,我们发现目前数据源管理更新得时候实际上是把原始密码给带出来了。)
**Describe the solution you'd like**
The datasources / update-ui interface should not take out the password. The datasources / updateDataSource interface does not update this field without passing the password. You can call the query one more time when the server is updated.
(datasources/update-ui 接口不要将密码带出去,datasources/updateDataSource 接口不传 密码就不更新该字段,服务端更新时可以先多调用一次查询。)
| https://github.com/apache/dolphinscheduler/issues/2638 | https://github.com/apache/dolphinscheduler/pull/2844 | fbb8ff438ad0c0db1bfc78d33bbc73b2c7d40683 | 1c153454423f4b967f3fcd8fb906a4626799872f | "2020-05-08T08:42:20Z" | java | "2020-05-30T07:03:10Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataSourceService.java | return result;
}
List<DataSource> authedDatasourceList = dataSourceMapper.queryAuthedDatasource(userId);
result.put(Constants.DATA_LIST, authedDatasourceList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* get host and port by address
*
* @param address
* @return sting array: [host,port]
*/
private String[] getHostsAndPort(String address) {
String[] result = new String[2];
String[] tmpArray = address.split(Constants.DOUBLE_SLASH);
String hostsAndPorts = tmpArray[tmpArray.length - 1];
StringBuilder hosts = new StringBuilder();
String[] hostPortArray = hostsAndPorts.split(Constants.COMMA);
String port = hostPortArray[0].split(Constants.COLON)[1];
for (String hostPort : hostPortArray) {
hosts.append(hostPort.split(Constants.COLON)[0]).append(Constants.COMMA);
}
hosts.deleteCharAt(hosts.length() - 1);
result[0] = hosts.toString();
result[1] = port;
return result;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,860 | [BUG] When a user has a resource directory tree, update the user's tenant to report an error |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.
| https://github.com/apache/dolphinscheduler/issues/2860 | https://github.com/apache/dolphinscheduler/pull/2876 | 6723454df9c7d85d3f034d2c13a080db4c130fc1 | 31dca43cdbaec861b2bfc5dc7407f50424216e3c | "2020-06-01T08:22:32Z" | java | "2020-06-02T10:33:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,860 | [BUG] When a user has a resource directory tree, update the user's tenant to report an error |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.
| https://github.com/apache/dolphinscheduler/issues/2860 | https://github.com/apache/dolphinscheduler/pull/2876 | 6723454df9c7d85d3f034d2c13a080db4c130fc1 | 31dca43cdbaec861b2bfc5dc7407f50424216e3c | "2020-06-01T08:22:32Z" | java | "2020-06-02T10:33:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | * limitations under the License.
*/
package org.apache.dolphinscheduler.api.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.dolphinscheduler.api.dto.resources.ResourceComponent;
import org.apache.dolphinscheduler.api.dto.resources.visitor.ResourceTreeVisitor;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.utils.CheckUtils;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.ResourceType;
import org.apache.dolphinscheduler.common.enums.UserType;
import org.apache.dolphinscheduler.common.utils.*;
import org.apache.dolphinscheduler.dao.entity.*;
import org.apache.dolphinscheduler.dao.mapper.*;
import org.apache.dolphinscheduler.dao.utils.ResourceProcessDefinitionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
/**
* user service
*/
@Service
public class UsersService extends BaseService { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,860 | [BUG] When a user has a resource directory tree, update the user's tenant to report an error |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.
| https://github.com/apache/dolphinscheduler/issues/2860 | https://github.com/apache/dolphinscheduler/pull/2876 | 6723454df9c7d85d3f034d2c13a080db4c130fc1 | 31dca43cdbaec861b2bfc5dc7407f50424216e3c | "2020-06-01T08:22:32Z" | java | "2020-06-02T10:33:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | private static final Logger logger = LoggerFactory.getLogger(UsersService.class);
@Autowired
private UserMapper userMapper;
@Autowired
private TenantMapper tenantMapper;
@Autowired
private ProjectUserMapper projectUserMapper;
@Autowired
private ResourceUserMapper resourcesUserMapper;
@Autowired
private ResourceMapper resourceMapper;
@Autowired
private DataSourceUserMapper datasourceUserMapper;
@Autowired
private UDFUserMapper udfUserMapper;
@Autowired
private AlertGroupMapper alertGroupMapper;
@Autowired
private ProcessDefinitionMapper processDefinitionMapper;
/**
* create user, only system admin have permission
*
* @param loginUser login user
* @param userName user name
* @param userPassword user password
* @param email email
* @param tenantId tenant id
* @param phone phone
* @param queue queue
* @return create result code |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,860 | [BUG] When a user has a resource directory tree, update the user's tenant to report an error |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.
| https://github.com/apache/dolphinscheduler/issues/2860 | https://github.com/apache/dolphinscheduler/pull/2876 | 6723454df9c7d85d3f034d2c13a080db4c130fc1 | 31dca43cdbaec861b2bfc5dc7407f50424216e3c | "2020-06-01T08:22:32Z" | java | "2020-06-02T10:33:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | * @throws Exception exception
*/
@Transactional(rollbackFor = Exception.class)
public Map<String, Object> createUser(User loginUser,
String userName,
String userPassword,
String email,
int tenantId,
String phone,
String queue) throws Exception {
Map<String, Object> result = new HashMap<>(5);
String msg = this.checkUserParams(userName, userPassword, email, phone);
if (!StringUtils.isEmpty(msg)) {
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR,msg);
return result;
}
if (!isAdmin(loginUser)) {
putMsg(result, Status.USER_NO_OPERATION_PERM);
return result;
}
if (!checkTenantExists(tenantId)) {
putMsg(result, Status.TENANT_NOT_EXIST);
return result;
}
User user = createUser(userName, userPassword, email, tenantId, phone, queue);
Tenant tenant = tenantMapper.queryById(tenantId);
if (PropertyUtils.getResUploadStartupState()){ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,860 | [BUG] When a user has a resource directory tree, update the user's tenant to report an error |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.
| https://github.com/apache/dolphinscheduler/issues/2860 | https://github.com/apache/dolphinscheduler/pull/2876 | 6723454df9c7d85d3f034d2c13a080db4c130fc1 | 31dca43cdbaec861b2bfc5dc7407f50424216e3c | "2020-06-01T08:22:32Z" | java | "2020-06-02T10:33:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | if (!HadoopUtils.getInstance().exists(HadoopUtils.getHdfsTenantDir(tenant.getTenantCode()))){
createTenantDirIfNotExists(tenant.getTenantCode());
}
String userPath = HadoopUtils.getHdfsUserDir(tenant.getTenantCode(),user.getId());
HadoopUtils.getInstance().mkdir(userPath);
}
putMsg(result, Status.SUCCESS);
return result;
}
@Transactional(rollbackFor = Exception.class)
public User createUser(String userName,
String userPassword,
String email,
int tenantId,
String phone,
String queue) throws Exception {
User user = new User();
Date now = new Date();
user.setUserName(userName);
user.setUserPassword(EncryptionUtils.getMd5(userPassword));
user.setEmail(email);
user.setTenantId(tenantId);
user.setPhone(phone);
user.setUserType(UserType.GENERAL_USER);
user.setCreateTime(now);
user.setUpdateTime(now);
if (StringUtils.isEmpty(queue)){
queue = "";
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,860 | [BUG] When a user has a resource directory tree, update the user's tenant to report an error |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.
| https://github.com/apache/dolphinscheduler/issues/2860 | https://github.com/apache/dolphinscheduler/pull/2876 | 6723454df9c7d85d3f034d2c13a080db4c130fc1 | 31dca43cdbaec861b2bfc5dc7407f50424216e3c | "2020-06-01T08:22:32Z" | java | "2020-06-02T10:33:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | user.setQueue(queue);
userMapper.insert(user);
return user;
}
/**
* query user by id
* @param id id
* @return user info
*/
public User queryUser(int id) {
return userMapper.selectById(id);
}
/**
* query user
* @param name name
* @return user info
*/
public User queryUser(String name) {
return userMapper.queryByUserNameAccurately(name);
}
/**
* query user
*
* @param name name
* @param password password
* @return user info
*/
public User queryUser(String name, String password) {
String md5 = EncryptionUtils.getMd5(password); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,860 | [BUG] When a user has a resource directory tree, update the user's tenant to report an error |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.
| https://github.com/apache/dolphinscheduler/issues/2860 | https://github.com/apache/dolphinscheduler/pull/2876 | 6723454df9c7d85d3f034d2c13a080db4c130fc1 | 31dca43cdbaec861b2bfc5dc7407f50424216e3c | "2020-06-01T08:22:32Z" | java | "2020-06-02T10:33:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | return userMapper.queryUserByNamePassword(name, md5);
}
/**
* get user id by user name
* @param name user name
* @return if name empty 0, user not exists -1, user exist user id
*/
public int getUserIdByName(String name) {
int executorId = 0;
if (StringUtils.isNotEmpty(name)) {
User executor = queryUser(name);
if (null != executor) {
executorId = executor.getId();
} else {
executorId = -1;
}
}
return executorId;
}
/**
* query user list
*
* @param loginUser login user
* @param pageNo page number
* @param searchVal search avlue
* @param pageSize page size
* @return user list page
*/
public Map<String, Object> queryUserList(User loginUser, String searchVal, Integer pageNo, Integer pageSize) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,860 | [BUG] When a user has a resource directory tree, update the user's tenant to report an error |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.
| https://github.com/apache/dolphinscheduler/issues/2860 | https://github.com/apache/dolphinscheduler/pull/2876 | 6723454df9c7d85d3f034d2c13a080db4c130fc1 | 31dca43cdbaec861b2bfc5dc7407f50424216e3c | "2020-06-01T08:22:32Z" | java | "2020-06-02T10:33:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | Map<String, Object> result = new HashMap<>(5);
if (check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)) {
return result;
}
Page<User> page = new Page(pageNo, pageSize);
IPage<User> scheduleList = userMapper.queryUserPaging(page, searchVal);
PageInfo<User> pageInfo = new PageInfo<>(pageNo, pageSize);
pageInfo.setTotalCount((int)scheduleList.getTotal());
pageInfo.setLists(scheduleList.getRecords());
result.put(Constants.DATA_LIST, pageInfo);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* updateProcessInstance user
*
* @param userId user id
* @param userName user name
* @param userPassword user password
* @param email email
* @param tenantId tennat id
* @param phone phone
* @param queue queue
* @return update result code
* @throws Exception exception
*/
public Map<String, Object> updateUser(int userId,
String userName,
String userPassword,
String email, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,860 | [BUG] When a user has a resource directory tree, update the user's tenant to report an error |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.
| https://github.com/apache/dolphinscheduler/issues/2860 | https://github.com/apache/dolphinscheduler/pull/2876 | 6723454df9c7d85d3f034d2c13a080db4c130fc1 | 31dca43cdbaec861b2bfc5dc7407f50424216e3c | "2020-06-01T08:22:32Z" | java | "2020-06-02T10:33:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | int tenantId,
String phone,
String queue) throws Exception {
Map<String, Object> result = new HashMap<>(5);
result.put(Constants.STATUS, false);
User user = userMapper.selectById(userId);
if (user == null) {
putMsg(result, Status.USER_NOT_EXIST, userId);
return result;
}
if (StringUtils.isNotEmpty(userName)) {
if (!CheckUtils.checkUserName(userName)){
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR,userName);
return result;
}
User tempUser = userMapper.queryByUserNameAccurately(userName);
if (tempUser != null && tempUser.getId() != userId) {
putMsg(result, Status.USER_NAME_EXIST);
return result;
}
user.setUserName(userName);
}
if (StringUtils.isNotEmpty(userPassword)) {
if (!CheckUtils.checkPassword(userPassword)){
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR,userPassword);
return result;
}
user.setUserPassword(EncryptionUtils.getMd5(userPassword));
}
if (StringUtils.isNotEmpty(email)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,860 | [BUG] When a user has a resource directory tree, update the user's tenant to report an error |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.
| https://github.com/apache/dolphinscheduler/issues/2860 | https://github.com/apache/dolphinscheduler/pull/2876 | 6723454df9c7d85d3f034d2c13a080db4c130fc1 | 31dca43cdbaec861b2bfc5dc7407f50424216e3c | "2020-06-01T08:22:32Z" | java | "2020-06-02T10:33:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | if (!CheckUtils.checkEmail(email)){
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR,email);
return result;
}
user.setEmail(email);
}
if (StringUtils.isNotEmpty(phone)) {
if (!CheckUtils.checkPhone(phone)){
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR,phone);
return result;
}
user.setPhone(phone);
}
user.setQueue(queue);
Date now = new Date();
user.setUpdateTime(now);
if (user.getTenantId() != tenantId) {
Tenant oldTenant = tenantMapper.queryById(user.getTenantId());
Tenant newTenant = tenantMapper.queryById(tenantId);
if (newTenant != null) {
if (PropertyUtils.getResUploadStartupState() && oldTenant != null){
String newTenantCode = newTenant.getTenantCode();
String oldResourcePath = HadoopUtils.getHdfsResDir(oldTenant.getTenantCode());
String oldUdfsPath = HadoopUtils.getHdfsUdfDir(oldTenant.getTenantCode());
if (HadoopUtils.getInstance().exists(oldResourcePath)){
String newResourcePath = HadoopUtils.getHdfsResDir(newTenantCode); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,860 | [BUG] When a user has a resource directory tree, update the user's tenant to report an error |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.
| https://github.com/apache/dolphinscheduler/issues/2860 | https://github.com/apache/dolphinscheduler/pull/2876 | 6723454df9c7d85d3f034d2c13a080db4c130fc1 | 31dca43cdbaec861b2bfc5dc7407f50424216e3c | "2020-06-01T08:22:32Z" | java | "2020-06-02T10:33:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | String newUdfsPath = HadoopUtils.getHdfsUdfDir(newTenantCode);
List<Resource> fileResourcesList = resourceMapper.queryResourceList(
null, userId, ResourceType.FILE.ordinal());
if (CollectionUtils.isNotEmpty(fileResourcesList)) {
ResourceTreeVisitor resourceTreeVisitor = new ResourceTreeVisitor(fileResourcesList);
ResourceComponent resourceComponent = resourceTreeVisitor.visit();
for (ResourceComponent resource : resourceComponent.getChildren()) {
HadoopUtils.getInstance().copy(oldResourcePath + "/" + resource.getName(), newResourcePath, false, true);
}
}
List<Resource> udfResourceList = resourceMapper.queryResourceList(
null, userId, ResourceType.UDF.ordinal());
if (CollectionUtils.isNotEmpty(udfResourceList)) {
ResourceTreeVisitor resourceTreeVisitor = new ResourceTreeVisitor(udfResourceList);
ResourceComponent resourceComponent = resourceTreeVisitor.visit();
for (ResourceComponent resource : resourceComponent.getChildren()) {
HadoopUtils.getInstance().copy(oldUdfsPath + "/" + resource.getName(), newUdfsPath, false, true);
}
}
String oldUserPath = HadoopUtils.getHdfsUserDir(oldTenant.getTenantCode(),userId);
HadoopUtils.getInstance().delete(oldUserPath, true);
}else {
createTenantDirIfNotExists(oldTenant.getTenantCode());
}
if (HadoopUtils.getInstance().exists(HadoopUtils.getHdfsTenantDir(newTenant.getTenantCode()))){ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,860 | [BUG] When a user has a resource directory tree, update the user's tenant to report an error |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.
| https://github.com/apache/dolphinscheduler/issues/2860 | https://github.com/apache/dolphinscheduler/pull/2876 | 6723454df9c7d85d3f034d2c13a080db4c130fc1 | 31dca43cdbaec861b2bfc5dc7407f50424216e3c | "2020-06-01T08:22:32Z" | java | "2020-06-02T10:33:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | String newUserPath = HadoopUtils.getHdfsUserDir(newTenant.getTenantCode(),user.getId());
HadoopUtils.getInstance().mkdir(newUserPath);
}else {
createTenantDirIfNotExists(newTenant.getTenantCode());
}
}
}
user.setTenantId(tenantId);
}
userMapper.updateById(user);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* delete user
*
* @param loginUser login user
* @param id user id
* @return delete result code
* @throws Exception exception when operate hdfs
*/
public Map<String, Object> deleteUserById(User loginUser, int id) throws Exception {
Map<String, Object> result = new HashMap<>(5);
if (!isAdmin(loginUser)) {
putMsg(result, Status.USER_NO_OPERATION_PERM, id);
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,860 | [BUG] When a user has a resource directory tree, update the user's tenant to report an error |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.
| https://github.com/apache/dolphinscheduler/issues/2860 | https://github.com/apache/dolphinscheduler/pull/2876 | 6723454df9c7d85d3f034d2c13a080db4c130fc1 | 31dca43cdbaec861b2bfc5dc7407f50424216e3c | "2020-06-01T08:22:32Z" | java | "2020-06-02T10:33:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | User tempUser = userMapper.selectById(id);
if (tempUser == null) {
putMsg(result, Status.USER_NOT_EXIST, id);
return result;
}
User user = userMapper.queryTenantCodeByUserId(id);
if (user != null) {
if (PropertyUtils.getResUploadStartupState()) {
String userPath = HadoopUtils.getHdfsUserDir(user.getTenantCode(),id);
if (HadoopUtils.getInstance().exists(userPath)) {
HadoopUtils.getInstance().delete(userPath, true);
}
}
}
userMapper.deleteById(id);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* grant project
*
* @param loginUser login user
* @param userId user id
* @param projectIds project id array
* @return grant result code
*/
@Transactional(rollbackFor = Exception.class)
public Map<String, Object> grantProject(User loginUser, int userId, String projectIds) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,860 | [BUG] When a user has a resource directory tree, update the user's tenant to report an error |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.
| https://github.com/apache/dolphinscheduler/issues/2860 | https://github.com/apache/dolphinscheduler/pull/2876 | 6723454df9c7d85d3f034d2c13a080db4c130fc1 | 31dca43cdbaec861b2bfc5dc7407f50424216e3c | "2020-06-01T08:22:32Z" | java | "2020-06-02T10:33:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | Map<String, Object> result = new HashMap<>(5);
result.put(Constants.STATUS, false);
if (check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)) {
return result;
}
User tempUser = userMapper.selectById(userId);
if (tempUser == null) {
putMsg(result, Status.USER_NOT_EXIST, userId);
return result;
}
projectUserMapper.deleteProjectRelation(0, userId);
if (check(result, StringUtils.isEmpty(projectIds), Status.SUCCESS)) {
return result;
}
String[] projectIdArr = projectIds.split(",");
for (String projectId : projectIdArr) {
Date now = new Date();
ProjectUser projectUser = new ProjectUser();
projectUser.setUserId(userId);
projectUser.setProjectId(Integer.parseInt(projectId));
projectUser.setPerm(7);
projectUser.setCreateTime(now);
projectUser.setUpdateTime(now);
projectUserMapper.insert(projectUser);
}
putMsg(result, Status.SUCCESS);
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,860 | [BUG] When a user has a resource directory tree, update the user's tenant to report an error |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.
| https://github.com/apache/dolphinscheduler/issues/2860 | https://github.com/apache/dolphinscheduler/pull/2876 | 6723454df9c7d85d3f034d2c13a080db4c130fc1 | 31dca43cdbaec861b2bfc5dc7407f50424216e3c | "2020-06-01T08:22:32Z" | java | "2020-06-02T10:33:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | }
/**
* grant resource
*
* @param loginUser login user
* @param userId user id
* @param resourceIds resource id array
* @return grant result code
*/
@Transactional(rollbackFor = Exception.class)
public Map<String, Object> grantResources(User loginUser, int userId, String resourceIds) {
Map<String, Object> result = new HashMap<>(5);
if (check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)) {
return result;
}
User user = userMapper.selectById(userId);
if(user == null){
putMsg(result, Status.USER_NOT_EXIST, userId);
return result;
}
Set<Integer> needAuthorizeResIds = new HashSet();
if (StringUtils.isNotBlank(resourceIds)) {
String[] resourceFullIdArr = resourceIds.split(",");
for (String resourceFullId : resourceFullIdArr) {
String[] resourceIdArr = resourceFullId.split("-");
for (int i=0;i<=resourceIdArr.length-1;i++) {
int resourceIdValue = Integer.parseInt(resourceIdArr[i]);
needAuthorizeResIds.add(resourceIdValue); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,860 | [BUG] When a user has a resource directory tree, update the user's tenant to report an error |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.
| https://github.com/apache/dolphinscheduler/issues/2860 | https://github.com/apache/dolphinscheduler/pull/2876 | 6723454df9c7d85d3f034d2c13a080db4c130fc1 | 31dca43cdbaec861b2bfc5dc7407f50424216e3c | "2020-06-01T08:22:32Z" | java | "2020-06-02T10:33:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | }
}
}
List<Resource> oldAuthorizedRes = resourceMapper.queryAuthorizedResourceList(userId);
Set<Integer> oldAuthorizedResIds = oldAuthorizedRes.stream().map(t -> t.getId()).collect(Collectors.toSet());
oldAuthorizedResIds.removeAll(needAuthorizeResIds);
if (CollectionUtils.isNotEmpty(oldAuthorizedResIds)) {
List<Map<String, Object>> list = processDefinitionMapper.listResourcesByUser(userId);
Map<Integer, Set<Integer>> resourceProcessMap = ResourceProcessDefinitionUtils.getResourceProcessDefinitionMap(list);
Set<Integer> resourceIdSet = resourceProcessMap.keySet();
resourceIdSet.retainAll(oldAuthorizedResIds);
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;
}
}
resourcesUserMapper.deleteResourceUser(userId, 0);
if (check(result, StringUtils.isEmpty(resourceIds), Status.SUCCESS)) {
return result;
}
for (int resourceIdValue : needAuthorizeResIds) {
Resource resource = resourceMapper.selectById(resourceIdValue); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,860 | [BUG] When a user has a resource directory tree, update the user's tenant to report an error |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.
| https://github.com/apache/dolphinscheduler/issues/2860 | https://github.com/apache/dolphinscheduler/pull/2876 | 6723454df9c7d85d3f034d2c13a080db4c130fc1 | 31dca43cdbaec861b2bfc5dc7407f50424216e3c | "2020-06-01T08:22:32Z" | java | "2020-06-02T10:33:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | if (resource == null) {
putMsg(result, Status.RESOURCE_NOT_EXIST);
return result;
}
Date now = new Date();
ResourcesUser resourcesUser = new ResourcesUser();
resourcesUser.setUserId(userId);
resourcesUser.setResourcesId(resourceIdValue);
if (resource.isDirectory()) {
resourcesUser.setPerm(Constants.AUTHORIZE_READABLE_PERM);
}else{
resourcesUser.setPerm(Constants.AUTHORIZE_WRITABLE_PERM);
}
resourcesUser.setCreateTime(now);
resourcesUser.setUpdateTime(now);
resourcesUserMapper.insert(resourcesUser);
}
putMsg(result, Status.SUCCESS);
return result;
}
/**
* grant udf function
*
* @param loginUser login user
* @param userId user id
* @param udfIds udf id array
* @return grant result code
*/
@Transactional(rollbackFor = Exception.class)
public Map<String, Object> grantUDFFunction(User loginUser, int userId, String udfIds) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,860 | [BUG] When a user has a resource directory tree, update the user's tenant to report an error |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.
| https://github.com/apache/dolphinscheduler/issues/2860 | https://github.com/apache/dolphinscheduler/pull/2876 | 6723454df9c7d85d3f034d2c13a080db4c130fc1 | 31dca43cdbaec861b2bfc5dc7407f50424216e3c | "2020-06-01T08:22:32Z" | java | "2020-06-02T10:33:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | Map<String, Object> result = new HashMap<>(5);
if (check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)) {
return result;
}
User user = userMapper.selectById(userId);
if(user == null){
putMsg(result, Status.USER_NOT_EXIST, userId);
return result;
}
udfUserMapper.deleteByUserId(userId);
if (check(result, StringUtils.isEmpty(udfIds), Status.SUCCESS)) {
return result;
}
String[] resourcesIdArr = udfIds.split(",");
for (String udfId : resourcesIdArr) {
Date now = new Date();
UDFUser udfUser = new UDFUser();
udfUser.setUserId(userId);
udfUser.setUdfId(Integer.parseInt(udfId));
udfUser.setPerm(7);
udfUser.setCreateTime(now);
udfUser.setUpdateTime(now);
udfUserMapper.insert(udfUser);
}
putMsg(result, Status.SUCCESS);
return result;
}
/**
* grant datasource |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,860 | [BUG] When a user has a resource directory tree, update the user's tenant to report an error |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.
| https://github.com/apache/dolphinscheduler/issues/2860 | https://github.com/apache/dolphinscheduler/pull/2876 | 6723454df9c7d85d3f034d2c13a080db4c130fc1 | 31dca43cdbaec861b2bfc5dc7407f50424216e3c | "2020-06-01T08:22:32Z" | java | "2020-06-02T10:33:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | *
* @param loginUser login user
* @param userId user id
* @param datasourceIds data source id array
* @return grant result code
*/
@Transactional(rollbackFor = Exception.class)
public Map<String, Object> grantDataSource(User loginUser, int userId, String datasourceIds) {
Map<String, Object> result = new HashMap<>(5);
result.put(Constants.STATUS, false);
if (check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)) {
return result;
}
User user = userMapper.selectById(userId);
if(user == null){
putMsg(result, Status.USER_NOT_EXIST, userId);
return result;
}
datasourceUserMapper.deleteByUserId(userId);
if (check(result, StringUtils.isEmpty(datasourceIds), Status.SUCCESS)) {
return result;
}
String[] datasourceIdArr = datasourceIds.split(",");
for (String datasourceId : datasourceIdArr) {
Date now = new Date();
DatasourceUser datasourceUser = new DatasourceUser();
datasourceUser.setUserId(userId);
datasourceUser.setDatasourceId(Integer.parseInt(datasourceId));
datasourceUser.setPerm(7); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,860 | [BUG] When a user has a resource directory tree, update the user's tenant to report an error |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.
| https://github.com/apache/dolphinscheduler/issues/2860 | https://github.com/apache/dolphinscheduler/pull/2876 | 6723454df9c7d85d3f034d2c13a080db4c130fc1 | 31dca43cdbaec861b2bfc5dc7407f50424216e3c | "2020-06-01T08:22:32Z" | java | "2020-06-02T10:33:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | datasourceUser.setCreateTime(now);
datasourceUser.setUpdateTime(now);
datasourceUserMapper.insert(datasourceUser);
}
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query user info
*
* @param loginUser login user
* @return user info
*/
public Map<String, Object> getUserInfo(User loginUser) {
Map<String, Object> result = new HashMap<>();
User user = null;
if (loginUser.getUserType() == UserType.ADMIN_USER) {
user = loginUser;
} else {
user = userMapper.queryDetailsById(loginUser.getId());
List<AlertGroup> alertGroups = alertGroupMapper.queryByUserId(loginUser.getId());
StringBuilder sb = new StringBuilder();
if (alertGroups != null && alertGroups.size() > 0) {
for (int i = 0; i < alertGroups.size() - 1; i++) {
sb.append(alertGroups.get(i).getGroupName() + ",");
}
sb.append(alertGroups.get(alertGroups.size() - 1));
user.setAlertGroup(sb.toString());
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,860 | [BUG] When a user has a resource directory tree, update the user's tenant to report an error |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.
| https://github.com/apache/dolphinscheduler/issues/2860 | https://github.com/apache/dolphinscheduler/pull/2876 | 6723454df9c7d85d3f034d2c13a080db4c130fc1 | 31dca43cdbaec861b2bfc5dc7407f50424216e3c | "2020-06-01T08:22:32Z" | java | "2020-06-02T10:33:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | result.put(Constants.DATA_LIST, user);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query user list
*
* @param loginUser login user
* @return user list
*/
public Map<String, Object> queryAllGeneralUsers(User loginUser) {
Map<String, Object> result = new HashMap<>(5);
if (check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)) {
return result;
}
List<User> userList = userMapper.queryAllGeneralUser();
result.put(Constants.DATA_LIST, userList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query user list
*
* @param loginUser login user
* @return user list
*/
public Map<String, Object> queryUserList(User loginUser) {
Map<String, Object> result = new HashMap<>(5); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,860 | [BUG] When a user has a resource directory tree, update the user's tenant to report an error |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.
| https://github.com/apache/dolphinscheduler/issues/2860 | https://github.com/apache/dolphinscheduler/pull/2876 | 6723454df9c7d85d3f034d2c13a080db4c130fc1 | 31dca43cdbaec861b2bfc5dc7407f50424216e3c | "2020-06-01T08:22:32Z" | java | "2020-06-02T10:33:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | if (check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)) {
return result;
}
List<User> userList = userMapper.selectList(null );
result.put(Constants.DATA_LIST, userList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* verify user name exists
*
* @param userName user name
* @return true if user name not exists, otherwise return false
*/
public Result verifyUserName(String userName) {
Result result = new Result();
User user = userMapper.queryByUserNameAccurately(userName);
if (user != null) {
logger.error("user {} has exist, can't create again.", userName);
putMsg(result, Status.USER_NAME_EXIST);
} else {
putMsg(result, Status.SUCCESS);
}
return result;
}
/**
* unauthorized user
*
* @param loginUser login user
* @param alertgroupId alert group id |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,860 | [BUG] When a user has a resource directory tree, update the user's tenant to report an error |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.
| https://github.com/apache/dolphinscheduler/issues/2860 | https://github.com/apache/dolphinscheduler/pull/2876 | 6723454df9c7d85d3f034d2c13a080db4c130fc1 | 31dca43cdbaec861b2bfc5dc7407f50424216e3c | "2020-06-01T08:22:32Z" | java | "2020-06-02T10:33:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | * @return unauthorize result code
*/
public Map<String, Object> unauthorizedUser(User loginUser, Integer alertgroupId) {
Map<String, Object> result = new HashMap<>(5);
if (check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)) {
return result;
}
List<User> userList = userMapper.selectList(null );
List<User> resultUsers = new ArrayList<>();
Set<User> userSet = null;
if (userList != null && userList.size() > 0) {
userSet = new HashSet<>(userList);
List<User> authedUserList = userMapper.queryUserListByAlertGroupId(alertgroupId);
Set<User> authedUserSet = null;
if (authedUserList != null && authedUserList.size() > 0) {
authedUserSet = new HashSet<>(authedUserList);
userSet.removeAll(authedUserSet);
}
resultUsers = new ArrayList<>(userSet);
}
result.put(Constants.DATA_LIST, resultUsers);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* authorized user
*
* @param loginUser login user
* @param alertgroupId alert group id |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,860 | [BUG] When a user has a resource directory tree, update the user's tenant to report an error |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.
| https://github.com/apache/dolphinscheduler/issues/2860 | https://github.com/apache/dolphinscheduler/pull/2876 | 6723454df9c7d85d3f034d2c13a080db4c130fc1 | 31dca43cdbaec861b2bfc5dc7407f50424216e3c | "2020-06-01T08:22:32Z" | java | "2020-06-02T10:33:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | * @return authorized result code
*/
public Map<String, Object> authorizedUser(User loginUser, Integer alertgroupId) {
Map<String, Object> result = new HashMap<>(5);
if (check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)) {
return result;
}
List<User> userList = userMapper.queryUserListByAlertGroupId(alertgroupId);
result.put(Constants.DATA_LIST, userList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* check
*
* @param result result
* @param bool bool
* @param userNoOperationPerm status
* @return check result
*/
private boolean check(Map<String, Object> result, boolean bool, Status userNoOperationPerm) {
if (bool) {
result.put(Constants.STATUS, userNoOperationPerm);
result.put(Constants.MSG, userNoOperationPerm.getMsg());
return true;
}
return false;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,860 | [BUG] When a user has a resource directory tree, update the user's tenant to report an error |


**Which version of Dolphin Scheduler:**
-[dev_1.3.0]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.
| https://github.com/apache/dolphinscheduler/issues/2860 | https://github.com/apache/dolphinscheduler/pull/2876 | 6723454df9c7d85d3f034d2c13a080db4c130fc1 | 31dca43cdbaec861b2bfc5dc7407f50424216e3c | "2020-06-01T08:22:32Z" | java | "2020-06-02T10:33:06Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | /**
* @param tenantId tenant id
* @return true if tenant exists, otherwise return false
*/
private boolean checkTenantExists(int tenantId) {
return tenantMapper.queryById(tenantId) != null ? true : false;
}
/**
*
* @param userName
* @param password
* @param email
* @param phone
* @return if check failed return the field, otherwise return null
*/
private String checkUserParams(String userName, String password, String email, String phone) {
String msg = null;
if (!CheckUtils.checkUserName(userName)) {
msg = userName;
} else if (!CheckUtils.checkPassword(password)) {
msg = password;
} else if (!CheckUtils.checkEmail(email)) {
msg = email;
} else if (!CheckUtils.checkPhone(phone)) {
msg = phone;
}
return msg;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,892 | [BUG] When editing user information, clear the phone number, the database table t_ds_user.phone is not cleared |


**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2892 | https://github.com/apache/dolphinscheduler/pull/2898 | 4441d91dcf178653e55b94fe564c8c9907e897fa | ae9afcf77a930d10d1d61aa23172b831f1a41cdd | "2020-06-04T07:26:35Z" | java | "2020-06-04T09:26:59Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.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 | 2,892 | [BUG] When editing user information, clear the phone number, the database table t_ds_user.phone is not cleared |


**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2892 | https://github.com/apache/dolphinscheduler/pull/2898 | 4441d91dcf178653e55b94fe564c8c9907e897fa | ae9afcf77a930d10d1d61aa23172b831f1a41cdd | "2020-06-04T07:26:35Z" | java | "2020-06-04T09:26:59Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | */
package org.apache.dolphinscheduler.api.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.dolphinscheduler.api.dto.resources.ResourceComponent;
import org.apache.dolphinscheduler.api.dto.resources.visitor.ResourceTreeVisitor;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.exceptions.ServiceException;
import org.apache.dolphinscheduler.api.utils.CheckUtils;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.ResourceType;
import org.apache.dolphinscheduler.common.enums.UserType;
import org.apache.dolphinscheduler.common.utils.*;
import org.apache.dolphinscheduler.dao.entity.*;
import org.apache.dolphinscheduler.dao.mapper.*;
import org.apache.dolphinscheduler.dao.utils.ResourceProcessDefinitionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
/**
* user service
*/
@Service |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,892 | [BUG] When editing user information, clear the phone number, the database table t_ds_user.phone is not cleared |


**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2892 | https://github.com/apache/dolphinscheduler/pull/2898 | 4441d91dcf178653e55b94fe564c8c9907e897fa | ae9afcf77a930d10d1d61aa23172b831f1a41cdd | "2020-06-04T07:26:35Z" | java | "2020-06-04T09:26:59Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | public class UsersService extends BaseService {
private static final Logger logger = LoggerFactory.getLogger(UsersService.class);
@Autowired
private UserMapper userMapper;
@Autowired
private TenantMapper tenantMapper;
@Autowired
private ProjectUserMapper projectUserMapper;
@Autowired
private ResourceUserMapper resourcesUserMapper;
@Autowired
private ResourceMapper resourceMapper;
@Autowired
private DataSourceUserMapper datasourceUserMapper;
@Autowired
private UDFUserMapper udfUserMapper;
@Autowired
private AlertGroupMapper alertGroupMapper;
@Autowired
private ProcessDefinitionMapper processDefinitionMapper;
/**
* create user, only system admin have permission
*
* @param loginUser login user
* @param userName user name
* @param userPassword user password
* @param email email
* @param tenantId tenant id
* @param phone phone |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,892 | [BUG] When editing user information, clear the phone number, the database table t_ds_user.phone is not cleared |


**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2892 | https://github.com/apache/dolphinscheduler/pull/2898 | 4441d91dcf178653e55b94fe564c8c9907e897fa | ae9afcf77a930d10d1d61aa23172b831f1a41cdd | "2020-06-04T07:26:35Z" | java | "2020-06-04T09:26:59Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | * @param queue queue
* @return create result code
* @throws Exception exception
*/
@Transactional(rollbackFor = Exception.class)
public Map<String, Object> createUser(User loginUser,
String userName,
String userPassword,
String email,
int tenantId,
String phone,
String queue) throws Exception {
Map<String, Object> result = new HashMap<>(5);
String msg = this.checkUserParams(userName, userPassword, email, phone);
if (!StringUtils.isEmpty(msg)) {
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR,msg);
return result;
}
if (!isAdmin(loginUser)) {
putMsg(result, Status.USER_NO_OPERATION_PERM);
return result;
}
if (!checkTenantExists(tenantId)) {
putMsg(result, Status.TENANT_NOT_EXIST);
return result;
}
User user = createUser(userName, userPassword, email, tenantId, phone, queue);
Tenant tenant = tenantMapper.queryById(tenantId); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,892 | [BUG] When editing user information, clear the phone number, the database table t_ds_user.phone is not cleared |


**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2892 | https://github.com/apache/dolphinscheduler/pull/2898 | 4441d91dcf178653e55b94fe564c8c9907e897fa | ae9afcf77a930d10d1d61aa23172b831f1a41cdd | "2020-06-04T07:26:35Z" | java | "2020-06-04T09:26:59Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | if (PropertyUtils.getResUploadStartupState()){
if (!HadoopUtils.getInstance().exists(HadoopUtils.getHdfsTenantDir(tenant.getTenantCode()))){
createTenantDirIfNotExists(tenant.getTenantCode());
}
String userPath = HadoopUtils.getHdfsUserDir(tenant.getTenantCode(),user.getId());
HadoopUtils.getInstance().mkdir(userPath);
}
putMsg(result, Status.SUCCESS);
return result;
}
@Transactional(rollbackFor = Exception.class)
public User createUser(String userName,
String userPassword,
String email,
int tenantId,
String phone,
String queue) throws Exception {
User user = new User();
Date now = new Date();
user.setUserName(userName);
user.setUserPassword(EncryptionUtils.getMd5(userPassword));
user.setEmail(email);
user.setTenantId(tenantId);
user.setPhone(phone);
user.setUserType(UserType.GENERAL_USER);
user.setCreateTime(now);
user.setUpdateTime(now);
if (StringUtils.isEmpty(queue)){ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,892 | [BUG] When editing user information, clear the phone number, the database table t_ds_user.phone is not cleared |


**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2892 | https://github.com/apache/dolphinscheduler/pull/2898 | 4441d91dcf178653e55b94fe564c8c9907e897fa | ae9afcf77a930d10d1d61aa23172b831f1a41cdd | "2020-06-04T07:26:35Z" | java | "2020-06-04T09:26:59Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | queue = "";
}
user.setQueue(queue);
userMapper.insert(user);
return user;
}
/**
* query user by id
* @param id id
* @return user info
*/
public User queryUser(int id) {
return userMapper.selectById(id);
}
/**
* query user
* @param name name
* @return user info
*/
public User queryUser(String name) {
return userMapper.queryByUserNameAccurately(name);
}
/**
* query user
*
* @param name name
* @param password password
* @return user info
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,892 | [BUG] When editing user information, clear the phone number, the database table t_ds_user.phone is not cleared |


**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2892 | https://github.com/apache/dolphinscheduler/pull/2898 | 4441d91dcf178653e55b94fe564c8c9907e897fa | ae9afcf77a930d10d1d61aa23172b831f1a41cdd | "2020-06-04T07:26:35Z" | java | "2020-06-04T09:26:59Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | public User queryUser(String name, String password) {
String md5 = EncryptionUtils.getMd5(password);
return userMapper.queryUserByNamePassword(name, md5);
}
/**
* get user id by user name
* @param name user name
* @return if name empty 0, user not exists -1, user exist user id
*/
public int getUserIdByName(String name) {
int executorId = 0;
if (StringUtils.isNotEmpty(name)) {
User executor = queryUser(name);
if (null != executor) {
executorId = executor.getId();
} else {
executorId = -1;
}
}
return executorId;
}
/**
* query user list
*
* @param loginUser login user
* @param pageNo page number
* @param searchVal search avlue
* @param pageSize page size
* @return user list page |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,892 | [BUG] When editing user information, clear the phone number, the database table t_ds_user.phone is not cleared |


**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2892 | https://github.com/apache/dolphinscheduler/pull/2898 | 4441d91dcf178653e55b94fe564c8c9907e897fa | ae9afcf77a930d10d1d61aa23172b831f1a41cdd | "2020-06-04T07:26:35Z" | java | "2020-06-04T09:26:59Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | */
public Map<String, Object> queryUserList(User loginUser, String searchVal, Integer pageNo, Integer pageSize) {
Map<String, Object> result = new HashMap<>(5);
if (check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)) {
return result;
}
Page<User> page = new Page(pageNo, pageSize);
IPage<User> scheduleList = userMapper.queryUserPaging(page, searchVal);
PageInfo<User> pageInfo = new PageInfo<>(pageNo, pageSize);
pageInfo.setTotalCount((int)scheduleList.getTotal());
pageInfo.setLists(scheduleList.getRecords());
result.put(Constants.DATA_LIST, pageInfo);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* updateProcessInstance user
*
* @param userId user id
* @param userName user name
* @param userPassword user password
* @param email email
* @param tenantId tennat id
* @param phone phone
* @param queue queue
* @return update result code
* @throws Exception exception
*/
public Map<String, Object> updateUser(int userId,
String userName, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,892 | [BUG] When editing user information, clear the phone number, the database table t_ds_user.phone is not cleared |


**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2892 | https://github.com/apache/dolphinscheduler/pull/2898 | 4441d91dcf178653e55b94fe564c8c9907e897fa | ae9afcf77a930d10d1d61aa23172b831f1a41cdd | "2020-06-04T07:26:35Z" | java | "2020-06-04T09:26:59Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | String userPassword,
String email,
int tenantId,
String phone,
String queue) throws Exception {
Map<String, Object> result = new HashMap<>(5);
result.put(Constants.STATUS, false);
User user = userMapper.selectById(userId);
if (user == null) {
putMsg(result, Status.USER_NOT_EXIST, userId);
return result;
}
if (StringUtils.isNotEmpty(userName)) {
if (!CheckUtils.checkUserName(userName)){
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR,userName);
return result;
}
User tempUser = userMapper.queryByUserNameAccurately(userName);
if (tempUser != null && tempUser.getId() != userId) {
putMsg(result, Status.USER_NAME_EXIST);
return result;
}
user.setUserName(userName);
}
if (StringUtils.isNotEmpty(userPassword)) {
if (!CheckUtils.checkPassword(userPassword)){
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR,userPassword);
return result;
}
user.setUserPassword(EncryptionUtils.getMd5(userPassword)); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,892 | [BUG] When editing user information, clear the phone number, the database table t_ds_user.phone is not cleared |


**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2892 | https://github.com/apache/dolphinscheduler/pull/2898 | 4441d91dcf178653e55b94fe564c8c9907e897fa | ae9afcf77a930d10d1d61aa23172b831f1a41cdd | "2020-06-04T07:26:35Z" | java | "2020-06-04T09:26:59Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | }
if (StringUtils.isNotEmpty(email)) {
if (!CheckUtils.checkEmail(email)){
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR,email);
return result;
}
user.setEmail(email);
}
if (StringUtils.isNotEmpty(phone)) {
if (!CheckUtils.checkPhone(phone)){
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR,phone);
return result;
}
user.setPhone(phone);
}
user.setQueue(queue);
Date now = new Date();
user.setUpdateTime(now);
if (user.getTenantId() != tenantId) {
Tenant oldTenant = tenantMapper.queryById(user.getTenantId());
Tenant newTenant = tenantMapper.queryById(tenantId);
if (newTenant != null) {
if (PropertyUtils.getResUploadStartupState() && oldTenant != null){
String newTenantCode = newTenant.getTenantCode();
String oldResourcePath = HadoopUtils.getHdfsResDir(oldTenant.getTenantCode());
String oldUdfsPath = HadoopUtils.getHdfsUdfDir(oldTenant.getTenantCode()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,892 | [BUG] When editing user information, clear the phone number, the database table t_ds_user.phone is not cleared |


**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2892 | https://github.com/apache/dolphinscheduler/pull/2898 | 4441d91dcf178653e55b94fe564c8c9907e897fa | ae9afcf77a930d10d1d61aa23172b831f1a41cdd | "2020-06-04T07:26:35Z" | java | "2020-06-04T09:26:59Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | if (HadoopUtils.getInstance().exists(oldResourcePath)){
String newResourcePath = HadoopUtils.getHdfsResDir(newTenantCode);
String newUdfsPath = HadoopUtils.getHdfsUdfDir(newTenantCode);
List<Resource> fileResourcesList = resourceMapper.queryResourceList(
null, userId, ResourceType.FILE.ordinal());
if (CollectionUtils.isNotEmpty(fileResourcesList)) {
ResourceTreeVisitor resourceTreeVisitor = new ResourceTreeVisitor(fileResourcesList);
ResourceComponent resourceComponent = resourceTreeVisitor.visit();
copyResourceFiles(resourceComponent, oldResourcePath, newResourcePath);
}
List<Resource> udfResourceList = resourceMapper.queryResourceList(
null, userId, ResourceType.UDF.ordinal());
if (CollectionUtils.isNotEmpty(udfResourceList)) {
ResourceTreeVisitor resourceTreeVisitor = new ResourceTreeVisitor(udfResourceList);
ResourceComponent resourceComponent = resourceTreeVisitor.visit();
copyResourceFiles(resourceComponent, oldUdfsPath, newUdfsPath);
}
String oldUserPath = HadoopUtils.getHdfsUserDir(oldTenant.getTenantCode(),userId);
HadoopUtils.getInstance().delete(oldUserPath, true);
}else {
createTenantDirIfNotExists(oldTenant.getTenantCode());
}
if (HadoopUtils.getInstance().exists(HadoopUtils.getHdfsTenantDir(newTenant.getTenantCode()))){
String newUserPath = HadoopUtils.getHdfsUserDir(newTenant.getTenantCode(),user.getId());
HadoopUtils.getInstance().mkdir(newUserPath); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,892 | [BUG] When editing user information, clear the phone number, the database table t_ds_user.phone is not cleared |


**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2892 | https://github.com/apache/dolphinscheduler/pull/2898 | 4441d91dcf178653e55b94fe564c8c9907e897fa | ae9afcf77a930d10d1d61aa23172b831f1a41cdd | "2020-06-04T07:26:35Z" | java | "2020-06-04T09:26:59Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | }else {
createTenantDirIfNotExists(newTenant.getTenantCode());
}
}
}
user.setTenantId(tenantId);
}
userMapper.updateById(user);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* delete user
*
* @param loginUser login user
* @param id user id
* @return delete result code
* @throws Exception exception when operate hdfs
*/
public Map<String, Object> deleteUserById(User loginUser, int id) throws Exception {
Map<String, Object> result = new HashMap<>(5);
if (!isAdmin(loginUser)) {
putMsg(result, Status.USER_NO_OPERATION_PERM, id);
return result;
}
User tempUser = userMapper.selectById(id); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,892 | [BUG] When editing user information, clear the phone number, the database table t_ds_user.phone is not cleared |


**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2892 | https://github.com/apache/dolphinscheduler/pull/2898 | 4441d91dcf178653e55b94fe564c8c9907e897fa | ae9afcf77a930d10d1d61aa23172b831f1a41cdd | "2020-06-04T07:26:35Z" | java | "2020-06-04T09:26:59Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | if (tempUser == null) {
putMsg(result, Status.USER_NOT_EXIST, id);
return result;
}
User user = userMapper.queryTenantCodeByUserId(id);
if (user != null) {
if (PropertyUtils.getResUploadStartupState()) {
String userPath = HadoopUtils.getHdfsUserDir(user.getTenantCode(),id);
if (HadoopUtils.getInstance().exists(userPath)) {
HadoopUtils.getInstance().delete(userPath, true);
}
}
}
userMapper.deleteById(id);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* grant project
*
* @param loginUser login user
* @param userId user id
* @param projectIds project id array
* @return grant result code
*/
@Transactional(rollbackFor = Exception.class)
public Map<String, Object> grantProject(User loginUser, int userId, String projectIds) {
Map<String, Object> result = new HashMap<>(5);
result.put(Constants.STATUS, false); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,892 | [BUG] When editing user information, clear the phone number, the database table t_ds_user.phone is not cleared |


**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2892 | https://github.com/apache/dolphinscheduler/pull/2898 | 4441d91dcf178653e55b94fe564c8c9907e897fa | ae9afcf77a930d10d1d61aa23172b831f1a41cdd | "2020-06-04T07:26:35Z" | java | "2020-06-04T09:26:59Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | if (check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)) {
return result;
}
User tempUser = userMapper.selectById(userId);
if (tempUser == null) {
putMsg(result, Status.USER_NOT_EXIST, userId);
return result;
}
projectUserMapper.deleteProjectRelation(0, userId);
if (check(result, StringUtils.isEmpty(projectIds), Status.SUCCESS)) {
return result;
}
String[] projectIdArr = projectIds.split(",");
for (String projectId : projectIdArr) {
Date now = new Date();
ProjectUser projectUser = new ProjectUser();
projectUser.setUserId(userId);
projectUser.setProjectId(Integer.parseInt(projectId));
projectUser.setPerm(7);
projectUser.setCreateTime(now);
projectUser.setUpdateTime(now);
projectUserMapper.insert(projectUser);
}
putMsg(result, Status.SUCCESS);
return result;
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,892 | [BUG] When editing user information, clear the phone number, the database table t_ds_user.phone is not cleared |


**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2892 | https://github.com/apache/dolphinscheduler/pull/2898 | 4441d91dcf178653e55b94fe564c8c9907e897fa | ae9afcf77a930d10d1d61aa23172b831f1a41cdd | "2020-06-04T07:26:35Z" | java | "2020-06-04T09:26:59Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | * grant resource
*
* @param loginUser login user
* @param userId user id
* @param resourceIds resource id array
* @return grant result code
*/
@Transactional(rollbackFor = Exception.class)
public Map<String, Object> grantResources(User loginUser, int userId, String resourceIds) {
Map<String, Object> result = new HashMap<>(5);
if (check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)) {
return result;
}
User user = userMapper.selectById(userId);
if(user == null){
putMsg(result, Status.USER_NOT_EXIST, userId);
return result;
}
Set<Integer> needAuthorizeResIds = new HashSet();
if (StringUtils.isNotBlank(resourceIds)) {
String[] resourceFullIdArr = resourceIds.split(",");
for (String resourceFullId : resourceFullIdArr) {
String[] resourceIdArr = resourceFullId.split("-");
for (int i=0;i<=resourceIdArr.length-1;i++) {
int resourceIdValue = Integer.parseInt(resourceIdArr[i]);
needAuthorizeResIds.add(resourceIdValue);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,892 | [BUG] When editing user information, clear the phone number, the database table t_ds_user.phone is not cleared |


**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2892 | https://github.com/apache/dolphinscheduler/pull/2898 | 4441d91dcf178653e55b94fe564c8c9907e897fa | ae9afcf77a930d10d1d61aa23172b831f1a41cdd | "2020-06-04T07:26:35Z" | java | "2020-06-04T09:26:59Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | }
List<Resource> oldAuthorizedRes = resourceMapper.queryAuthorizedResourceList(userId);
Set<Integer> oldAuthorizedResIds = oldAuthorizedRes.stream().map(t -> t.getId()).collect(Collectors.toSet());
oldAuthorizedResIds.removeAll(needAuthorizeResIds);
if (CollectionUtils.isNotEmpty(oldAuthorizedResIds)) {
List<Map<String, Object>> list = processDefinitionMapper.listResourcesByUser(userId);
Map<Integer, Set<Integer>> resourceProcessMap = ResourceProcessDefinitionUtils.getResourceProcessDefinitionMap(list);
Set<Integer> resourceIdSet = resourceProcessMap.keySet();
resourceIdSet.retainAll(oldAuthorizedResIds);
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;
}
}
resourcesUserMapper.deleteResourceUser(userId, 0);
if (check(result, StringUtils.isEmpty(resourceIds), Status.SUCCESS)) {
return result;
}
for (int resourceIdValue : needAuthorizeResIds) {
Resource resource = resourceMapper.selectById(resourceIdValue);
if (resource == null) {
putMsg(result, Status.RESOURCE_NOT_EXIST); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,892 | [BUG] When editing user information, clear the phone number, the database table t_ds_user.phone is not cleared |


**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2892 | https://github.com/apache/dolphinscheduler/pull/2898 | 4441d91dcf178653e55b94fe564c8c9907e897fa | ae9afcf77a930d10d1d61aa23172b831f1a41cdd | "2020-06-04T07:26:35Z" | java | "2020-06-04T09:26:59Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | return result;
}
Date now = new Date();
ResourcesUser resourcesUser = new ResourcesUser();
resourcesUser.setUserId(userId);
resourcesUser.setResourcesId(resourceIdValue);
if (resource.isDirectory()) {
resourcesUser.setPerm(Constants.AUTHORIZE_READABLE_PERM);
}else{
resourcesUser.setPerm(Constants.AUTHORIZE_WRITABLE_PERM);
}
resourcesUser.setCreateTime(now);
resourcesUser.setUpdateTime(now);
resourcesUserMapper.insert(resourcesUser);
}
putMsg(result, Status.SUCCESS);
return result;
}
/**
* grant udf function
*
* @param loginUser login user
* @param userId user id
* @param udfIds udf id array
* @return grant result code
*/
@Transactional(rollbackFor = Exception.class)
public Map<String, Object> grantUDFFunction(User loginUser, int userId, String udfIds) {
Map<String, Object> result = new HashMap<>(5); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,892 | [BUG] When editing user information, clear the phone number, the database table t_ds_user.phone is not cleared |


**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2892 | https://github.com/apache/dolphinscheduler/pull/2898 | 4441d91dcf178653e55b94fe564c8c9907e897fa | ae9afcf77a930d10d1d61aa23172b831f1a41cdd | "2020-06-04T07:26:35Z" | java | "2020-06-04T09:26:59Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | if (check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)) {
return result;
}
User user = userMapper.selectById(userId);
if(user == null){
putMsg(result, Status.USER_NOT_EXIST, userId);
return result;
}
udfUserMapper.deleteByUserId(userId);
if (check(result, StringUtils.isEmpty(udfIds), Status.SUCCESS)) {
return result;
}
String[] resourcesIdArr = udfIds.split(",");
for (String udfId : resourcesIdArr) {
Date now = new Date();
UDFUser udfUser = new UDFUser();
udfUser.setUserId(userId);
udfUser.setUdfId(Integer.parseInt(udfId));
udfUser.setPerm(7);
udfUser.setCreateTime(now);
udfUser.setUpdateTime(now);
udfUserMapper.insert(udfUser);
}
putMsg(result, Status.SUCCESS);
return result;
}
/**
* grant datasource
*
* @param loginUser login user |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,892 | [BUG] When editing user information, clear the phone number, the database table t_ds_user.phone is not cleared |


**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2892 | https://github.com/apache/dolphinscheduler/pull/2898 | 4441d91dcf178653e55b94fe564c8c9907e897fa | ae9afcf77a930d10d1d61aa23172b831f1a41cdd | "2020-06-04T07:26:35Z" | java | "2020-06-04T09:26:59Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | * @param userId user id
* @param datasourceIds data source id array
* @return grant result code
*/
@Transactional(rollbackFor = Exception.class)
public Map<String, Object> grantDataSource(User loginUser, int userId, String datasourceIds) {
Map<String, Object> result = new HashMap<>(5);
result.put(Constants.STATUS, false);
if (check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)) {
return result;
}
User user = userMapper.selectById(userId);
if(user == null){
putMsg(result, Status.USER_NOT_EXIST, userId);
return result;
}
datasourceUserMapper.deleteByUserId(userId);
if (check(result, StringUtils.isEmpty(datasourceIds), Status.SUCCESS)) {
return result;
}
String[] datasourceIdArr = datasourceIds.split(",");
for (String datasourceId : datasourceIdArr) {
Date now = new Date();
DatasourceUser datasourceUser = new DatasourceUser();
datasourceUser.setUserId(userId);
datasourceUser.setDatasourceId(Integer.parseInt(datasourceId));
datasourceUser.setPerm(7);
datasourceUser.setCreateTime(now);
datasourceUser.setUpdateTime(now); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,892 | [BUG] When editing user information, clear the phone number, the database table t_ds_user.phone is not cleared |


**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2892 | https://github.com/apache/dolphinscheduler/pull/2898 | 4441d91dcf178653e55b94fe564c8c9907e897fa | ae9afcf77a930d10d1d61aa23172b831f1a41cdd | "2020-06-04T07:26:35Z" | java | "2020-06-04T09:26:59Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | datasourceUserMapper.insert(datasourceUser);
}
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query user info
*
* @param loginUser login user
* @return user info
*/
public Map<String, Object> getUserInfo(User loginUser) {
Map<String, Object> result = new HashMap<>();
User user = null;
if (loginUser.getUserType() == UserType.ADMIN_USER) {
user = loginUser;
} else {
user = userMapper.queryDetailsById(loginUser.getId());
List<AlertGroup> alertGroups = alertGroupMapper.queryByUserId(loginUser.getId());
StringBuilder sb = new StringBuilder();
if (alertGroups != null && alertGroups.size() > 0) {
for (int i = 0; i < alertGroups.size() - 1; i++) {
sb.append(alertGroups.get(i).getGroupName() + ",");
}
sb.append(alertGroups.get(alertGroups.size() - 1));
user.setAlertGroup(sb.toString());
}
}
result.put(Constants.DATA_LIST, user);
putMsg(result, Status.SUCCESS); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,892 | [BUG] When editing user information, clear the phone number, the database table t_ds_user.phone is not cleared |


**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2892 | https://github.com/apache/dolphinscheduler/pull/2898 | 4441d91dcf178653e55b94fe564c8c9907e897fa | ae9afcf77a930d10d1d61aa23172b831f1a41cdd | "2020-06-04T07:26:35Z" | java | "2020-06-04T09:26:59Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | return result;
}
/**
* query user list
*
* @param loginUser login user
* @return user list
*/
public Map<String, Object> queryAllGeneralUsers(User loginUser) {
Map<String, Object> result = new HashMap<>(5);
if (check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)) {
return result;
}
List<User> userList = userMapper.queryAllGeneralUser();
result.put(Constants.DATA_LIST, userList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query user list
*
* @param loginUser login user
* @return user list
*/
public Map<String, Object> queryUserList(User loginUser) {
Map<String, Object> result = new HashMap<>(5);
if (check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)) {
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,892 | [BUG] When editing user information, clear the phone number, the database table t_ds_user.phone is not cleared |


**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2892 | https://github.com/apache/dolphinscheduler/pull/2898 | 4441d91dcf178653e55b94fe564c8c9907e897fa | ae9afcf77a930d10d1d61aa23172b831f1a41cdd | "2020-06-04T07:26:35Z" | java | "2020-06-04T09:26:59Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | }
List<User> userList = userMapper.selectList(null );
result.put(Constants.DATA_LIST, userList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* verify user name exists
*
* @param userName user name
* @return true if user name not exists, otherwise return false
*/
public Result verifyUserName(String userName) {
Result result = new Result();
User user = userMapper.queryByUserNameAccurately(userName);
if (user != null) {
logger.error("user {} has exist, can't create again.", userName);
putMsg(result, Status.USER_NAME_EXIST);
} else {
putMsg(result, Status.SUCCESS);
}
return result;
}
/**
* unauthorized user
*
* @param loginUser login user
* @param alertgroupId alert group id
* @return unauthorize result code
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,892 | [BUG] When editing user information, clear the phone number, the database table t_ds_user.phone is not cleared |


**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2892 | https://github.com/apache/dolphinscheduler/pull/2898 | 4441d91dcf178653e55b94fe564c8c9907e897fa | ae9afcf77a930d10d1d61aa23172b831f1a41cdd | "2020-06-04T07:26:35Z" | java | "2020-06-04T09:26:59Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | public Map<String, Object> unauthorizedUser(User loginUser, Integer alertgroupId) {
Map<String, Object> result = new HashMap<>(5);
if (check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)) {
return result;
}
List<User> userList = userMapper.selectList(null );
List<User> resultUsers = new ArrayList<>();
Set<User> userSet = null;
if (userList != null && userList.size() > 0) {
userSet = new HashSet<>(userList);
List<User> authedUserList = userMapper.queryUserListByAlertGroupId(alertgroupId);
Set<User> authedUserSet = null;
if (authedUserList != null && authedUserList.size() > 0) {
authedUserSet = new HashSet<>(authedUserList);
userSet.removeAll(authedUserSet);
}
resultUsers = new ArrayList<>(userSet);
}
result.put(Constants.DATA_LIST, resultUsers);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* authorized user
*
* @param loginUser login user
* @param alertgroupId alert group id
* @return authorized result code
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,892 | [BUG] When editing user information, clear the phone number, the database table t_ds_user.phone is not cleared |


**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2892 | https://github.com/apache/dolphinscheduler/pull/2898 | 4441d91dcf178653e55b94fe564c8c9907e897fa | ae9afcf77a930d10d1d61aa23172b831f1a41cdd | "2020-06-04T07:26:35Z" | java | "2020-06-04T09:26:59Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | public Map<String, Object> authorizedUser(User loginUser, Integer alertgroupId) {
Map<String, Object> result = new HashMap<>(5);
if (check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)) {
return result;
}
List<User> userList = userMapper.queryUserListByAlertGroupId(alertgroupId);
result.put(Constants.DATA_LIST, userList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* check
*
* @param result result
* @param bool bool
* @param userNoOperationPerm status
* @return check result
*/
private boolean check(Map<String, Object> result, boolean bool, Status userNoOperationPerm) {
if (bool) {
result.put(Constants.STATUS, userNoOperationPerm);
result.put(Constants.MSG, userNoOperationPerm.getMsg());
return true;
}
return false;
}
/**
* @param tenantId tenant id |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,892 | [BUG] When editing user information, clear the phone number, the database table t_ds_user.phone is not cleared |


**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2892 | https://github.com/apache/dolphinscheduler/pull/2898 | 4441d91dcf178653e55b94fe564c8c9907e897fa | ae9afcf77a930d10d1d61aa23172b831f1a41cdd | "2020-06-04T07:26:35Z" | java | "2020-06-04T09:26:59Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | * @return true if tenant exists, otherwise return false
*/
private boolean checkTenantExists(int tenantId) {
return tenantMapper.queryById(tenantId) != null ? true : false;
}
/**
*
* @param userName
* @param password
* @param email
* @param phone
* @return if check failed return the field, otherwise return null
*/
private String checkUserParams(String userName, String password, String email, String phone) {
String msg = null;
if (!CheckUtils.checkUserName(userName)) {
msg = userName;
} else if (!CheckUtils.checkPassword(password)) {
msg = password;
} else if (!CheckUtils.checkEmail(email)) {
msg = email;
} else if (!CheckUtils.checkPhone(phone)) {
msg = phone;
}
return msg;
}
/**
* copy resource files
* @param resourceComponent resource component
* @param srcBasePath src base path |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,892 | [BUG] When editing user information, clear the phone number, the database table t_ds_user.phone is not cleared |


**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
| https://github.com/apache/dolphinscheduler/issues/2892 | https://github.com/apache/dolphinscheduler/pull/2898 | 4441d91dcf178653e55b94fe564c8c9907e897fa | ae9afcf77a930d10d1d61aa23172b831f1a41cdd | "2020-06-04T07:26:35Z" | java | "2020-06-04T09:26:59Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/UsersService.java | * @param dstBasePath dst base path
* @throws IOException io exception
*/
private void copyResourceFiles(ResourceComponent resourceComponent, String srcBasePath, String dstBasePath) throws IOException {
List<ResourceComponent> components = resourceComponent.getChildren();
if (CollectionUtils.isNotEmpty(components)) {
for (ResourceComponent component:components) {
if (!HadoopUtils.getInstance().exists(String.format("%s/%s",srcBasePath,component.getFullName()))){
logger.error("resource file: {} not exist,copy error",component.getFullName());
throw new ServiceException(Status.RESOURCE_NOT_EXIST);
}
if (!component.isDirctory()) {
HadoopUtils.getInstance().copy(String.format("%s/%s",srcBasePath,component.getFullName()),String.format("%s/%s",dstBasePath,component.getFullName()),false,true);
continue;
}
if(CollectionUtils.isEmpty(component.getChildren())) {
if (!HadoopUtils.getInstance().exists(String.format("%s/%s",dstBasePath,component.getFullName()))) {
HadoopUtils.getInstance().mkdir(String.format("%s/%s",dstBasePath,component.getFullName()));
}
}else{
copyResourceFiles(component,srcBasePath,dstBasePath);
}
}
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,910 | [BUG] master server will show exception for some time when master server restart, it's just dispatching task | *For better global communication, please give priority to using English description, thx! *
**Describe the bug**
[ERROR] 2020-06-06 15:46:22.683 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[152] - dispatch error
org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=1, bodyLen=1619] due to no suitable worker , current task need to default worker group execute
at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:87)
at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:149)
at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:118)
**To Reproduce**
1、worker server runs normally, click `start workflow` ,
2、then restart master server , master server runtime log will show the following exception for some time(about 30 seconds), then master will go works normally
**Which version of Dolphin Scheduler:**
-[ dev-1.3.0 ]
| https://github.com/apache/dolphinscheduler/issues/2910 | https://github.com/apache/dolphinscheduler/pull/2913 | 0de8e589651396925f66549b75e57b9673669291 | 5c9b080ab85ffc458557ebcbb5e8bf30a7c40ed0 | "2020-06-06T07:57:47Z" | java | "2020-06-06T10:24:26Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/dispatch/host/LowerWeightHostManager.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. |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,910 | [BUG] master server will show exception for some time when master server restart, it's just dispatching task | *For better global communication, please give priority to using English description, thx! *
**Describe the bug**
[ERROR] 2020-06-06 15:46:22.683 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[152] - dispatch error
org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=1, bodyLen=1619] due to no suitable worker , current task need to default worker group execute
at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:87)
at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:149)
at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:118)
**To Reproduce**
1、worker server runs normally, click `start workflow` ,
2、then restart master server , master server runtime log will show the following exception for some time(about 30 seconds), then master will go works normally
**Which version of Dolphin Scheduler:**
-[ dev-1.3.0 ]
| https://github.com/apache/dolphinscheduler/issues/2910 | https://github.com/apache/dolphinscheduler/pull/2913 | 0de8e589651396925f66549b75e57b9673669291 | 5c9b080ab85ffc458557ebcbb5e8bf30a7c40ed0 | "2020-06-06T07:57:47Z" | java | "2020-06-06T10:24:26Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/dispatch/host/LowerWeightHostManager.java | * See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.master.dispatch.host;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.utils.CollectionUtils;
import org.apache.dolphinscheduler.common.utils.StringUtils;
import org.apache.dolphinscheduler.remote.utils.Host;
import org.apache.dolphinscheduler.remote.utils.NamedThreadFactory;
import org.apache.dolphinscheduler.server.master.dispatch.context.ExecutionContext;
import org.apache.dolphinscheduler.server.master.dispatch.host.assign.HostWeight;
import org.apache.dolphinscheduler.server.master.dispatch.host.assign.LowerWeightRoundRobin;
import org.apache.dolphinscheduler.server.registry.ZookeeperRegistryCenter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import static org.apache.dolphinscheduler.common.Constants.COMMA;
/**
* round robin host manager
*/
public class LowerWeightHostManager extends CommonHostManager { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,910 | [BUG] master server will show exception for some time when master server restart, it's just dispatching task | *For better global communication, please give priority to using English description, thx! *
**Describe the bug**
[ERROR] 2020-06-06 15:46:22.683 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[152] - dispatch error
org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=1, bodyLen=1619] due to no suitable worker , current task need to default worker group execute
at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:87)
at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:149)
at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:118)
**To Reproduce**
1、worker server runs normally, click `start workflow` ,
2、then restart master server , master server runtime log will show the following exception for some time(about 30 seconds), then master will go works normally
**Which version of Dolphin Scheduler:**
-[ dev-1.3.0 ]
| https://github.com/apache/dolphinscheduler/issues/2910 | https://github.com/apache/dolphinscheduler/pull/2913 | 0de8e589651396925f66549b75e57b9673669291 | 5c9b080ab85ffc458557ebcbb5e8bf30a7c40ed0 | "2020-06-06T07:57:47Z" | java | "2020-06-06T10:24:26Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/dispatch/host/LowerWeightHostManager.java | private final Logger logger = LoggerFactory.getLogger(LowerWeightHostManager.class);
/**
* zookeeper registry center
*/
@Autowired
private ZookeeperRegistryCenter registryCenter;
/**
* round robin host manager
*/
private RoundRobinHostManager roundRobinHostManager;
/**
* selector
*/
private LowerWeightRoundRobin selector;
/**
* worker host weights
*/
private ConcurrentHashMap<String, Set<HostWeight>> workerHostWeightsMap;
/**
* worker group host lock
*/
private Lock lock;
/**
* executor service |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,910 | [BUG] master server will show exception for some time when master server restart, it's just dispatching task | *For better global communication, please give priority to using English description, thx! *
**Describe the bug**
[ERROR] 2020-06-06 15:46:22.683 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[152] - dispatch error
org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=1, bodyLen=1619] due to no suitable worker , current task need to default worker group execute
at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:87)
at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:149)
at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:118)
**To Reproduce**
1、worker server runs normally, click `start workflow` ,
2、then restart master server , master server runtime log will show the following exception for some time(about 30 seconds), then master will go works normally
**Which version of Dolphin Scheduler:**
-[ dev-1.3.0 ]
| https://github.com/apache/dolphinscheduler/issues/2910 | https://github.com/apache/dolphinscheduler/pull/2913 | 0de8e589651396925f66549b75e57b9673669291 | 5c9b080ab85ffc458557ebcbb5e8bf30a7c40ed0 | "2020-06-06T07:57:47Z" | java | "2020-06-06T10:24:26Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/dispatch/host/LowerWeightHostManager.java | */
private ScheduledExecutorService executorService;
@PostConstruct
public void init(){
this.selector = new LowerWeightRoundRobin();
this.workerHostWeightsMap = new ConcurrentHashMap<>();
this.lock = new ReentrantLock();
this.executorService = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("LowerWeightHostManagerExecutor"));
this.executorService.scheduleWithFixedDelay(new RefreshResourceTask(),35, 40, TimeUnit.SECONDS);
this.roundRobinHostManager = new RoundRobinHostManager();
this.roundRobinHostManager.setZookeeperNodeManager(getZookeeperNodeManager());
}
@PreDestroy
public void close(){
this.executorService.shutdownNow();
}
/**
* select host
* @param context context
* @return host
*/
@Override
public Host select(ExecutionContext context){
Set<HostWeight> workerHostWeights = getWorkerHostWeights(context.getWorkerGroup());
if(CollectionUtils.isNotEmpty(workerHostWeights)){
return selector.select(workerHostWeights).getHost();
}
return new Host();
}
@Override |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,910 | [BUG] master server will show exception for some time when master server restart, it's just dispatching task | *For better global communication, please give priority to using English description, thx! *
**Describe the bug**
[ERROR] 2020-06-06 15:46:22.683 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[152] - dispatch error
org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=1, bodyLen=1619] due to no suitable worker , current task need to default worker group execute
at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:87)
at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:149)
at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:118)
**To Reproduce**
1、worker server runs normally, click `start workflow` ,
2、then restart master server , master server runtime log will show the following exception for some time(about 30 seconds), then master will go works normally
**Which version of Dolphin Scheduler:**
-[ dev-1.3.0 ]
| https://github.com/apache/dolphinscheduler/issues/2910 | https://github.com/apache/dolphinscheduler/pull/2913 | 0de8e589651396925f66549b75e57b9673669291 | 5c9b080ab85ffc458557ebcbb5e8bf30a7c40ed0 | "2020-06-06T07:57:47Z" | java | "2020-06-06T10:24:26Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/dispatch/host/LowerWeightHostManager.java | public Host select(Collection<Host> nodes) {
throw new UnsupportedOperationException("not support");
}
private void syncWorkerHostWeight(Map<String, Set<HostWeight>> workerHostWeights){
lock.lock();
try {
workerHostWeightsMap.clear();
workerHostWeightsMap.putAll(workerHostWeights);
} finally {
lock.unlock();
}
}
private Set<HostWeight> getWorkerHostWeights(String workerGroup){
lock.lock();
try {
return workerHostWeightsMap.get(workerGroup);
} finally {
lock.unlock();
}
}
class RefreshResourceTask implements Runnable{
@Override
public void run() {
try {
Map<String, Set<String>> workerGroupNodes = zookeeperNodeManager.getWorkerGroupNodes();
Set<Map.Entry<String, Set<String>>> entries = workerGroupNodes.entrySet();
Map<String, Set<HostWeight>> workerHostWeights = new HashMap<>();
for(Map.Entry<String, Set<String>> entry : entries){
String workerGroup = entry.getKey();
Set<String> nodes = entry.getValue(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,910 | [BUG] master server will show exception for some time when master server restart, it's just dispatching task | *For better global communication, please give priority to using English description, thx! *
**Describe the bug**
[ERROR] 2020-06-06 15:46:22.683 org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer:[152] - dispatch error
org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException: fail to execute : Command [type=TASK_EXECUTE_REQUEST, opaque=1, bodyLen=1619] due to no suitable worker , current task need to default worker group execute
at org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher.dispatch(ExecutorDispatcher.java:87)
at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.dispatch(TaskPriorityQueueConsumer.java:149)
at org.apache.dolphinscheduler.server.master.consumer.TaskPriorityQueueConsumer.run(TaskPriorityQueueConsumer.java:118)
**To Reproduce**
1、worker server runs normally, click `start workflow` ,
2、then restart master server , master server runtime log will show the following exception for some time(about 30 seconds), then master will go works normally
**Which version of Dolphin Scheduler:**
-[ dev-1.3.0 ]
| https://github.com/apache/dolphinscheduler/issues/2910 | https://github.com/apache/dolphinscheduler/pull/2913 | 0de8e589651396925f66549b75e57b9673669291 | 5c9b080ab85ffc458557ebcbb5e8bf30a7c40ed0 | "2020-06-06T07:57:47Z" | java | "2020-06-06T10:24:26Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/dispatch/host/LowerWeightHostManager.java | String workerGroupPath = registryCenter.getWorkerGroupPath(workerGroup);
Set<HostWeight> hostWeights = new HashSet<>(nodes.size());
for(String node : nodes){
String heartbeat = registryCenter.getZookeeperCachedOperator().get(workerGroupPath + "/" + node);
if(StringUtils.isNotEmpty(heartbeat)
&& heartbeat.split(COMMA).length == Constants.HEARTBEAT_FOR_ZOOKEEPER_INFO_LENGTH){
String[] parts = heartbeat.split(COMMA);
int status = Integer.parseInt(parts[8]);
if (status == Constants.ABNORMAL_NODE_STATUS){
logger.warn("load is too high or availablePhysicalMemorySize(G) is too low, it's availablePhysicalMemorySize(G):{},loadAvg:{}",
Double.parseDouble(parts[3]) , Double.parseDouble(parts[2]));
continue;
}
double cpu = Double.parseDouble(parts[0]);
double memory = Double.parseDouble(parts[1]);
double loadAverage = Double.parseDouble(parts[2]);
HostWeight hostWeight = new HostWeight(Host.of(node), cpu, memory, loadAverage);
hostWeights.add(hostWeight);
}
}
workerHostWeights.put(workerGroup, hostWeights);
}
syncWorkerHostWeight(workerHostWeights);
} catch (Throwable ex){
logger.error("RefreshResourceTask error", ex);
}
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,715 | compile error on UsersServiceTest |
**Describe the bug**
compile error on UsersServiceTest.java
**To Reproduce**
mvn package
**Expected behavior**
remove unused import
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/2715 | https://github.com/apache/dolphinscheduler/pull/2718 | 11c4c583286d913c17eb8efff029d93d89f98b25 | 9fd728908fd41b8aecc9565687060f96f413936a | "2020-05-14T07:15:13Z" | java | "2020-06-14T02:27:13Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.api.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.avro.generic.GenericData; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,715 | compile error on UsersServiceTest |
**Describe the bug**
compile error on UsersServiceTest.java
**To Reproduce**
mvn package
**Expected behavior**
remove unused import
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/2715 | https://github.com/apache/dolphinscheduler/pull/2718 | 11c4c583286d913c17eb8efff029d93d89f98b25 | 9fd728908fd41b8aecc9565687060f96f413936a | "2020-05-14T07:15:13Z" | java | "2020-06-14T02:27:13Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.ResourceType;
import org.apache.dolphinscheduler.common.enums.UserType;
import org.apache.dolphinscheduler.common.utils.CollectionUtils;
import org.apache.dolphinscheduler.common.utils.EncryptionUtils;
import org.apache.dolphinscheduler.dao.entity.Resource;
import org.apache.dolphinscheduler.dao.entity.Tenant;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.*;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,715 | compile error on UsersServiceTest |
**Describe the bug**
compile error on UsersServiceTest.java
**To Reproduce**
mvn package
**Expected behavior**
remove unused import
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/2715 | https://github.com/apache/dolphinscheduler/pull/2718 | 11c4c583286d913c17eb8efff029d93d89f98b25 | 9fd728908fd41b8aecc9565687060f96f413936a | "2020-05-14T07:15:13Z" | java | "2020-06-14T02:27:13Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | public class UsersServiceTest {
private static final Logger logger = LoggerFactory.getLogger(UsersServiceTest.class);
@InjectMocks
private UsersService usersService;
@Mock
private UserMapper userMapper;
@Mock
private TenantMapper tenantMapper;
@Mock
private ProjectUserMapper projectUserMapper;
@Mock
private ResourceUserMapper resourcesUserMapper;
@Mock
private UDFUserMapper udfUserMapper;
@Mock
private DataSourceUserMapper datasourceUserMapper;
@Mock
private AlertGroupMapper alertGroupMapper;
@Mock
private ResourceMapper resourceMapper;
private String queueName ="UsersServiceTestQueue";
@Before
public void before(){ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,715 | compile error on UsersServiceTest |
**Describe the bug**
compile error on UsersServiceTest.java
**To Reproduce**
mvn package
**Expected behavior**
remove unused import
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/2715 | https://github.com/apache/dolphinscheduler/pull/2718 | 11c4c583286d913c17eb8efff029d93d89f98b25 | 9fd728908fd41b8aecc9565687060f96f413936a | "2020-05-14T07:15:13Z" | java | "2020-06-14T02:27:13Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | }
@After
public void after(){
}
@Test
public void testCreateUser(){
User user = new User();
user.setUserType(UserType.ADMIN_USER);
String userName = "userTest0001~";
String userPassword = "userTest";
String email = "[email protected]";
int tenantId = Integer.MAX_VALUE;
String phone= "13456432345";
int state = 1;
try {
Map<String, Object> result = usersService.createUser(user, userName, userPassword, email, tenantId, phone, queueName, state);
logger.info(result.toString());
Assert.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR, result.get(Constants.STATUS));
userName = "userTest0001";
userPassword = "userTest000111111111111111";
result = usersService.createUser(user, userName, userPassword, email, tenantId, phone, queueName, state);
logger.info(result.toString());
Assert.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR, result.get(Constants.STATUS));
userPassword = "userTest0001";
email = "1q.com";
result = usersService.createUser(user, userName, userPassword, email, tenantId, phone, queueName, state);
logger.info(result.toString()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,715 | compile error on UsersServiceTest |
**Describe the bug**
compile error on UsersServiceTest.java
**To Reproduce**
mvn package
**Expected behavior**
remove unused import
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/2715 | https://github.com/apache/dolphinscheduler/pull/2718 | 11c4c583286d913c17eb8efff029d93d89f98b25 | 9fd728908fd41b8aecc9565687060f96f413936a | "2020-05-14T07:15:13Z" | java | "2020-06-14T02:27:13Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | Assert.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR, result.get(Constants.STATUS));
email = "[email protected]";
phone ="2233";
result = usersService.createUser(user, userName, userPassword, email, tenantId, phone, queueName, state);
logger.info(result.toString());
Assert.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR, result.get(Constants.STATUS));
phone = "13456432345";
result = usersService.createUser(user, userName, userPassword, email, tenantId, phone, queueName, state);
logger.info(result.toString());
Assert.assertEquals(Status.TENANT_NOT_EXIST, result.get(Constants.STATUS));
Mockito.when(tenantMapper.queryById(1)).thenReturn(getTenant());
result = usersService.createUser(user, userName, userPassword, email, 1, phone, queueName, state);
logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
} catch (Exception e) {
logger.error(Status.CREATE_USER_ERROR.getMsg(),e);
Assert.assertTrue(false);
}
}
@Test
public void testQueryUser(){
String userName = "userTest0001";
String userPassword = "userTest0001";
when(userMapper.queryUserByNamePassword(userName,EncryptionUtils.getMd5(userPassword))).thenReturn(getGeneralUser());
User queryUser = usersService.queryUser(userName, userPassword);
logger.info(queryUser.toString());
Assert.assertTrue(queryUser!=null); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,715 | compile error on UsersServiceTest |
**Describe the bug**
compile error on UsersServiceTest.java
**To Reproduce**
mvn package
**Expected behavior**
remove unused import
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/2715 | https://github.com/apache/dolphinscheduler/pull/2718 | 11c4c583286d913c17eb8efff029d93d89f98b25 | 9fd728908fd41b8aecc9565687060f96f413936a | "2020-05-14T07:15:13Z" | java | "2020-06-14T02:27:13Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | }
@Test
public void testGetUserIdByName() {
User user = new User();
user.setId(1);
user.setUserType(UserType.ADMIN_USER);
user.setUserName("test_user");
int userId = usersService.getUserIdByName("");
Assert.assertEquals(0, userId);
when(usersService.queryUser(user.getUserName())).thenReturn(null);
int userNotExistId = usersService.getUserIdByName(user.getUserName());
Assert.assertEquals(-1, userNotExistId);
when(usersService.queryUser(user.getUserName())).thenReturn(user);
int userExistId = usersService.getUserIdByName(user.getUserName());
Assert.assertEquals(user.getId(), userExistId);
}
@Test
public void testQueryUserList(){
User user = new User();
Map<String, Object> result = usersService.queryUserList(user);
logger.info(result.toString());
Assert.assertEquals(Status.USER_NO_OPERATION_PERM, result.get(Constants.STATUS));
user.setUserType(UserType.ADMIN_USER);
when(userMapper.selectList(null )).thenReturn(getUserList());
result = usersService.queryUserList(user); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,715 | compile error on UsersServiceTest |
**Describe the bug**
compile error on UsersServiceTest.java
**To Reproduce**
mvn package
**Expected behavior**
remove unused import
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/2715 | https://github.com/apache/dolphinscheduler/pull/2718 | 11c4c583286d913c17eb8efff029d93d89f98b25 | 9fd728908fd41b8aecc9565687060f96f413936a | "2020-05-14T07:15:13Z" | java | "2020-06-14T02:27:13Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | List<User> userList = (List<User>) result.get(Constants.DATA_LIST);
Assert.assertTrue(userList.size()>0);
}
@Test
public void testQueryUserListPage(){
User user = new User();
IPage<User> page = new Page<>(1,10);
page.setRecords(getUserList());
when(userMapper.queryUserPaging(any(Page.class), eq("userTest"))).thenReturn(page);
Map<String, Object> result = usersService.queryUserList(user,"userTest",1,10);
logger.info(result.toString());
Assert.assertEquals(Status.USER_NO_OPERATION_PERM, result.get(Constants.STATUS));
user.setUserType(UserType.ADMIN_USER);
result = usersService.queryUserList(user,"userTest",1,10);
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
PageInfo<User> pageInfo = (PageInfo<User>) result.get(Constants.DATA_LIST);
Assert.assertTrue(pageInfo.getLists().size()>0);
}
@Test
public void testUpdateUser(){
String userName = "userTest0001";
String userPassword = "userTest0001";
try {
Map<String, Object> result = usersService.updateUser(0,userName,userPassword,"[email protected]",1,"13457864543","queue", 1);
Assert.assertEquals(Status.USER_NOT_EXIST, result.get(Constants.STATUS));
logger.info(result.toString()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,715 | compile error on UsersServiceTest |
**Describe the bug**
compile error on UsersServiceTest.java
**To Reproduce**
mvn package
**Expected behavior**
remove unused import
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/2715 | https://github.com/apache/dolphinscheduler/pull/2718 | 11c4c583286d913c17eb8efff029d93d89f98b25 | 9fd728908fd41b8aecc9565687060f96f413936a | "2020-05-14T07:15:13Z" | java | "2020-06-14T02:27:13Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | when(userMapper.selectById(1)).thenReturn(getUser());
result = usersService.updateUser(1,userName,userPassword,"[email protected]",1,"13457864543","queue", 1);
logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
} catch (Exception e) {
logger.error("update user error",e);
Assert.assertTrue(false);
}
}
@Test
public void testDeleteUserById(){
User loginUser = new User();
try {
when(userMapper.queryTenantCodeByUserId(1)).thenReturn(getUser());
when(userMapper.selectById(1)).thenReturn(getUser());
Map<String, Object> result = usersService.deleteUserById(loginUser,3);
logger.info(result.toString());
Assert.assertEquals(Status.USER_NO_OPERATION_PERM, result.get(Constants.STATUS));
loginUser.setUserType(UserType.ADMIN_USER);
result = usersService.deleteUserById(loginUser,3);
logger.info(result.toString());
Assert.assertEquals(Status.USER_NOT_EXIST, result.get(Constants.STATUS));
result = usersService.deleteUserById(loginUser,1);
logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
} catch (Exception e) {
logger.error("delete user error",e); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,715 | compile error on UsersServiceTest |
**Describe the bug**
compile error on UsersServiceTest.java
**To Reproduce**
mvn package
**Expected behavior**
remove unused import
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/2715 | https://github.com/apache/dolphinscheduler/pull/2718 | 11c4c583286d913c17eb8efff029d93d89f98b25 | 9fd728908fd41b8aecc9565687060f96f413936a | "2020-05-14T07:15:13Z" | java | "2020-06-14T02:27:13Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | Assert.assertTrue(false);
}
}
@Test
public void testGrantProject(){
when(userMapper.selectById(1)).thenReturn(getUser());
User loginUser = new User();
String projectIds= "100000,120000";
Map<String, Object> result = usersService.grantProject(loginUser, 1, projectIds);
logger.info(result.toString());
Assert.assertEquals(Status.USER_NO_OPERATION_PERM, result.get(Constants.STATUS));
loginUser.setUserType(UserType.ADMIN_USER);
result = usersService.grantProject(loginUser, 2, projectIds);
logger.info(result.toString());
Assert.assertEquals(Status.USER_NOT_EXIST, result.get(Constants.STATUS));
result = usersService.grantProject(loginUser, 1, projectIds);
logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
}
@Test
public void testGrantResources(){
String resourceIds = "100000,120000";
when(userMapper.selectById(1)).thenReturn(getUser());
User loginUser = new User();
Map<String, Object> result = usersService.grantResources(loginUser, 1, resourceIds);
logger.info(result.toString());
Assert.assertEquals(Status.USER_NO_OPERATION_PERM, result.get(Constants.STATUS)); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,715 | compile error on UsersServiceTest |
**Describe the bug**
compile error on UsersServiceTest.java
**To Reproduce**
mvn package
**Expected behavior**
remove unused import
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/2715 | https://github.com/apache/dolphinscheduler/pull/2718 | 11c4c583286d913c17eb8efff029d93d89f98b25 | 9fd728908fd41b8aecc9565687060f96f413936a | "2020-05-14T07:15:13Z" | java | "2020-06-14T02:27:13Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | loginUser.setUserType(UserType.ADMIN_USER);
result = usersService.grantResources(loginUser, 2, resourceIds);
logger.info(result.toString());
Assert.assertEquals(Status.USER_NOT_EXIST, result.get(Constants.STATUS));
when(resourceMapper.queryAuthorizedResourceList(1)).thenReturn(new ArrayList<Resource>());
when(resourceMapper.selectById(Mockito.anyInt())).thenReturn(getResource());
result = usersService.grantResources(loginUser, 1, resourceIds);
logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
}
@Test
public void testGrantUDFFunction(){
String udfIds = "100000,120000";
when(userMapper.selectById(1)).thenReturn(getUser());
User loginUser = new User();
Map<String, Object> result = usersService.grantUDFFunction(loginUser, 1, udfIds);
logger.info(result.toString());
Assert.assertEquals(Status.USER_NO_OPERATION_PERM, result.get(Constants.STATUS));
loginUser.setUserType(UserType.ADMIN_USER);
result = usersService.grantUDFFunction(loginUser, 2, udfIds);
logger.info(result.toString());
Assert.assertEquals(Status.USER_NOT_EXIST, result.get(Constants.STATUS));
result = usersService.grantUDFFunction(loginUser, 1, udfIds);
logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
}
@Test |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,715 | compile error on UsersServiceTest |
**Describe the bug**
compile error on UsersServiceTest.java
**To Reproduce**
mvn package
**Expected behavior**
remove unused import
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/2715 | https://github.com/apache/dolphinscheduler/pull/2718 | 11c4c583286d913c17eb8efff029d93d89f98b25 | 9fd728908fd41b8aecc9565687060f96f413936a | "2020-05-14T07:15:13Z" | java | "2020-06-14T02:27:13Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | public void testGrantDataSource(){
String datasourceIds = "100000,120000";
when(userMapper.selectById(1)).thenReturn(getUser());
User loginUser = new User();
Map<String, Object> result = usersService.grantDataSource(loginUser, 1, datasourceIds);
logger.info(result.toString());
Assert.assertEquals(Status.USER_NO_OPERATION_PERM, result.get(Constants.STATUS));
loginUser.setUserType(UserType.ADMIN_USER);
result = usersService.grantDataSource(loginUser, 2, datasourceIds);
logger.info(result.toString());
Assert.assertEquals(Status.USER_NOT_EXIST, result.get(Constants.STATUS));
result = usersService.grantDataSource(loginUser, 1, datasourceIds);
logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
}
@Test
public void getUserInfo(){
User loginUser = new User();
loginUser.setUserName("admin");
loginUser.setUserType(UserType.ADMIN_USER);
Map<String, Object> result = usersService.getUserInfo(loginUser);
logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
User tempUser = (User) result.get(Constants.DATA_LIST);
Assert.assertEquals("admin",tempUser.getUserName()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,715 | compile error on UsersServiceTest |
**Describe the bug**
compile error on UsersServiceTest.java
**To Reproduce**
mvn package
**Expected behavior**
remove unused import
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/2715 | https://github.com/apache/dolphinscheduler/pull/2718 | 11c4c583286d913c17eb8efff029d93d89f98b25 | 9fd728908fd41b8aecc9565687060f96f413936a | "2020-05-14T07:15:13Z" | java | "2020-06-14T02:27:13Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | loginUser.setUserType(null);
loginUser.setId(1);
when(userMapper.queryDetailsById(1)).thenReturn(getGeneralUser());
result = usersService.getUserInfo(loginUser);
logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
tempUser = (User) result.get(Constants.DATA_LIST);
Assert.assertEquals("userTest0001",tempUser.getUserName());
}
@Test
public void testQueryAllGeneralUsers(){
User loginUser = new User();
Map<String, Object> result = usersService.queryAllGeneralUsers(loginUser);
logger.info(result.toString());
Assert.assertEquals(Status.USER_NO_OPERATION_PERM, result.get(Constants.STATUS));
loginUser.setUserType(UserType.ADMIN_USER);
when(userMapper.queryAllGeneralUser()).thenReturn(getUserList());
result = usersService.queryAllGeneralUsers(loginUser);
logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
List<User> userList = (List<User>) result.get(Constants.DATA_LIST);
Assert.assertTrue(CollectionUtils.isNotEmpty(userList));
}
@Test
public void testVerifyUserName(){
Result result = usersService.verifyUserName("admin89899"); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,715 | compile error on UsersServiceTest |
**Describe the bug**
compile error on UsersServiceTest.java
**To Reproduce**
mvn package
**Expected behavior**
remove unused import
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/2715 | https://github.com/apache/dolphinscheduler/pull/2718 | 11c4c583286d913c17eb8efff029d93d89f98b25 | 9fd728908fd41b8aecc9565687060f96f413936a | "2020-05-14T07:15:13Z" | java | "2020-06-14T02:27:13Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS.getMsg(), result.getMsg());
when(userMapper.queryByUserNameAccurately("userTest0001")).thenReturn(getUser());
result = usersService.verifyUserName("userTest0001");
logger.info(result.toString());
Assert.assertEquals(Status.USER_NAME_EXIST.getMsg(), result.getMsg());
}
@Test
public void testUnauthorizedUser(){
User loginUser = new User();
when(userMapper.selectList(null )).thenReturn(getUserList());
when( userMapper.queryUserListByAlertGroupId(2)).thenReturn(getUserList());
Map<String, Object> result = usersService.unauthorizedUser(loginUser, 2);
logger.info(result.toString());
loginUser.setUserType(UserType.ADMIN_USER);
Assert.assertEquals(Status.USER_NO_OPERATION_PERM, result.get(Constants.STATUS));
result = usersService.unauthorizedUser(loginUser, 2);
logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
}
@Test
public void testAuthorizedUser(){
User loginUser = new User();
when(userMapper.queryUserListByAlertGroupId(2)).thenReturn(getUserList());
Map<String, Object> result = usersService.authorizedUser(loginUser, 2);
logger.info(result.toString()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,715 | compile error on UsersServiceTest |
**Describe the bug**
compile error on UsersServiceTest.java
**To Reproduce**
mvn package
**Expected behavior**
remove unused import
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/2715 | https://github.com/apache/dolphinscheduler/pull/2718 | 11c4c583286d913c17eb8efff029d93d89f98b25 | 9fd728908fd41b8aecc9565687060f96f413936a | "2020-05-14T07:15:13Z" | java | "2020-06-14T02:27:13Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | Assert.assertEquals(Status.USER_NO_OPERATION_PERM, result.get(Constants.STATUS));
loginUser.setUserType(UserType.ADMIN_USER);
result = usersService.authorizedUser(loginUser, 2);
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
List<User> userList = (List<User>) result.get(Constants.DATA_LIST);
logger.info(result.toString());
Assert.assertTrue(CollectionUtils.isNotEmpty(userList));
}
/**
* get user
* @return
*/
private User getGeneralUser(){
User user = new User();
user.setUserType(UserType.GENERAL_USER);
user.setUserName("userTest0001");
user.setUserPassword("userTest0001");
return user;
}
private List<User> getUserList(){
List<User> userList = new ArrayList<>();
userList.add(getGeneralUser());
return userList;
}
/**
* get user
*/
private User getUser(){
User user = new User(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,715 | compile error on UsersServiceTest |
**Describe the bug**
compile error on UsersServiceTest.java
**To Reproduce**
mvn package
**Expected behavior**
remove unused import
**Screenshots**

**Which version of Dolphin Scheduler:**
-[dev-1.3.0]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/2715 | https://github.com/apache/dolphinscheduler/pull/2718 | 11c4c583286d913c17eb8efff029d93d89f98b25 | 9fd728908fd41b8aecc9565687060f96f413936a | "2020-05-14T07:15:13Z" | java | "2020-06-14T02:27:13Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | user.setUserType(UserType.ADMIN_USER);
user.setUserName("userTest0001");
user.setUserPassword("userTest0001");
user.setState(1);
return user;
}
/**
* get tenant
* @return tenant
*/
private Tenant getTenant(){
Tenant tenant = new Tenant();
tenant.setId(1);
return tenant;
}
/**
* get resource
* @return resource
*/
private Resource getResource(){
Resource resource = new Resource();
resource.setPid(-1);
resource.setUserId(1);
resource.setDescription("ResourcesServiceTest.jar");
resource.setAlias("ResourcesServiceTest.jar");
resource.setFullName("/ResourcesServiceTest.jar");
resource.setType(ResourceType.FILE);
return resource;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,157 | [BUG] netty server may start multiple times if multiple threads execute the start method | *For better global communication, please give priority to using English description, thx! *
**Describe the bug**
look at the code of NettyRemotingServer
```java
public void start(){
if(this.isStarted.get()){
return;
}
this.serverBootstrap
.group(this.bossGroup, this.workGroup)
.channel(NioServerSocketChannel.class)
.option(ChannelOption.SO_REUSEADDR, true)
.option(ChannelOption.SO_BACKLOG, serverConfig.getSoBacklog())
.childOption(ChannelOption.SO_KEEPALIVE, serverConfig.isSoKeepalive())
.childOption(ChannelOption.TCP_NODELAY, serverConfig.isTcpNoDelay())
.childOption(ChannelOption.SO_SNDBUF, serverConfig.getSendBufferSize())
.childOption(ChannelOption.SO_RCVBUF, serverConfig.getReceiveBufferSize())
.childHandler(new ChannelInitializer<NioSocketChannel>() {
@Override
protected void initChannel(NioSocketChannel ch) throws Exception {
initNettyChannel(ch);
}
});
ChannelFuture future;
try {
future = serverBootstrap.bind(serverConfig.getListenPort()).sync();
} catch (Exception e) {
logger.error("NettyRemotingServer bind fail {}, exit",e.getMessage(), e);
throw new RuntimeException(String.format("NettyRemotingServer bind %s fail", serverConfig.getListenPort()));
}
if (future.isSuccess()) {
logger.info("NettyRemotingServer bind success at port : {}", serverConfig.getListenPort());
} else if (future.cause() != null) {
throw new RuntimeException(String.format("NettyRemotingServer bind %s fail", serverConfig.getListenPort()), future.cause());
} else {
throw new RuntimeException(String.format("NettyRemotingServer bind %s fail", serverConfig.getListenPort()));
}
//
isStarted.compareAndSet(false, true);
}
```
If multiple threads execute the method at a time, it may start the netty server multiple times.
**To Reproduce**
Steps to reproduce the behavior, for example:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Which version of Dolphin Scheduler:**
-[1.1.0-preview]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.
| https://github.com/apache/dolphinscheduler/issues/3157 | https://github.com/apache/dolphinscheduler/pull/3158 | d4d6aded1184b803557f444c42253d02887995b9 | bf3cc0d00ef27eb0523b4542e5905256e369b068 | "2020-07-06T12:12:29Z" | java | "2020-07-07T10:45:20Z" | dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/NettyRemotingServer.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. |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,157 | [BUG] netty server may start multiple times if multiple threads execute the start method | *For better global communication, please give priority to using English description, thx! *
**Describe the bug**
look at the code of NettyRemotingServer
```java
public void start(){
if(this.isStarted.get()){
return;
}
this.serverBootstrap
.group(this.bossGroup, this.workGroup)
.channel(NioServerSocketChannel.class)
.option(ChannelOption.SO_REUSEADDR, true)
.option(ChannelOption.SO_BACKLOG, serverConfig.getSoBacklog())
.childOption(ChannelOption.SO_KEEPALIVE, serverConfig.isSoKeepalive())
.childOption(ChannelOption.TCP_NODELAY, serverConfig.isTcpNoDelay())
.childOption(ChannelOption.SO_SNDBUF, serverConfig.getSendBufferSize())
.childOption(ChannelOption.SO_RCVBUF, serverConfig.getReceiveBufferSize())
.childHandler(new ChannelInitializer<NioSocketChannel>() {
@Override
protected void initChannel(NioSocketChannel ch) throws Exception {
initNettyChannel(ch);
}
});
ChannelFuture future;
try {
future = serverBootstrap.bind(serverConfig.getListenPort()).sync();
} catch (Exception e) {
logger.error("NettyRemotingServer bind fail {}, exit",e.getMessage(), e);
throw new RuntimeException(String.format("NettyRemotingServer bind %s fail", serverConfig.getListenPort()));
}
if (future.isSuccess()) {
logger.info("NettyRemotingServer bind success at port : {}", serverConfig.getListenPort());
} else if (future.cause() != null) {
throw new RuntimeException(String.format("NettyRemotingServer bind %s fail", serverConfig.getListenPort()), future.cause());
} else {
throw new RuntimeException(String.format("NettyRemotingServer bind %s fail", serverConfig.getListenPort()));
}
//
isStarted.compareAndSet(false, true);
}
```
If multiple threads execute the method at a time, it may start the netty server multiple times.
**To Reproduce**
Steps to reproduce the behavior, for example:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Which version of Dolphin Scheduler:**
-[1.1.0-preview]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.
| https://github.com/apache/dolphinscheduler/issues/3157 | https://github.com/apache/dolphinscheduler/pull/3158 | d4d6aded1184b803557f444c42253d02887995b9 | bf3cc0d00ef27eb0523b4542e5905256e369b068 | "2020-07-06T12:12:29Z" | java | "2020-07-07T10:45:20Z" | dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/NettyRemotingServer.java | * See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.remote;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import org.apache.dolphinscheduler.remote.codec.NettyDecoder;
import org.apache.dolphinscheduler.remote.codec.NettyEncoder;
import org.apache.dolphinscheduler.remote.command.CommandType;
import org.apache.dolphinscheduler.remote.config.NettyServerConfig;
import org.apache.dolphinscheduler.remote.handler.NettyServerHandler;
import org.apache.dolphinscheduler.remote.processor.NettyRequestProcessor;
import org.apache.dolphinscheduler.remote.utils.Constants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
/**
* remoting netty server
*/
public class NettyRemotingServer { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,157 | [BUG] netty server may start multiple times if multiple threads execute the start method | *For better global communication, please give priority to using English description, thx! *
**Describe the bug**
look at the code of NettyRemotingServer
```java
public void start(){
if(this.isStarted.get()){
return;
}
this.serverBootstrap
.group(this.bossGroup, this.workGroup)
.channel(NioServerSocketChannel.class)
.option(ChannelOption.SO_REUSEADDR, true)
.option(ChannelOption.SO_BACKLOG, serverConfig.getSoBacklog())
.childOption(ChannelOption.SO_KEEPALIVE, serverConfig.isSoKeepalive())
.childOption(ChannelOption.TCP_NODELAY, serverConfig.isTcpNoDelay())
.childOption(ChannelOption.SO_SNDBUF, serverConfig.getSendBufferSize())
.childOption(ChannelOption.SO_RCVBUF, serverConfig.getReceiveBufferSize())
.childHandler(new ChannelInitializer<NioSocketChannel>() {
@Override
protected void initChannel(NioSocketChannel ch) throws Exception {
initNettyChannel(ch);
}
});
ChannelFuture future;
try {
future = serverBootstrap.bind(serverConfig.getListenPort()).sync();
} catch (Exception e) {
logger.error("NettyRemotingServer bind fail {}, exit",e.getMessage(), e);
throw new RuntimeException(String.format("NettyRemotingServer bind %s fail", serverConfig.getListenPort()));
}
if (future.isSuccess()) {
logger.info("NettyRemotingServer bind success at port : {}", serverConfig.getListenPort());
} else if (future.cause() != null) {
throw new RuntimeException(String.format("NettyRemotingServer bind %s fail", serverConfig.getListenPort()), future.cause());
} else {
throw new RuntimeException(String.format("NettyRemotingServer bind %s fail", serverConfig.getListenPort()));
}
//
isStarted.compareAndSet(false, true);
}
```
If multiple threads execute the method at a time, it may start the netty server multiple times.
**To Reproduce**
Steps to reproduce the behavior, for example:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Which version of Dolphin Scheduler:**
-[1.1.0-preview]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.
| https://github.com/apache/dolphinscheduler/issues/3157 | https://github.com/apache/dolphinscheduler/pull/3158 | d4d6aded1184b803557f444c42253d02887995b9 | bf3cc0d00ef27eb0523b4542e5905256e369b068 | "2020-07-06T12:12:29Z" | java | "2020-07-07T10:45:20Z" | dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/NettyRemotingServer.java | private final Logger logger = LoggerFactory.getLogger(NettyRemotingServer.class);
/**
* server bootstrap
*/
private final ServerBootstrap serverBootstrap = new ServerBootstrap();
/**
* encoder
*/
private final NettyEncoder encoder = new NettyEncoder();
/**
* default executor
*/
private final ExecutorService defaultExecutor = Executors.newFixedThreadPool(Constants.CPUS);
/**
* boss group
*/
private final NioEventLoopGroup bossGroup;
/**
* worker group
*/
private final NioEventLoopGroup workGroup;
/**
* server config
*/
private final NettyServerConfig serverConfig;
/**
* server handler
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,157 | [BUG] netty server may start multiple times if multiple threads execute the start method | *For better global communication, please give priority to using English description, thx! *
**Describe the bug**
look at the code of NettyRemotingServer
```java
public void start(){
if(this.isStarted.get()){
return;
}
this.serverBootstrap
.group(this.bossGroup, this.workGroup)
.channel(NioServerSocketChannel.class)
.option(ChannelOption.SO_REUSEADDR, true)
.option(ChannelOption.SO_BACKLOG, serverConfig.getSoBacklog())
.childOption(ChannelOption.SO_KEEPALIVE, serverConfig.isSoKeepalive())
.childOption(ChannelOption.TCP_NODELAY, serverConfig.isTcpNoDelay())
.childOption(ChannelOption.SO_SNDBUF, serverConfig.getSendBufferSize())
.childOption(ChannelOption.SO_RCVBUF, serverConfig.getReceiveBufferSize())
.childHandler(new ChannelInitializer<NioSocketChannel>() {
@Override
protected void initChannel(NioSocketChannel ch) throws Exception {
initNettyChannel(ch);
}
});
ChannelFuture future;
try {
future = serverBootstrap.bind(serverConfig.getListenPort()).sync();
} catch (Exception e) {
logger.error("NettyRemotingServer bind fail {}, exit",e.getMessage(), e);
throw new RuntimeException(String.format("NettyRemotingServer bind %s fail", serverConfig.getListenPort()));
}
if (future.isSuccess()) {
logger.info("NettyRemotingServer bind success at port : {}", serverConfig.getListenPort());
} else if (future.cause() != null) {
throw new RuntimeException(String.format("NettyRemotingServer bind %s fail", serverConfig.getListenPort()), future.cause());
} else {
throw new RuntimeException(String.format("NettyRemotingServer bind %s fail", serverConfig.getListenPort()));
}
//
isStarted.compareAndSet(false, true);
}
```
If multiple threads execute the method at a time, it may start the netty server multiple times.
**To Reproduce**
Steps to reproduce the behavior, for example:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Which version of Dolphin Scheduler:**
-[1.1.0-preview]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.
| https://github.com/apache/dolphinscheduler/issues/3157 | https://github.com/apache/dolphinscheduler/pull/3158 | d4d6aded1184b803557f444c42253d02887995b9 | bf3cc0d00ef27eb0523b4542e5905256e369b068 | "2020-07-06T12:12:29Z" | java | "2020-07-07T10:45:20Z" | dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/NettyRemotingServer.java | private final NettyServerHandler serverHandler = new NettyServerHandler(this);
/**
* started flag
*/
private final AtomicBoolean isStarted = new AtomicBoolean(false);
/**
* server init
*
* @param serverConfig server config
*/
public NettyRemotingServer(final NettyServerConfig serverConfig){
this.serverConfig = serverConfig;
this.bossGroup = new NioEventLoopGroup(1, new ThreadFactory() {
private AtomicInteger threadIndex = new AtomicInteger(0);
@Override
public Thread newThread(Runnable r) {
return new Thread(r, String.format("NettyServerBossThread_%d", this.threadIndex.incrementAndGet()));
}
});
this.workGroup = new NioEventLoopGroup(serverConfig.getWorkerThread(), new ThreadFactory() {
private AtomicInteger threadIndex = new AtomicInteger(0);
@Override
public Thread newThread(Runnable r) {
return new Thread(r, String.format("NettyServerWorkerThread_%d", this.threadIndex.incrementAndGet()));
}
});
}
/**
* server start
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,157 | [BUG] netty server may start multiple times if multiple threads execute the start method | *For better global communication, please give priority to using English description, thx! *
**Describe the bug**
look at the code of NettyRemotingServer
```java
public void start(){
if(this.isStarted.get()){
return;
}
this.serverBootstrap
.group(this.bossGroup, this.workGroup)
.channel(NioServerSocketChannel.class)
.option(ChannelOption.SO_REUSEADDR, true)
.option(ChannelOption.SO_BACKLOG, serverConfig.getSoBacklog())
.childOption(ChannelOption.SO_KEEPALIVE, serverConfig.isSoKeepalive())
.childOption(ChannelOption.TCP_NODELAY, serverConfig.isTcpNoDelay())
.childOption(ChannelOption.SO_SNDBUF, serverConfig.getSendBufferSize())
.childOption(ChannelOption.SO_RCVBUF, serverConfig.getReceiveBufferSize())
.childHandler(new ChannelInitializer<NioSocketChannel>() {
@Override
protected void initChannel(NioSocketChannel ch) throws Exception {
initNettyChannel(ch);
}
});
ChannelFuture future;
try {
future = serverBootstrap.bind(serverConfig.getListenPort()).sync();
} catch (Exception e) {
logger.error("NettyRemotingServer bind fail {}, exit",e.getMessage(), e);
throw new RuntimeException(String.format("NettyRemotingServer bind %s fail", serverConfig.getListenPort()));
}
if (future.isSuccess()) {
logger.info("NettyRemotingServer bind success at port : {}", serverConfig.getListenPort());
} else if (future.cause() != null) {
throw new RuntimeException(String.format("NettyRemotingServer bind %s fail", serverConfig.getListenPort()), future.cause());
} else {
throw new RuntimeException(String.format("NettyRemotingServer bind %s fail", serverConfig.getListenPort()));
}
//
isStarted.compareAndSet(false, true);
}
```
If multiple threads execute the method at a time, it may start the netty server multiple times.
**To Reproduce**
Steps to reproduce the behavior, for example:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Which version of Dolphin Scheduler:**
-[1.1.0-preview]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.
| https://github.com/apache/dolphinscheduler/issues/3157 | https://github.com/apache/dolphinscheduler/pull/3158 | d4d6aded1184b803557f444c42253d02887995b9 | bf3cc0d00ef27eb0523b4542e5905256e369b068 | "2020-07-06T12:12:29Z" | java | "2020-07-07T10:45:20Z" | dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/NettyRemotingServer.java | public void start(){
if(this.isStarted.get()){
return;
}
this.serverBootstrap
.group(this.bossGroup, this.workGroup)
.channel(NioServerSocketChannel.class)
.option(ChannelOption.SO_REUSEADDR, true)
.option(ChannelOption.SO_BACKLOG, serverConfig.getSoBacklog())
.childOption(ChannelOption.SO_KEEPALIVE, serverConfig.isSoKeepalive())
.childOption(ChannelOption.TCP_NODELAY, serverConfig.isTcpNoDelay())
.childOption(ChannelOption.SO_SNDBUF, serverConfig.getSendBufferSize())
.childOption(ChannelOption.SO_RCVBUF, serverConfig.getReceiveBufferSize())
.childHandler(new ChannelInitializer<NioSocketChannel>() {
@Override
protected void initChannel(NioSocketChannel ch) throws Exception {
initNettyChannel(ch);
}
});
ChannelFuture future;
try {
future = serverBootstrap.bind(serverConfig.getListenPort()).sync();
} catch (Exception e) {
logger.error("NettyRemotingServer bind fail {}, exit",e.getMessage(), e);
throw new RuntimeException(String.format("NettyRemotingServer bind %s fail", serverConfig.getListenPort()));
}
if (future.isSuccess()) {
logger.info("NettyRemotingServer bind success at port : {}", serverConfig.getListenPort());
} else if (future.cause() != null) {
throw new RuntimeException(String.format("NettyRemotingServer bind %s fail", serverConfig.getListenPort()), future.cause()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,157 | [BUG] netty server may start multiple times if multiple threads execute the start method | *For better global communication, please give priority to using English description, thx! *
**Describe the bug**
look at the code of NettyRemotingServer
```java
public void start(){
if(this.isStarted.get()){
return;
}
this.serverBootstrap
.group(this.bossGroup, this.workGroup)
.channel(NioServerSocketChannel.class)
.option(ChannelOption.SO_REUSEADDR, true)
.option(ChannelOption.SO_BACKLOG, serverConfig.getSoBacklog())
.childOption(ChannelOption.SO_KEEPALIVE, serverConfig.isSoKeepalive())
.childOption(ChannelOption.TCP_NODELAY, serverConfig.isTcpNoDelay())
.childOption(ChannelOption.SO_SNDBUF, serverConfig.getSendBufferSize())
.childOption(ChannelOption.SO_RCVBUF, serverConfig.getReceiveBufferSize())
.childHandler(new ChannelInitializer<NioSocketChannel>() {
@Override
protected void initChannel(NioSocketChannel ch) throws Exception {
initNettyChannel(ch);
}
});
ChannelFuture future;
try {
future = serverBootstrap.bind(serverConfig.getListenPort()).sync();
} catch (Exception e) {
logger.error("NettyRemotingServer bind fail {}, exit",e.getMessage(), e);
throw new RuntimeException(String.format("NettyRemotingServer bind %s fail", serverConfig.getListenPort()));
}
if (future.isSuccess()) {
logger.info("NettyRemotingServer bind success at port : {}", serverConfig.getListenPort());
} else if (future.cause() != null) {
throw new RuntimeException(String.format("NettyRemotingServer bind %s fail", serverConfig.getListenPort()), future.cause());
} else {
throw new RuntimeException(String.format("NettyRemotingServer bind %s fail", serverConfig.getListenPort()));
}
//
isStarted.compareAndSet(false, true);
}
```
If multiple threads execute the method at a time, it may start the netty server multiple times.
**To Reproduce**
Steps to reproduce the behavior, for example:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Which version of Dolphin Scheduler:**
-[1.1.0-preview]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.
| https://github.com/apache/dolphinscheduler/issues/3157 | https://github.com/apache/dolphinscheduler/pull/3158 | d4d6aded1184b803557f444c42253d02887995b9 | bf3cc0d00ef27eb0523b4542e5905256e369b068 | "2020-07-06T12:12:29Z" | java | "2020-07-07T10:45:20Z" | dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/NettyRemotingServer.java | } else {
throw new RuntimeException(String.format("NettyRemotingServer bind %s fail", serverConfig.getListenPort()));
}
isStarted.compareAndSet(false, true);
}
/**
* init netty channel
* @param ch socket channel
* @throws Exception
*/
private void initNettyChannel(NioSocketChannel ch) throws Exception{
ChannelPipeline pipeline = ch.pipeline();
pipeline.addLast("encoder", encoder);
pipeline.addLast("decoder", new NettyDecoder());
pipeline.addLast("handler", serverHandler);
}
/**
* register processor
* @param commandType command type
* @param processor processor
*/
public void registerProcessor(final CommandType commandType, final NettyRequestProcessor processor) {
this.registerProcessor(commandType, processor, null);
}
/**
* register processor
*
* @param commandType command type
* @param processor processor |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,157 | [BUG] netty server may start multiple times if multiple threads execute the start method | *For better global communication, please give priority to using English description, thx! *
**Describe the bug**
look at the code of NettyRemotingServer
```java
public void start(){
if(this.isStarted.get()){
return;
}
this.serverBootstrap
.group(this.bossGroup, this.workGroup)
.channel(NioServerSocketChannel.class)
.option(ChannelOption.SO_REUSEADDR, true)
.option(ChannelOption.SO_BACKLOG, serverConfig.getSoBacklog())
.childOption(ChannelOption.SO_KEEPALIVE, serverConfig.isSoKeepalive())
.childOption(ChannelOption.TCP_NODELAY, serverConfig.isTcpNoDelay())
.childOption(ChannelOption.SO_SNDBUF, serverConfig.getSendBufferSize())
.childOption(ChannelOption.SO_RCVBUF, serverConfig.getReceiveBufferSize())
.childHandler(new ChannelInitializer<NioSocketChannel>() {
@Override
protected void initChannel(NioSocketChannel ch) throws Exception {
initNettyChannel(ch);
}
});
ChannelFuture future;
try {
future = serverBootstrap.bind(serverConfig.getListenPort()).sync();
} catch (Exception e) {
logger.error("NettyRemotingServer bind fail {}, exit",e.getMessage(), e);
throw new RuntimeException(String.format("NettyRemotingServer bind %s fail", serverConfig.getListenPort()));
}
if (future.isSuccess()) {
logger.info("NettyRemotingServer bind success at port : {}", serverConfig.getListenPort());
} else if (future.cause() != null) {
throw new RuntimeException(String.format("NettyRemotingServer bind %s fail", serverConfig.getListenPort()), future.cause());
} else {
throw new RuntimeException(String.format("NettyRemotingServer bind %s fail", serverConfig.getListenPort()));
}
//
isStarted.compareAndSet(false, true);
}
```
If multiple threads execute the method at a time, it may start the netty server multiple times.
**To Reproduce**
Steps to reproduce the behavior, for example:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Which version of Dolphin Scheduler:**
-[1.1.0-preview]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.
| https://github.com/apache/dolphinscheduler/issues/3157 | https://github.com/apache/dolphinscheduler/pull/3158 | d4d6aded1184b803557f444c42253d02887995b9 | bf3cc0d00ef27eb0523b4542e5905256e369b068 | "2020-07-06T12:12:29Z" | java | "2020-07-07T10:45:20Z" | dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/NettyRemotingServer.java | * @param executor thread executor
*/
public void registerProcessor(final CommandType commandType, final NettyRequestProcessor processor, final ExecutorService executor) {
this.serverHandler.registerProcessor(commandType, processor, executor);
}
/**
* get default thread executor
* @return thread executor
*/
public ExecutorService getDefaultExecutor() {
return defaultExecutor;
}
public void close() {
if(isStarted.compareAndSet(true, false)){
try {
if(bossGroup != null){
this.bossGroup.shutdownGracefully();
}
if(workGroup != null){
this.workGroup.shutdownGracefully();
}
defaultExecutor.shutdown();
} catch (Exception ex) {
logger.error("netty server close exception", ex);
}
logger.info("netty server closed");
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,165 | config resource.storage.type=hdfs throw exception need config resource.storage.type=HDFS | when i config common.properties ,
resource.storage.type=hdfs
will throw exception

because Enumerated type comparisons do not ignore case。 | https://github.com/apache/dolphinscheduler/issues/3165 | https://github.com/apache/dolphinscheduler/pull/3166 | ae902e2308b60f57010918bbce67703def10a02f | a23a3e2d1254acf1d6c194f4996824e3f290cae1 | "2020-07-08T03:37:44Z" | java | "2020-07-09T10:28:04Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/PropertyUtils.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
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,165 | config resource.storage.type=hdfs throw exception need config resource.storage.type=HDFS | when i config common.properties ,
resource.storage.type=hdfs
will throw exception

because Enumerated type comparisons do not ignore case。 | https://github.com/apache/dolphinscheduler/issues/3165 | https://github.com/apache/dolphinscheduler/pull/3166 | ae902e2308b60f57010918bbce67703def10a02f | a23a3e2d1254acf1d6c194f4996824e3f290cae1 | "2020-07-08T03:37:44Z" | java | "2020-07-09T10:28:04Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/PropertyUtils.java | * 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.utils;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.ResUploadType;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import static org.apache.dolphinscheduler.common.Constants.COMMON_PROPERTIES_PATH;
/**
* property utils
* single instance
*/
public class PropertyUtils {
/**
* logger
*/
private static final Logger logger = LoggerFactory.getLogger(PropertyUtils.class);
private static final Properties properties = new Properties(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,165 | config resource.storage.type=hdfs throw exception need config resource.storage.type=HDFS | when i config common.properties ,
resource.storage.type=hdfs
will throw exception

because Enumerated type comparisons do not ignore case。 | https://github.com/apache/dolphinscheduler/issues/3165 | https://github.com/apache/dolphinscheduler/pull/3166 | ae902e2308b60f57010918bbce67703def10a02f | a23a3e2d1254acf1d6c194f4996824e3f290cae1 | "2020-07-08T03:37:44Z" | java | "2020-07-09T10:28:04Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/PropertyUtils.java | private PropertyUtils() {
throw new IllegalStateException("PropertyUtils class");
}
static {
String[] propertyFiles = new String[]{COMMON_PROPERTIES_PATH};
for (String fileName : propertyFiles) {
InputStream fis = null;
try {
fis = PropertyUtils.class.getResourceAsStream(fileName);
properties.load(fis);
} catch (IOException e) {
logger.error(e.getMessage(), e);
if (fis != null) {
IOUtils.closeQuietly(fis);
}
System.exit(1);
} finally {
IOUtils.closeQuietly(fis);
}
}
}
/**
*
* @return judge whether resource upload startup
*/
public static Boolean getResUploadStartupState(){
String resUploadStartupType = PropertyUtils.getString(Constants.RESOURCE_STORAGE_TYPE);
ResUploadType resUploadType = ResUploadType.valueOf(resUploadStartupType);
return resUploadType == ResUploadType.HDFS || resUploadType == ResUploadType.S3;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,165 | config resource.storage.type=hdfs throw exception need config resource.storage.type=HDFS | when i config common.properties ,
resource.storage.type=hdfs
will throw exception

because Enumerated type comparisons do not ignore case。 | https://github.com/apache/dolphinscheduler/issues/3165 | https://github.com/apache/dolphinscheduler/pull/3166 | ae902e2308b60f57010918bbce67703def10a02f | a23a3e2d1254acf1d6c194f4996824e3f290cae1 | "2020-07-08T03:37:44Z" | java | "2020-07-09T10:28:04Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/PropertyUtils.java | /**
* get property value
*
* @param key property name
* @return property value
*/
public static String getString(String key) {
return properties.getProperty(key.trim());
}
/**
* get property value
*
* @param key property name
* @param defaultVal default value
* @return property value
*/
public static String getString(String key, String defaultVal) {
String val = properties.getProperty(key.trim());
return val == null ? defaultVal : val;
}
/**
* get property value
*
* @param key property name
* @return get property int value , if key == null, then return -1
*/
public static int getInt(String key) {
return getInt(key, -1);
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,165 | config resource.storage.type=hdfs throw exception need config resource.storage.type=HDFS | when i config common.properties ,
resource.storage.type=hdfs
will throw exception

because Enumerated type comparisons do not ignore case。 | https://github.com/apache/dolphinscheduler/issues/3165 | https://github.com/apache/dolphinscheduler/pull/3166 | ae902e2308b60f57010918bbce67703def10a02f | a23a3e2d1254acf1d6c194f4996824e3f290cae1 | "2020-07-08T03:37:44Z" | java | "2020-07-09T10:28:04Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/PropertyUtils.java | *
* @param key key
* @param defaultValue default value
* @return property value
*/
public static int getInt(String key, int defaultValue) {
String value = getString(key);
if (value == null) {
return defaultValue;
}
try {
return Integer.parseInt(value);
} catch (NumberFormatException e) {
logger.info(e.getMessage(),e);
}
return defaultValue;
}
/**
* get property value
*
* @param key property name
* @return property value
*/
public static boolean getBoolean(String key) {
String value = properties.getProperty(key.trim());
if(null != value){
return Boolean.parseBoolean(value);
}
return false;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,165 | config resource.storage.type=hdfs throw exception need config resource.storage.type=HDFS | when i config common.properties ,
resource.storage.type=hdfs
will throw exception

because Enumerated type comparisons do not ignore case。 | https://github.com/apache/dolphinscheduler/issues/3165 | https://github.com/apache/dolphinscheduler/pull/3166 | ae902e2308b60f57010918bbce67703def10a02f | a23a3e2d1254acf1d6c194f4996824e3f290cae1 | "2020-07-08T03:37:44Z" | java | "2020-07-09T10:28:04Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/PropertyUtils.java | /**
* get property value
*
* @param key property name
* @param defaultValue default value
* @return property value
*/
public static Boolean getBoolean(String key, boolean defaultValue) {
String value = properties.getProperty(key.trim());
if(null != value){
return Boolean.parseBoolean(value);
}
return defaultValue;
}
/**
* get property long value
* @param key key
* @param defaultVal default value
* @return property value
*/
public static long getLong(String key, long defaultVal) {
String val = getString(key);
return val == null ? defaultVal : Long.parseLong(val);
}
/**
*
* @param key key
* @return property value
*/
public static long getLong(String key) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,165 | config resource.storage.type=hdfs throw exception need config resource.storage.type=HDFS | when i config common.properties ,
resource.storage.type=hdfs
will throw exception

because Enumerated type comparisons do not ignore case。 | https://github.com/apache/dolphinscheduler/issues/3165 | https://github.com/apache/dolphinscheduler/pull/3166 | ae902e2308b60f57010918bbce67703def10a02f | a23a3e2d1254acf1d6c194f4996824e3f290cae1 | "2020-07-08T03:37:44Z" | java | "2020-07-09T10:28:04Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/PropertyUtils.java | return getLong(key,-1);
}
/**
*
* @param key key
* @param defaultVal default value
* @return property value
*/
public double getDouble(String key, double defaultVal) {
String val = getString(key);
return val == null ? defaultVal : Double.parseDouble(val);
}
/**
* get array
* @param key property name
* @param splitStr separator
* @return property value through array
*/
public static String[] getArray(String key, String splitStr) {
String value = getString(key);
if (value == null) {
return new String[0];
}
try {
String[] propertyArray = value.split(splitStr);
return propertyArray;
} catch (NumberFormatException e) {
logger.info(e.getMessage(),e);
}
return new String[0]; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,165 | config resource.storage.type=hdfs throw exception need config resource.storage.type=HDFS | when i config common.properties ,
resource.storage.type=hdfs
will throw exception

because Enumerated type comparisons do not ignore case。 | https://github.com/apache/dolphinscheduler/issues/3165 | https://github.com/apache/dolphinscheduler/pull/3166 | ae902e2308b60f57010918bbce67703def10a02f | a23a3e2d1254acf1d6c194f4996824e3f290cae1 | "2020-07-08T03:37:44Z" | java | "2020-07-09T10:28:04Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/PropertyUtils.java | }
/**
*
* @param key key
* @param type type
* @param defaultValue default value
* @param <T> T
* @return get enum value
*/
public <T extends Enum<T>> T getEnum(String key, Class<T> type,
T defaultValue) {
String val = getString(key);
return val == null ? defaultValue : Enum.valueOf(type, val);
}
/**
* get all properties with specified prefix, like: fs.
* @param prefix prefix to search
* @return all properties with specified prefix
*/
public static Map<String, String> getPrefixedProperties(String prefix) {
Map<String, String> matchedProperties = new HashMap<>();
for (String propName : properties.stringPropertyNames()) {
if (propName.startsWith(prefix)) {
matchedProperties.put(propName, properties.getProperty(propName));
}
}
return matchedProperties;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,176 | [BUG] optimize #3165 Gets the value of this property “resource.storage.type”, Comparison with enumerated types | By looking at the ResourcesService code, I found a potential problem.
Enumeration type comparisons are used in both classes :HadoopUtils.java ,CommonUtils.java
I don't think this [submission](https://github.com/apache/incubator-dolphinscheduler/pull/3166) is perfect
All comparisons of ResUploadType need to be optimized.
I'm going to modify this part
中文:
通过阅读ResourcesService代码,发现了潜在隐患。
在HadoopUtils和CommonUtils,资源中心类型,都是通过枚举类型比较。
所以感觉到[submission](https://github.com/apache/incubator-dolphinscheduler/pull/3166) 这个提交是不完备的。
需要优化所有的ResUploadType类型比较部分的代码。
| https://github.com/apache/dolphinscheduler/issues/3176 | https://github.com/apache/dolphinscheduler/pull/3178 | 1eb8fb6db33af4b644492a9fb0b0348d7de14407 | 1e7582e910c23a42bb4e92cd64fde4df7cbf6b34 | "2020-07-10T06:05:07Z" | java | "2020-07-10T07:21:42Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/CommonUtils.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.utils;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.ResUploadType;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.security.UserGroupInformation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.net.URL;
/**
* common utils
*/
public class CommonUtils { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,176 | [BUG] optimize #3165 Gets the value of this property “resource.storage.type”, Comparison with enumerated types | By looking at the ResourcesService code, I found a potential problem.
Enumeration type comparisons are used in both classes :HadoopUtils.java ,CommonUtils.java
I don't think this [submission](https://github.com/apache/incubator-dolphinscheduler/pull/3166) is perfect
All comparisons of ResUploadType need to be optimized.
I'm going to modify this part
中文:
通过阅读ResourcesService代码,发现了潜在隐患。
在HadoopUtils和CommonUtils,资源中心类型,都是通过枚举类型比较。
所以感觉到[submission](https://github.com/apache/incubator-dolphinscheduler/pull/3166) 这个提交是不完备的。
需要优化所有的ResUploadType类型比较部分的代码。
| https://github.com/apache/dolphinscheduler/issues/3176 | https://github.com/apache/dolphinscheduler/pull/3178 | 1eb8fb6db33af4b644492a9fb0b0348d7de14407 | 1e7582e910c23a42bb4e92cd64fde4df7cbf6b34 | "2020-07-10T06:05:07Z" | java | "2020-07-10T07:21:42Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/CommonUtils.java | private static final Logger logger = LoggerFactory.getLogger(CommonUtils.class);
private CommonUtils() {
throw new IllegalStateException("CommonUtils class");
}
/**
* @return get the path of system environment variables
*/
public static String getSystemEnvPath() {
String envPath = PropertyUtils.getString(Constants.DOLPHINSCHEDULER_ENV_PATH);
if (StringUtils.isEmpty(envPath)) {
URL envDefaultPath = CommonUtils.class.getClassLoader().getResource(Constants.ENV_PATH);
if (envDefaultPath != null){
envPath = envDefaultPath.getPath();
logger.debug("env path :{}", envPath);
}else{
envPath = "/etc/profile";
}
}
return envPath;
}
/**
*
* @return is develop mode |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,176 | [BUG] optimize #3165 Gets the value of this property “resource.storage.type”, Comparison with enumerated types | By looking at the ResourcesService code, I found a potential problem.
Enumeration type comparisons are used in both classes :HadoopUtils.java ,CommonUtils.java
I don't think this [submission](https://github.com/apache/incubator-dolphinscheduler/pull/3166) is perfect
All comparisons of ResUploadType need to be optimized.
I'm going to modify this part
中文:
通过阅读ResourcesService代码,发现了潜在隐患。
在HadoopUtils和CommonUtils,资源中心类型,都是通过枚举类型比较。
所以感觉到[submission](https://github.com/apache/incubator-dolphinscheduler/pull/3166) 这个提交是不完备的。
需要优化所有的ResUploadType类型比较部分的代码。
| https://github.com/apache/dolphinscheduler/issues/3176 | https://github.com/apache/dolphinscheduler/pull/3178 | 1eb8fb6db33af4b644492a9fb0b0348d7de14407 | 1e7582e910c23a42bb4e92cd64fde4df7cbf6b34 | "2020-07-10T06:05:07Z" | java | "2020-07-10T07:21:42Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/CommonUtils.java | */
public static boolean isDevelopMode() {
return PropertyUtils.getBoolean(Constants.DEVELOPMENT_STATE, true);
}
/**
* if upload resource is HDFS and kerberos startup is true , else false
* @return true if upload resource is HDFS and kerberos startup
*/
public static boolean getKerberosStartupState(){
String resUploadStartupType = PropertyUtils.getString(Constants.RESOURCE_STORAGE_TYPE);
ResUploadType resUploadType = ResUploadType.valueOf(resUploadStartupType);
Boolean kerberosStartupState = PropertyUtils.getBoolean(Constants.HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE,false);
return resUploadType == ResUploadType.HDFS && kerberosStartupState;
}
/**
* load kerberos configuration
* @throws Exception errors
*/
public static void loadKerberosConf()throws Exception{
if (CommonUtils.getKerberosStartupState()) {
System.setProperty(Constants.JAVA_SECURITY_KRB5_CONF, PropertyUtils.getString(Constants.JAVA_SECURITY_KRB5_CONF_PATH));
Configuration configuration = new Configuration();
configuration.set(Constants.HADOOP_SECURITY_AUTHENTICATION, Constants.KERBEROS);
UserGroupInformation.setConfiguration(configuration);
UserGroupInformation.loginUserFromKeytab(PropertyUtils.getString(Constants.LOGIN_USER_KEY_TAB_USERNAME),
PropertyUtils.getString(Constants.LOGIN_USER_KEY_TAB_PATH));
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,176 | [BUG] optimize #3165 Gets the value of this property “resource.storage.type”, Comparison with enumerated types | By looking at the ResourcesService code, I found a potential problem.
Enumeration type comparisons are used in both classes :HadoopUtils.java ,CommonUtils.java
I don't think this [submission](https://github.com/apache/incubator-dolphinscheduler/pull/3166) is perfect
All comparisons of ResUploadType need to be optimized.
I'm going to modify this part
中文:
通过阅读ResourcesService代码,发现了潜在隐患。
在HadoopUtils和CommonUtils,资源中心类型,都是通过枚举类型比较。
所以感觉到[submission](https://github.com/apache/incubator-dolphinscheduler/pull/3166) 这个提交是不完备的。
需要优化所有的ResUploadType类型比较部分的代码。
| https://github.com/apache/dolphinscheduler/issues/3176 | https://github.com/apache/dolphinscheduler/pull/3178 | 1eb8fb6db33af4b644492a9fb0b0348d7de14407 | 1e7582e910c23a42bb4e92cd64fde4df7cbf6b34 | "2020-07-10T06:05:07Z" | java | "2020-07-10T07:21:42Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.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.utils;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import org.apache.commons.io.IOUtils;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.ExecutionStatus;
import org.apache.dolphinscheduler.common.enums.ResUploadType;
import org.apache.dolphinscheduler.common.enums.ResourceType;
import org.apache.hadoop.conf.Configuration; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,176 | [BUG] optimize #3165 Gets the value of this property “resource.storage.type”, Comparison with enumerated types | By looking at the ResourcesService code, I found a potential problem.
Enumeration type comparisons are used in both classes :HadoopUtils.java ,CommonUtils.java
I don't think this [submission](https://github.com/apache/incubator-dolphinscheduler/pull/3166) is perfect
All comparisons of ResUploadType need to be optimized.
I'm going to modify this part
中文:
通过阅读ResourcesService代码,发现了潜在隐患。
在HadoopUtils和CommonUtils,资源中心类型,都是通过枚举类型比较。
所以感觉到[submission](https://github.com/apache/incubator-dolphinscheduler/pull/3166) 这个提交是不完备的。
需要优化所有的ResUploadType类型比较部分的代码。
| https://github.com/apache/dolphinscheduler/issues/3176 | https://github.com/apache/dolphinscheduler/pull/3178 | 1eb8fb6db33af4b644492a9fb0b0348d7de14407 | 1e7582e910c23a42bb4e92cd64fde4df7cbf6b34 | "2020-07-10T06:05:07Z" | java | "2020-07-10T07:21:42Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java | import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.*;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.yarn.client.cli.RMAdminCLI;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
import java.nio.file.Files;
import java.security.PrivilegedExceptionAction;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static org.apache.dolphinscheduler.common.Constants.RESOURCE_UPLOAD_PATH;
/**
* hadoop utils
* single instance
*/
public class HadoopUtils implements Closeable {
private static final Logger logger = LoggerFactory.getLogger(HadoopUtils.class);
private static String hdfsUser = PropertyUtils.getString(Constants.HDFS_ROOT_USER);
public static final String resourceUploadPath = PropertyUtils.getString(RESOURCE_UPLOAD_PATH, "/dolphinscheduler");
public static final String rmHaIds = PropertyUtils.getString(Constants.YARN_RESOURCEMANAGER_HA_RM_IDS);
public static final String appAddress = PropertyUtils.getString(Constants.YARN_APPLICATION_STATUS_ADDRESS);
public static final String jobHistoryAddress = PropertyUtils.getString(Constants.YARN_JOB_HISTORY_STATUS_ADDRESS);
private static final String HADOOP_UTILS_KEY = "HADOOP_UTILS_KEY";
private static final LoadingCache<String, HadoopUtils> cache = CacheBuilder
.newBuilder() |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,176 | [BUG] optimize #3165 Gets the value of this property “resource.storage.type”, Comparison with enumerated types | By looking at the ResourcesService code, I found a potential problem.
Enumeration type comparisons are used in both classes :HadoopUtils.java ,CommonUtils.java
I don't think this [submission](https://github.com/apache/incubator-dolphinscheduler/pull/3166) is perfect
All comparisons of ResUploadType need to be optimized.
I'm going to modify this part
中文:
通过阅读ResourcesService代码,发现了潜在隐患。
在HadoopUtils和CommonUtils,资源中心类型,都是通过枚举类型比较。
所以感觉到[submission](https://github.com/apache/incubator-dolphinscheduler/pull/3166) 这个提交是不完备的。
需要优化所有的ResUploadType类型比较部分的代码。
| https://github.com/apache/dolphinscheduler/issues/3176 | https://github.com/apache/dolphinscheduler/pull/3178 | 1eb8fb6db33af4b644492a9fb0b0348d7de14407 | 1e7582e910c23a42bb4e92cd64fde4df7cbf6b34 | "2020-07-10T06:05:07Z" | java | "2020-07-10T07:21:42Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java | .expireAfterWrite(PropertyUtils.getInt(Constants.KERBEROS_EXPIRE_TIME, 2), TimeUnit.HOURS)
.build(new CacheLoader<String, HadoopUtils>() {
@Override
public HadoopUtils load(String key) throws Exception {
return new HadoopUtils();
}
});
private static volatile boolean yarnEnabled = false;
private Configuration configuration;
private FileSystem fs;
private HadoopUtils() {
init();
initHdfsPath();
}
public static HadoopUtils getInstance() {
return cache.getUnchecked(HADOOP_UTILS_KEY);
}
/**
* init dolphinscheduler root path in hdfs
*/
private void initHdfsPath() {
Path path = new Path(resourceUploadPath);
try {
if (!fs.exists(path)) {
fs.mkdirs(path);
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,176 | [BUG] optimize #3165 Gets the value of this property “resource.storage.type”, Comparison with enumerated types | By looking at the ResourcesService code, I found a potential problem.
Enumeration type comparisons are used in both classes :HadoopUtils.java ,CommonUtils.java
I don't think this [submission](https://github.com/apache/incubator-dolphinscheduler/pull/3166) is perfect
All comparisons of ResUploadType need to be optimized.
I'm going to modify this part
中文:
通过阅读ResourcesService代码,发现了潜在隐患。
在HadoopUtils和CommonUtils,资源中心类型,都是通过枚举类型比较。
所以感觉到[submission](https://github.com/apache/incubator-dolphinscheduler/pull/3166) 这个提交是不完备的。
需要优化所有的ResUploadType类型比较部分的代码。
| https://github.com/apache/dolphinscheduler/issues/3176 | https://github.com/apache/dolphinscheduler/pull/3178 | 1eb8fb6db33af4b644492a9fb0b0348d7de14407 | 1e7582e910c23a42bb4e92cd64fde4df7cbf6b34 | "2020-07-10T06:05:07Z" | java | "2020-07-10T07:21:42Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java | /**
* init hadoop configuration
*/
private void init() {
try {
configuration = new Configuration();
String resourceStorageType = PropertyUtils.getString(Constants.RESOURCE_STORAGE_TYPE);
ResUploadType resUploadType = ResUploadType.valueOf(resourceStorageType);
if (resUploadType == ResUploadType.HDFS) {
if (PropertyUtils.getBoolean(Constants.HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE, false)) {
System.setProperty(Constants.JAVA_SECURITY_KRB5_CONF,
PropertyUtils.getString(Constants.JAVA_SECURITY_KRB5_CONF_PATH));
configuration.set(Constants.HADOOP_SECURITY_AUTHENTICATION, "kerberos");
hdfsUser = "";
UserGroupInformation.setConfiguration(configuration);
UserGroupInformation.loginUserFromKeytab(PropertyUtils.getString(Constants.LOGIN_USER_KEY_TAB_USERNAME),
PropertyUtils.getString(Constants.LOGIN_USER_KEY_TAB_PATH));
}
String defaultFS = configuration.get(Constants.FS_DEFAULTFS);
if (defaultFS.startsWith("file")) {
String defaultFSProp = PropertyUtils.getString(Constants.FS_DEFAULTFS);
if (StringUtils.isNotBlank(defaultFSProp)) {
Map<String, String> fsRelatedProps = PropertyUtils.getPrefixedProperties("fs.");
configuration.set(Constants.FS_DEFAULTFS, defaultFSProp);
fsRelatedProps.forEach((key, value) -> configuration.set(key, value));
} else {
logger.error("property:{} can not to be empty, please set!", Constants.FS_DEFAULTFS);
throw new RuntimeException( |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.