hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From varunsax...@apache.org
Subject hadoop git commit: YARN-6056. Yarn NM using LCE shows a failure when trying to delete a non-existing dir (Wilfred Spiegelenburg via Varun Saxena)
Date Fri, 10 Feb 2017 14:09:41 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2.6 4c1aa391c -> c73c89401


YARN-6056. Yarn NM using LCE shows a failure when trying to delete a non-existing dir (Wilfred
Spiegelenburg via Varun Saxena)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/c73c8940
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/c73c8940
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/c73c8940

Branch: refs/heads/branch-2.6
Commit: c73c89401804adb7228d8fc93e99a3c5cdc3e538
Parents: 4c1aa39
Author: Varun Saxena <varunsaxena@apache.org>
Authored: Fri Feb 10 18:57:50 2017 +0530
Committer: Varun Saxena <varunsaxena@apache.org>
Committed: Fri Feb 10 18:57:50 2017 +0530

----------------------------------------------------------------------
 .../native/container-executor/impl/container-executor.c | 10 ++++++++++
 .../container-executor/test/test-container-executor.c   | 12 ++++++++++++
 2 files changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/c73c8940/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.c
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.c
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.c
index 7920e4a..2345594 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.c
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.c
@@ -1354,6 +1354,16 @@ int delete_as_user(const char *user,
   }
   // do the delete
   for(ptr = (char**)baseDirs; *ptr != NULL; ++ptr) {
+    struct stat sb;
+    if (stat(*ptr, &sb) != 0) {
+      if (errno == ENOENT) {
+        // Ignore missing dir. Continue deleting other directories.
+        continue;
+      } else {
+        fprintf(LOGFILE, "Could not stat %s - %s\n", *ptr, strerror(errno));
+        return -1;
+      }
+    }
     char* full_path = concatenate("%s/%s", "user subdir", 2,
                               *ptr, subdir);
     if (full_path == NULL) {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/c73c8940/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/test/test-container-executor.c
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/test/test-container-executor.c
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/test/test-container-executor.c
index 3aee6be..ad6d740 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/test/test-container-executor.c
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/test/test-container-executor.c
@@ -383,6 +383,18 @@ void test_delete_user() {
     exit(1);
   }
   char buffer[100000];
+
+  sprintf(buffer, "%s", app_dir);
+  char missing_dir[20];
+  strcpy(missing_dir, "/some/missing/dir");
+  char * dirs_with_missing[] = {missing_dir, buffer, 0};
+  int ret = delete_as_user(yarn_username, "" , dirs_with_missing);
+  printf("%d" , ret);
+  if (access(buffer, R_OK) == 0) {
+    printf("FAIL: directory not deleted\n");
+    exit(1);
+  }
+
   sprintf(buffer, "%s/local-1/usercache/%s", TEST_ROOT, yarn_username);
   if (access(buffer, R_OK) != 0) {
     printf("FAIL: directory missing before test\n");


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message