提交 21bf3b83 编写于 作者: Q qiaozhanwei 提交者: lgcareer

catch exception transaction method does not take effect to modify (#1258)

* ConnectionFactory add paging intercepter

* remove spotbugs-annotations.jar LGPL protocol

* test

* catch exception transaction method does not take effect to modify

* .evn rollback

* DataSourceService rollback

* LogViewServiceGrpc rollback
上级 c8b0c1f1
......@@ -580,8 +580,8 @@ public class DataSourceService extends BaseService{
datasourceUserMapper.deleteByDatasourceId(datasourceId);
putMsg(result, Status.SUCCESS);
} catch (Exception e) {
logger.error("delete datasource fail",e);
throw new RuntimeException("delete datasource fail");
logger.error("delete datasource error",e);
throw new RuntimeException("delete datasource error");
}
return result;
}
......
......@@ -536,12 +536,9 @@ public class ProcessInstanceService extends BaseDAGService {
nodeValueSb.append(ipSb);
}
try {
logger.info("delete task queue node : {}",nodeValueSb.toString());
tasksQueue.removeNode(org.apache.dolphinscheduler.common.Constants.DOLPHINSCHEDULER_TASKS_QUEUE, nodeValueSb.toString());
}catch (Exception e){
logger.error("delete task queue node : {}", nodeValueSb.toString());
}
logger.info("delete task queue node : {}",nodeValueSb.toString());
tasksQueue.removeNode(org.apache.dolphinscheduler.common.Constants.DOLPHINSCHEDULER_TASKS_QUEUE, nodeValueSb.toString());
}
}
......
......@@ -153,8 +153,7 @@ public class ResourcesService extends BaseService {
result.setData(resultMap);
} catch (Exception e) {
logger.error("resource already exists, can't recreate ", e);
putMsg(result, Status.CREATE_RESOURCE_ERROR);
return result;
throw new RuntimeException("resource already exists, can't recreate");
}
// fail upload
......@@ -248,8 +247,7 @@ public class ResourcesService extends BaseService {
result.setData(resultMap);
} catch (Exception e) {
logger.error(Status.UPDATE_RESOURCE_ERROR.getMsg(), e);
putMsg(result, Status.UPDATE_RESOURCE_ERROR);
return result;
throw new RuntimeException(Status.UPDATE_RESOURCE_ERROR.getMsg());
}
// if name unchanged, return directly without moving on HDFS
if (originResourceName.equals(name)) {
......
......@@ -97,9 +97,16 @@ public class SchedulerService extends BaseService {
* @throws IOException ioexception
*/
@Transactional(rollbackFor = Exception.class)
public Map<String, Object> insertSchedule(User loginUser, String projectName, Integer processDefineId, String schedule, WarningType warningType,
int warningGroupId, FailureStrategy failureStrategy,
String receivers, String receiversCc, Priority processInstancePriority, int workerGroupId) throws IOException {
public Map<String, Object> insertSchedule(User loginUser, String projectName,
Integer processDefineId,
String schedule,
WarningType warningType,
int warningGroupId,
FailureStrategy failureStrategy,
String receivers,
String receiversCc,
Priority processInstancePriority,
int workerGroupId) throws IOException {
Map<String, Object> result = new HashMap<String, Object>(5);
......@@ -183,10 +190,18 @@ public class SchedulerService extends BaseService {
* @throws IOException ioexception
*/
@Transactional(rollbackFor = Exception.class)
public Map<String, Object> updateSchedule(User loginUser, String projectName, Integer id, String scheduleExpression, WarningType warningType,
int warningGroupId, FailureStrategy failureStrategy,
String receivers, String receiversCc, ReleaseState scheduleStatus,
Priority processInstancePriority, int workerGroupId) throws IOException {
public Map<String, Object> updateSchedule(User loginUser,
String projectName,
Integer id,
String scheduleExpression,
WarningType warningType,
int warningGroupId,
FailureStrategy failureStrategy,
String receivers,
String receiversCc,
ReleaseState scheduleStatus,
Priority processInstancePriority,
int workerGroupId) throws IOException {
Map<String, Object> result = new HashMap<String, Object>(5);
Project project = projectMapper.queryByName(projectName);
......@@ -277,7 +292,10 @@ public class SchedulerService extends BaseService {
* @return publish result code
*/
@Transactional(rollbackFor = Exception.class)
public Map<String, Object> setScheduleState(User loginUser, String projectName, Integer id, ReleaseState scheduleStatus) {
public Map<String, Object> setScheduleState(User loginUser,
String projectName,
Integer id,
ReleaseState scheduleStatus) {
Map<String, Object> result = new HashMap<String, Object>(5);
......
......@@ -298,7 +298,7 @@ public class UdfFuncService extends BaseService{
* @param id udf function id
* @return delete result code
*/
@Transactional(value = "transactionManager",rollbackFor = Exception.class)
@Transactional(rollbackFor = Exception.class)
public Result delete(int id) {
Result result = new Result();
......
......@@ -20,6 +20,8 @@ import com.alibaba.druid.pool.DruidDataSource;
import com.baomidou.mybatisplus.core.MybatisConfiguration;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.ibatis.mapping.Environment;
import org.apache.ibatis.session.SqlSession;
......@@ -30,6 +32,7 @@ import org.mybatis.spring.SqlSessionTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;
import javax.sql.DataSource;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册