Browse Source

HDFS-12485. expunge may fail to remove trash from encryption zone. Contributed by Wei-Chiu Chuang.

(cherry picked from commit 8dbc8909c92d502d10a7f94d1de3171878a43b04)
(cherry picked from commit a596c6f5eb553cf38123d61b844696ddbec99be0)

Conflicts:
	hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java
Wei-Chiu Chuang 7 years ago
parent
commit
843b8b7b96

+ 1 - 2
hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java

@@ -2532,8 +2532,7 @@ public class DistributedFileSystem extends FileSystem {
             }
           }
         } else {
-          Path userTrash = new Path(ezTrashRoot, System.getProperty(
-              "user.name"));
+          Path userTrash = new Path(ezTrashRoot, dfs.ugi.getShortUserName());
           if (exists(userTrash)) {
             ret.add(getFileStatus(userTrash));
           }

+ 0 - 1
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestTrashWithSecureEncryptionZones.java

@@ -225,7 +225,6 @@ public class TestTrashWithSecureEncryptionZones {
     clientConf = new Configuration(conf);
     clientConf.setLong(FS_TRASH_INTERVAL_KEY, 1);
     shell = new FsShell(clientConf);
-    System.setProperty("user.name", HDFS_USER_NAME);
   }
 
   @AfterClass