From b7fbf6c4adc732a621c52abdceffc82fc9fd1672 Mon Sep 17 00:00:00 2001 From: WangJPLeo <103574007+WangJPLeo@users.noreply.github.com> Date: Wed, 6 Jul 2022 14:22:46 +0800 Subject: [PATCH] [API] Do not specify rollback for ensure in case of any exception or error. (#10793) --- .../service/impl/AccessTokenServiceImpl.java | 2 ++ .../service/impl/AlertGroupServiceImpl.java | 6 ++--- .../api/service/impl/ClusterServiceImpl.java | 6 ++--- .../service/impl/DataSourceServiceImpl.java | 6 ++--- .../service/impl/EnvironmentServiceImpl.java | 6 ++--- .../impl/ProcessDefinitionServiceImpl.java | 24 +++++++++---------- .../impl/ProcessInstanceServiceImpl.java | 4 ++-- .../impl/ProcessTaskRelationServiceImpl.java | 10 ++++---- .../api/service/impl/ProjectServiceImpl.java | 2 +- .../api/service/impl/QueueServiceImpl.java | 2 +- .../service/impl/ResourcesServiceImpl.java | 12 +++++----- .../service/impl/SchedulerServiceImpl.java | 6 ++--- .../api/service/impl/SessionServiceImpl.java | 2 +- .../impl/TaskDefinitionServiceImpl.java | 12 +++++----- .../service/impl/TaskGroupServiceImpl.java | 2 +- .../api/service/impl/TenantServiceImpl.java | 4 ++-- .../api/service/impl/UdfFuncServiceImpl.java | 4 ++-- .../api/service/impl/UsersServiceImpl.java | 20 ++++++++-------- .../service/impl/WorkerGroupServiceImpl.java | 4 ++-- .../service/process/ProcessService.java | 4 ++-- .../service/process/ProcessServiceImpl.java | 4 ++-- 21 files changed, 70 insertions(+), 72 deletions(-) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AccessTokenServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AccessTokenServiceImpl.java index 1d0322677f..c8297d342b 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AccessTokenServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AccessTokenServiceImpl.java @@ -109,6 +109,7 @@ public class AccessTokenServiceImpl extends BaseServiceImpl implements AccessTok /** * create token * + * @param loginUser * @param userId token for user * @param expireTime token expire time * @param token token string (if it is absent, it will be automatically generated) @@ -161,6 +162,7 @@ public class AccessTokenServiceImpl extends BaseServiceImpl implements AccessTok /** * generate token * + * @param loginUser * @param userId token for user * @param expireTime token expire time * @return token string diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AlertGroupServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AlertGroupServiceImpl.java index 74eb186a19..8368dc1f64 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AlertGroupServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AlertGroupServiceImpl.java @@ -160,7 +160,7 @@ public class AlertGroupServiceImpl extends BaseServiceImpl implements AlertGroup * @return create result code */ @Override - @Transactional(rollbackFor = Exception.class) + @Transactional public Map createAlertgroup(User loginUser, String groupName, String desc, String alertInstanceIds) { Map result = new HashMap<>(); //only admin can operate @@ -192,8 +192,6 @@ public class AlertGroupServiceImpl extends BaseServiceImpl implements AlertGroup } catch (DuplicateKeyException ex) { logger.error("Create alert group error.", ex); putMsg(result, Status.ALERT_GROUP_EXIST); - } catch (RuntimeException e) { - throw new RuntimeException(e.getMessage()); } return result; @@ -253,7 +251,7 @@ public class AlertGroupServiceImpl extends BaseServiceImpl implements AlertGroup * @return delete result code */ @Override - @Transactional(rollbackFor = RuntimeException.class) + @Transactional public Map delAlertgroupById(User loginUser, int id) { Map result = new HashMap<>(); result.put(Constants.STATUS, false); diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ClusterServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ClusterServiceImpl.java index 86d8eca95a..e069d0611f 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ClusterServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ClusterServiceImpl.java @@ -68,7 +68,7 @@ public class ClusterServiceImpl extends BaseServiceImpl implements ClusterServic * @param config cluster config * @param desc cluster desc */ - @Transactional(rollbackFor = RuntimeException.class) + @Transactional @Override public Map createCluster(User loginUser, String name, String config, String desc) { Map result = new HashMap<>(); @@ -229,7 +229,7 @@ public class ClusterServiceImpl extends BaseServiceImpl implements ClusterServic * @param loginUser login user * @param code cluster code */ - @Transactional(rollbackFor = RuntimeException.class) + @Transactional @Override public Map deleteClusterByCode(User loginUser, Long code) { Map result = new HashMap<>(); @@ -256,7 +256,7 @@ public class ClusterServiceImpl extends BaseServiceImpl implements ClusterServic * @param config cluster config * @param desc cluster desc */ - @Transactional(rollbackFor = RuntimeException.class) + @Transactional @Override public Map updateClusterByCode(User loginUser, Long code, String name, String config, String desc) { Map result = new HashMap<>(); diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java index b12d9e9904..6747d54ecb 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java @@ -100,7 +100,7 @@ public class DataSourceServiceImpl extends BaseServiceImpl implements DataSource * @return create result code */ @Override - @Transactional(rollbackFor = Exception.class) + @Transactional public Result createDataSource(User loginUser, BaseDataSourceParamDTO datasourceParam) { DataSourceUtils.checkDatasourceParam(datasourceParam); Result result = new Result<>(); @@ -140,8 +140,6 @@ public class DataSourceServiceImpl extends BaseServiceImpl implements DataSource } catch (DuplicateKeyException ex) { logger.error("Create datasource error.", ex); putMsg(result, Status.DATASOURCE_EXIST); - } catch (RuntimeException e) { - throw new RuntimeException(e.getMessage()); } return result; @@ -396,7 +394,7 @@ public class DataSourceServiceImpl extends BaseServiceImpl implements DataSource * @return delete result code */ @Override - @Transactional(rollbackFor = RuntimeException.class) + @Transactional public Result delete(User loginUser, int datasourceId) { Result result = new Result<>(); try { diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/EnvironmentServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/EnvironmentServiceImpl.java index 67def53674..dc410e6658 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/EnvironmentServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/EnvironmentServiceImpl.java @@ -93,7 +93,7 @@ public class EnvironmentServiceImpl extends BaseServiceImpl implements Environme * @param workerGroups worker groups */ @Override - @Transactional(rollbackFor = Exception.class) + @Transactional public Map createEnvironment(User loginUser, String name, String config, String desc, String workerGroups) { Map result = new HashMap<>(); if (!canOperatorPermissions(loginUser, null, AuthorizationType.ENVIRONMENT, ENVIRONMENT_CREATE)) { @@ -303,7 +303,7 @@ public class EnvironmentServiceImpl extends BaseServiceImpl implements Environme * @param loginUser login user * @param code environment code */ - @Transactional(rollbackFor = RuntimeException.class) + @Transactional @Override public Map deleteEnvironmentByCode(User loginUser, Long code) { Map result = new HashMap<>(); @@ -342,7 +342,7 @@ public class EnvironmentServiceImpl extends BaseServiceImpl implements Environme * @param desc environment desc * @param workerGroups worker groups */ - @Transactional(rollbackFor = RuntimeException.class) + @Transactional @Override public Map updateEnvironmentByCode(User loginUser, Long code, String name, String config, String desc, String workerGroups) { Map result = new HashMap<>(); diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java index 404a77679a..d2e974052f 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java @@ -220,7 +220,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro * @return create result code */ @Override - @Transactional(rollbackFor = RuntimeException.class) + @Transactional public Map createProcessDefinition(User loginUser, long projectCode, String name, @@ -547,7 +547,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro * @return update result code */ @Override - @Transactional(rollbackFor = RuntimeException.class) + @Transactional public Map updateProcessDefinition(User loginUser, long projectCode, String name, @@ -707,7 +707,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro * @return delete result code */ @Override - @Transactional(rollbackFor = RuntimeException.class) + @Transactional public Map deleteProcessDefinitionByCode(User loginUser, long projectCode, long code) { Project project = projectMapper.queryByCode(projectCode); //check user access for project @@ -778,7 +778,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro * @return release result code */ @Override - @Transactional(rollbackFor = RuntimeException.class) + @Transactional public Map releaseProcessDefinition(User loginUser, long projectCode, long code, ReleaseState releaseState) { Project project = projectMapper.queryByCode(projectCode); //check user access for project @@ -918,7 +918,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro * @return import process */ @Override - @Transactional(rollbackFor = RuntimeException.class) + @Transactional public Map importProcessDefinition(User loginUser, long projectCode, MultipartFile file) { Map result = new HashMap<>(); String dagDataScheduleJson = FileUtils.file2String(file); @@ -942,7 +942,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro } @Override - @Transactional(rollbackFor = RuntimeException.class) + @Transactional public Map importSqlProcessDefinition(User loginUser, long projectCode, MultipartFile file) { Map result = new HashMap<>(); Project project = projectMapper.queryByCode(projectCode); @@ -1687,7 +1687,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro * @param targetProjectCode targetProjectCode */ @Override - @Transactional(rollbackFor = RuntimeException.class) + @Transactional public Map batchMoveProcessDefinition(User loginUser, long projectCode, String codes, @@ -1831,7 +1831,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro * @return switch process definition version result code */ @Override - @Transactional(rollbackFor = RuntimeException.class) + @Transactional public Map switchProcessDefinitionVersion(User loginUser, long projectCode, long code, int version) { Project project = projectMapper.queryByCode(projectCode); //check user access for project @@ -1926,7 +1926,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro * @return delete result code */ @Override - @Transactional(rollbackFor = RuntimeException.class) + @Transactional public Map deleteProcessDefinitionVersion(User loginUser, long projectCode, long code, int version) { Project project = projectMapper.queryByCode(projectCode); //check user access for project @@ -1969,7 +1969,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro * @return process definition code */ @Override - @Transactional(rollbackFor = RuntimeException.class) + @Transactional public Map createEmptyProcessDefinition(User loginUser, long projectCode, String name, @@ -2096,7 +2096,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro * @return update result code */ @Override - @Transactional(rollbackFor = RuntimeException.class) + @Transactional public Map updateProcessDefinitionBasicInfo(User loginUser, long projectCode, String name, @@ -2212,7 +2212,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro * @param releaseState releaseState * @return update result code */ - @Transactional(rollbackFor = RuntimeException.class) + @Transactional @Override public Map releaseWorkflowAndSchedule(User loginUser, long projectCode, long code, ReleaseState releaseState) { Project project = projectMapper.queryByCode(projectCode); diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java index 9b4c34ad16..38d5893247 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java @@ -452,7 +452,7 @@ public class ProcessInstanceServiceImpl extends BaseServiceImpl implements Proce * @param tenantCode tenantCode * @return update result code */ - @Transactional(rollbackFor = RuntimeException.class) + @Transactional @Override public Map updateProcessInstance(User loginUser, long projectCode, Integer processInstanceId, String taskRelationJson, String taskDefinitionJson, String scheduleTime, Boolean syncDefine, String globalParams, @@ -619,7 +619,7 @@ public class ProcessInstanceServiceImpl extends BaseServiceImpl implements Proce * @return delete result code */ @Override - @Transactional(rollbackFor = RuntimeException.class) + @Transactional public Map deleteProcessInstanceById(User loginUser, long projectCode, Integer processInstanceId) { Project project = projectMapper.queryByCode(projectCode); //check user access for project diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java index 999459628f..902803a2e6 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java @@ -96,7 +96,7 @@ public class ProcessTaskRelationServiceImpl extends BaseServiceImpl implements P * @param postTaskCode postTaskCode * @return create result code */ - @Transactional(rollbackFor = RuntimeException.class) + @Transactional @Override public Map createProcessTaskRelation(User loginUser, long projectCode, long processDefinitionCode, long preTaskCode, long postTaskCode) { Project project = projectMapper.queryByCode(projectCode); @@ -187,7 +187,7 @@ public class ProcessTaskRelationServiceImpl extends BaseServiceImpl implements P * @param taskCode the post task code * @return delete result code */ - @Transactional(rollbackFor = RuntimeException.class) + @Transactional @Override public Map deleteTaskProcessRelation(User loginUser, long projectCode, long processDefinitionCode, long taskCode) { Project project = projectMapper.queryByCode(projectCode); @@ -267,7 +267,7 @@ public class ProcessTaskRelationServiceImpl extends BaseServiceImpl implements P * @param taskCode the post task code * @return delete result code */ - @Transactional(rollbackFor = RuntimeException.class) + @Transactional @Override public Map deleteUpstreamRelation(User loginUser, long projectCode, String preTaskCodes, long taskCode) { Project project = projectMapper.queryByCode(projectCode); @@ -339,7 +339,7 @@ public class ProcessTaskRelationServiceImpl extends BaseServiceImpl implements P * @param taskCode the pre task code * @return delete result code */ - @Transactional(rollbackFor = RuntimeException.class) + @Transactional @Override public Map deleteDownstreamRelation(User loginUser, long projectCode, String postTaskCodes, long taskCode) { Project project = projectMapper.queryByCode(projectCode); @@ -457,7 +457,7 @@ public class ProcessTaskRelationServiceImpl extends BaseServiceImpl implements P * @param postTaskCode post task code * @return delete result code */ - @Transactional(rollbackFor = RuntimeException.class) + @Transactional @Override public Map deleteEdge(User loginUser, long projectCode, long processDefinitionCode, long preTaskCode, long postTaskCode) { Project project = projectMapper.queryByCode(projectCode); diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java index 12ddafaa42..ddd0fdc095 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java @@ -87,7 +87,7 @@ public class ProjectServiceImpl extends BaseServiceImpl implements ProjectServic * @return returns an error if it exists */ @Override - @Transactional(rollbackFor = Exception.class) + @Transactional public Map createProject(User loginUser, String name, String desc) { Map result = checkDesc(desc); diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/QueueServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/QueueServiceImpl.java index 465f2243f4..4c3fbdf009 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/QueueServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/QueueServiceImpl.java @@ -123,7 +123,7 @@ public class QueueServiceImpl extends BaseServiceImpl implements QueueService { * @return create result */ @Override - @Transactional(rollbackFor = Exception.class) + @Transactional public Map createQueue(User loginUser, String queue, String queueName) { Map result = new HashMap<>(); if (!canOperatorPermissions(loginUser,null, AuthorizationType.QUEUE,YARN_QUEUE_CREATE)) { diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java index 73ceda882a..79441bf858 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java @@ -134,7 +134,7 @@ public class ResourcesServiceImpl extends BaseServiceImpl implements ResourcesSe * @return create directory result */ @Override - @Transactional(rollbackFor = Exception.class) + @Transactional public Result createDirectory(User loginUser, String name, String description, @@ -214,7 +214,7 @@ public class ResourcesServiceImpl extends BaseServiceImpl implements ResourcesSe * @return create result code */ @Override - @Transactional(rollbackFor = Exception.class) + @Transactional public Result createResource(User loginUser, String name, String desc, @@ -343,7 +343,7 @@ public class ResourcesServiceImpl extends BaseServiceImpl implements ResourcesSe * @return update result code */ @Override - @Transactional(rollbackFor = Exception.class) + @Transactional public Result updateResource(User loginUser, int resourceId, String name, @@ -777,7 +777,7 @@ public class ResourcesServiceImpl extends BaseServiceImpl implements ResourcesSe * @throws IOException exception */ @Override - @Transactional(rollbackFor = Exception.class) + @Transactional public Result delete(User loginUser, int resourceId) throws IOException { // get resource by id Result resultCheck = new Result<>(); @@ -1054,7 +1054,7 @@ public class ResourcesServiceImpl extends BaseServiceImpl implements ResourcesSe * @return create result code */ @Override - @Transactional(rollbackFor = Exception.class) + @Transactional public Result onlineCreateResource(User loginUser, ResourceType type, String fileName, String fileSuffix, String desc, String content, int pid, String currentDir) { Result result = new Result<>(); boolean canOperatorPermissions = canOperatorPermissions(loginUser, null, AuthorizationType.RESOURCE_FILE_ID, ApiFuncIdentificationConstant.FILE_ONLINE_CREATE); @@ -1167,7 +1167,7 @@ public class ResourcesServiceImpl extends BaseServiceImpl implements ResourcesSe * @return update result cod */ @Override - @Transactional(rollbackFor = Exception.class) + @Transactional public Result updateResourceContent(User loginUser, int resourceId, String content) { Result result = checkResourceUploadStartupState(); if (!result.getCode().equals(Status.SUCCESS.getCode())) { diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java index 7d4d1d6013..5457872d18 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java @@ -121,7 +121,7 @@ public class SchedulerServiceImpl extends BaseServiceImpl implements SchedulerSe * @return create result code */ @Override - @Transactional(rollbackFor = RuntimeException.class) + @Transactional public Map insertSchedule(User loginUser, long projectCode, long processDefineCode, @@ -222,7 +222,7 @@ public class SchedulerServiceImpl extends BaseServiceImpl implements SchedulerSe * @return update result code */ @Override - @Transactional(rollbackFor = RuntimeException.class) + @Transactional public Map updateSchedule(User loginUser, long projectCode, Integer id, @@ -272,7 +272,7 @@ public class SchedulerServiceImpl extends BaseServiceImpl implements SchedulerSe * @return publish result code */ @Override - @Transactional(rollbackFor = RuntimeException.class) + @Transactional public Map setScheduleState(User loginUser, long projectCode, Integer id, diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SessionServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SessionServiceImpl.java index c6067b6f68..cb8442c324 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SessionServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SessionServiceImpl.java @@ -88,7 +88,7 @@ public class SessionServiceImpl extends BaseServiceImpl implements SessionServic * @return session string */ @Override - @Transactional(rollbackFor = RuntimeException.class) + @Transactional public String createSession(User user, String ip) { Session session = null; diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java index 30f2d0235c..338d6644e2 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java @@ -115,7 +115,7 @@ public class TaskDefinitionServiceImpl extends BaseServiceImpl implements TaskDe * @param projectCode project code * @param taskDefinitionJson task definition json */ - @Transactional(rollbackFor = RuntimeException.class) + @Transactional @Override public Map createTaskDefinition(User loginUser, long projectCode, @@ -167,7 +167,7 @@ public class TaskDefinitionServiceImpl extends BaseServiceImpl implements TaskDe * @param upstreamCodes upstream task codes, sep comma * @return create result code */ - @Transactional(rollbackFor = RuntimeException.class) + @Transactional @Override public Map createTaskBindsWorkFlow(User loginUser, long projectCode, @@ -302,7 +302,7 @@ public class TaskDefinitionServiceImpl extends BaseServiceImpl implements TaskDe * @param projectCode project code * @param taskCode task code */ - @Transactional(rollbackFor = RuntimeException.class) + @Transactional @Override public Map deleteTaskDefinitionByCode(User loginUser, long projectCode, long taskCode) { Project project = projectMapper.queryByCode(projectCode); @@ -381,7 +381,7 @@ public class TaskDefinitionServiceImpl extends BaseServiceImpl implements TaskDe * @param taskCode task code * @param taskDefinitionJsonObj task definition json object */ - @Transactional(rollbackFor = RuntimeException.class) + @Transactional @Override public Map updateTaskDefinition(User loginUser, long projectCode, long taskCode, String taskDefinitionJsonObj) { Map result = new HashMap<>(); @@ -545,7 +545,7 @@ public class TaskDefinitionServiceImpl extends BaseServiceImpl implements TaskDe * @param taskCode task code * @param version the version user want to switch */ - @Transactional(rollbackFor = RuntimeException.class) + @Transactional @Override public Map switchVersion(User loginUser, long projectCode, long taskCode, int version) { Project project = projectMapper.queryByCode(projectCode); @@ -739,7 +739,7 @@ public class TaskDefinitionServiceImpl extends BaseServiceImpl implements TaskDe * @param releaseState releaseState * @return update result code */ - @Transactional(rollbackFor = RuntimeException.class) + @Transactional @Override public Map releaseTaskDefinition(User loginUser, long projectCode, long code, ReleaseState releaseState) { Project project = projectMapper.queryByCode(projectCode); diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java index 7d8d1128d9..048e641a81 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java @@ -79,7 +79,7 @@ public class TaskGroupServiceImpl extends BaseServiceImpl implements TaskGroupSe * @return the result code and msg */ @Override - @Transactional(rollbackFor = Exception.class) + @Transactional public Map createTaskGroup(User loginUser, Long projectCode, String name, String description, int groupSize) { Map result = new HashMap<>(); diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TenantServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TenantServiceImpl.java index 3d315ee3cf..2b5ff4422e 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TenantServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TenantServiceImpl.java @@ -91,7 +91,7 @@ public class TenantServiceImpl extends BaseServiceImpl implements TenantService * @throws Exception exception */ @Override - @Transactional(rollbackFor = Exception.class) + @Transactional public Map createTenant(User loginUser, String tenantCode, int queueId, @@ -242,7 +242,7 @@ public class TenantServiceImpl extends BaseServiceImpl implements TenantService * @throws Exception exception */ @Override - @Transactional(rollbackFor = Exception.class) + @Transactional public Map deleteTenantById(User loginUser, int id) throws Exception { Map result = new HashMap<>(); diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UdfFuncServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UdfFuncServiceImpl.java index 4542b648b8..c46f4aabfb 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UdfFuncServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UdfFuncServiceImpl.java @@ -77,7 +77,7 @@ public class UdfFuncServiceImpl extends BaseServiceImpl implements UdfFuncServic * @return create result code */ @Override - @Transactional(rollbackFor = Exception.class) + @Transactional public Result createUdfFunction(User loginUser, String funcName, String className, @@ -336,7 +336,7 @@ public class UdfFuncServiceImpl extends BaseServiceImpl implements UdfFuncServic * @return delete result code */ @Override - @Transactional(rollbackFor = RuntimeException.class) + @Transactional public Result delete(User loginUser, int id) { Result result = new Result<>(); diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java index 33e99f4651..bb6710155c 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java @@ -146,7 +146,7 @@ public class UsersServiceImpl extends BaseServiceImpl implements UsersService { * @throws Exception exception */ @Override - @Transactional(rollbackFor = Exception.class) + @Transactional public Map createUser(User loginUser, String userName, String userPassword, @@ -195,7 +195,7 @@ public class UsersServiceImpl extends BaseServiceImpl implements UsersService { } @Override - @Transactional(rollbackFor = RuntimeException.class) + @Transactional public User createUser(String userName, String userPassword, String email, @@ -230,7 +230,7 @@ public class UsersServiceImpl extends BaseServiceImpl implements UsersService { * create User for ldap login */ @Override - @Transactional(rollbackFor = Exception.class) + @Transactional public User createUser(UserType userType, String userId, String email) { User user = new User(); Date now = new Date(); @@ -525,7 +525,7 @@ public class UsersServiceImpl extends BaseServiceImpl implements UsersService { * @throws Exception exception when operate hdfs */ @Override - @Transactional(rollbackFor = RuntimeException.class) + @Transactional public Map deleteUserById(User loginUser, int id) throws IOException { Map result = new HashMap<>(); if(resourcePermissionCheckService.functionDisabled()){ @@ -572,7 +572,7 @@ public class UsersServiceImpl extends BaseServiceImpl implements UsersService { * @return grant result code */ @Override - @Transactional(rollbackFor = RuntimeException.class) + @Transactional public Map grantProject(User loginUser, int userId, String projectIds) { Map result = new HashMap<>(); result.put(Constants.STATUS, false); @@ -714,7 +714,7 @@ public class UsersServiceImpl extends BaseServiceImpl implements UsersService { * @return grant result code */ @Override - @Transactional(rollbackFor = RuntimeException.class) + @Transactional public Map grantResources(User loginUser, int userId, String resourceIds) { Map result = new HashMap<>(); @@ -812,7 +812,7 @@ public class UsersServiceImpl extends BaseServiceImpl implements UsersService { * @return grant result code */ @Override - @Transactional(rollbackFor = RuntimeException.class) + @Transactional public Map grantUDFFunction(User loginUser, int userId, String udfIds) { Map result = new HashMap<>(); @@ -860,7 +860,7 @@ public class UsersServiceImpl extends BaseServiceImpl implements UsersService { * @return grant result code */ @Override - @Transactional(rollbackFor = RuntimeException.class) + @Transactional public Map grantNamespaces(User loginUser, int userId, String namespaceIds) { Map result = new HashMap<>(); result.put(Constants.STATUS, false); @@ -910,7 +910,7 @@ public class UsersServiceImpl extends BaseServiceImpl implements UsersService { * @return grant result code */ @Override - @Transactional(rollbackFor = RuntimeException.class) + @Transactional public Map grantDataSource(User loginUser, int userId, String datasourceIds) { Map result = new HashMap<>(); result.put(Constants.STATUS, false); @@ -1219,7 +1219,7 @@ public class UsersServiceImpl extends BaseServiceImpl implements UsersService { * @throws Exception exception */ @Override - @Transactional(rollbackFor = RuntimeException.class) + @Transactional public Map registerUser(String userName, String userPassword, String repeatPassword, String email) { Map result = new HashMap<>(); diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java index 7878d94220..d582549144 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java @@ -84,7 +84,7 @@ public class WorkerGroupServiceImpl extends BaseServiceImpl implements WorkerGro * @return create or update result code */ @Override - @Transactional(rollbackFor = Exception.class) + @Transactional public Map saveWorkerGroup(User loginUser, int id, String name, String addrList) { Map result = new HashMap<>(); if (!canOperatorPermissions(loginUser,null, AuthorizationType.WORKER_GROUP, WORKER_GROUP_CREATE)) { @@ -326,7 +326,7 @@ public class WorkerGroupServiceImpl extends BaseServiceImpl implements WorkerGro * @return delete result code */ @Override - @Transactional(rollbackFor = Exception.class) + @Transactional public Map deleteWorkerGroupById(User loginUser, Integer id) { Map result = new HashMap<>(); if (!canOperatorPermissions(loginUser,null, AuthorizationType.WORKER_GROUP,WORKER_GROUP_DELETE)) { diff --git a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java index 6066fe525f..6558940673 100644 --- a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java +++ b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java @@ -105,7 +105,7 @@ public interface ProcessService { TaskInstance submitTaskWithRetry(ProcessInstance processInstance, TaskInstance taskInstance, int commitRetryTimes, long commitInterval); - @Transactional(rollbackFor = Exception.class) + @Transactional TaskInstance submitTask(ProcessInstance processInstance, TaskInstance taskInstance); void createSubWorkProcess(ProcessInstance parentProcessInstance, TaskInstance task); @@ -173,7 +173,7 @@ public interface ProcessService { List queryNeedFailoverProcessInstanceHost(); - @Transactional(rollbackFor = RuntimeException.class) + @Transactional void processNeedFailoverProcessInstances(ProcessInstance processInstance); List queryNeedFailoverTaskInstances(String host); diff --git a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java index 7eab795257..08921e72a7 100644 --- a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java +++ b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java @@ -1296,7 +1296,7 @@ public class ProcessServiceImpl implements ProcessService { * @return task instance */ @Override - @Transactional(rollbackFor = Exception.class) + @Transactional public TaskInstance submitTask(ProcessInstance processInstance, TaskInstance taskInstance) { logger.info("start submit task : {}, processInstance id:{}, state: {}", taskInstance.getName(), taskInstance.getProcessInstanceId(), processInstance.getState()); @@ -2059,7 +2059,7 @@ public class ProcessServiceImpl implements ProcessService { * @param processInstance processInstance */ @Override - @Transactional(rollbackFor = RuntimeException.class) + @Transactional public void processNeedFailoverProcessInstances(ProcessInstance processInstance) { //1 update processInstance host is null processInstance.setHost(Constants.NULL);