You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by we...@apache.org on 2022/10/22 03:33:23 UTC

[dolphinscheduler] branch dev updated: set @Transactional rollbackFor (#12445)

This is an automated email from the ASF dual-hosted git repository.

wenjun pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new 1384d8f4fa set @Transactional rollbackFor (#12445)
1384d8f4fa is described below

commit 1384d8f4fa90c9edfbbbd57ae914b7b6840d2b43
Author: Yann Ann <xi...@gmail.com>
AuthorDate: Sat Oct 22 11:33:17 2022 +0800

    set @Transactional rollbackFor (#12445)
---
 .../dolphinscheduler/api/service/impl/TenantServiceImpl.java     | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

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 682f70c296..79686f8bd2 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
@@ -142,7 +142,7 @@ public class TenantServiceImpl extends BaseServiceImpl implements TenantService
      * @throws Exception exception
      */
     @Override
-    @Transactional
+    @Transactional(rollbackFor = Exception.class)
     public Map<String, Object> createTenant(User loginUser,
                                             String tenantCode,
                                             int queueId,
@@ -233,9 +233,7 @@ public class TenantServiceImpl extends BaseServiceImpl implements TenantService
         updateTenantValid(existsTenant, updateTenant);
 
         // updateProcessInstance tenant
-        /**
-         * if the tenant code is modified, the original resource needs to be copied to the new tenant.
-         */
+        // if the tenant code is modified, the original resource needs to be copied to the new tenant.
         if (!Objects.equals(existsTenant.getTenantCode(), updateTenant.getTenantCode())
                 && PropertyUtils.getResUploadStartupState()) {
             storageOperate.createTenantDirIfNotExists(tenantCode);
@@ -260,7 +258,7 @@ public class TenantServiceImpl extends BaseServiceImpl implements TenantService
      * @throws Exception exception
      */
     @Override
-    @Transactional
+    @Transactional(rollbackFor = Exception.class)
     public Map<String, Object> deleteTenantById(User loginUser, int id) throws Exception {
         Map<String, Object> result = new HashMap<>();
 
@@ -387,7 +385,6 @@ public class TenantServiceImpl extends BaseServiceImpl implements TenantService
 
     /**
      * Make sure tenant with given name exists, and create the tenant if not exists
-     *
      * ONLY for python gateway server, and should not use this in web ui function
      *
      * @param tenantCode tenant code