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

[dolphinscheduler] branch 3.1.1-prepare updated: cherry-pick [Fix-12425][API] Add rollbackFor setting.

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

kerwin pushed a commit to branch 3.1.1-prepare
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/3.1.1-prepare by this push:
     new 88094f914c cherry-pick [Fix-12425][API] Add rollbackFor setting.
88094f914c is described below

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

    cherry-pick [Fix-12425][API] Add rollbackFor setting.
---
 .../dolphinscheduler/api/service/impl/TenantServiceImpl.java | 12 +++++-------
 1 file changed, 5 insertions(+), 7 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 994a3a0f74..c7d3173668 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
@@ -136,7 +136,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,
@@ -223,10 +223,9 @@ 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 (!Objects.equals(existsTenant.getTenantCode(), updateTenant.getTenantCode()) && PropertyUtils.getResUploadStartupState()) {
+        // 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);
         }
         tenantMapper.updateById(updateTenant);
@@ -244,7 +243,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<>();
 
@@ -357,7 +356,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