You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by ch...@apache.org on 2020/03/25 03:16:21 UTC

[incubator-dolphinscheduler] branch dev-resource-tree updated: It's fixed that resource not deleted in hdfs when delete it.

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

chenxingchun pushed a commit to branch dev-resource-tree
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git


The following commit(s) were added to refs/heads/dev-resource-tree by this push:
     new 7130801  It's fixed that resource not deleted in hdfs when delete it.
     new 8b59ed5  Merge pull request #2306 from lgcareer/dev-resource-tree-fix-delete
7130801 is described below

commit 7130801dda5e7bb6f4a78065c5b59d64a1fbbb79
Author: lgcareer <18...@163.com>
AuthorDate: Wed Mar 25 10:52:56 2020 +0800

    It's fixed that resource not deleted in hdfs when delete it.
---
 .../org/apache/dolphinscheduler/api/service/ResourcesService.java   | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
index be141c2..1a27527 100644
--- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
+++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
@@ -629,7 +629,7 @@ public class ResourcesService extends BaseService {
         }
 
         // get hdfs file by type
-        String hdfsFilename = HadoopUtils.getHdfsFileName(resource.getType(), tenantCode, resource.getAlias());
+        String hdfsFilename = HadoopUtils.getHdfsFileName(resource.getType(), tenantCode, resource.getFullName());
 
         //delete data in database
         resourcesMapper.deleteIds(allChildren.toArray(new Integer[allChildren.size()]));
@@ -824,15 +824,15 @@ public class ResourcesService extends BaseService {
         }
 
         String name = fileName.trim() + "." + nameSuffix;
+        String fullName = currentDirectory.equals("/") ? String.format("%s%s",currentDirectory,name):String.format("%s/%s",currentDirectory,name);
 
-        result = verifyResourceName(name,type,loginUser);
+        result = verifyResourceName(fullName,type,loginUser);
         if (!result.getCode().equals(Status.SUCCESS.getCode())) {
             return result;
         }
 
         // save data
         Date now = new Date();
-        String fullName = currentDirectory.equals("/") ? String.format("%s%s",currentDirectory,name):String.format("%s/%s",currentDirectory,name);
         Resource resource = new Resource(pid,name,fullName,false,desc,name,loginUser.getId(),type,content.getBytes().length,now,now);
 
         resourcesMapper.insert(resource);