[
https://issues.apache.org/jira/browse/HDFS-16816?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17623322#comment-17623322
]
ASF GitHub Bot commented on HDFS-16816:
---------------------------------------
mkuchenbecker commented on code in PR #5071:
URL: https://github.com/apache/hadoop/pull/5071#discussion_r1003605313
##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterClientProtocol.java:
##########
@@ -723,6 +723,49 @@ public boolean delete(String src, boolean recursive)
throws IOException {
}
}
+ // Create missing user home dirs for trash paths.
+ // We assume the router is running with super-user privilege (can create
+ // user home dir in /user dir).
+ private void createUserHomeForTrashPath(List<RemoteLocation> locations)
throws IOException {
+ List<RemoteLocation> missingUserHomes = new ArrayList<>();
+
+ // Identify missing trash roots
+ for(RemoteLocation loc: locations) {
Review Comment:
I would consider structuring this differently for readability / testability:
1. Map the original list of locations to a List of Home Directories. (i.e.
given a list, make another list is easily testable)
2. Filter the list to the list of locations that don't exist. (i.e. given a
list, make another list)
3. Create those directories that don't exist. (for each element in the list,
call function X)
> RBF: auto-create user home dir for trash paths by router
> --------------------------------------------------------
>
> Key: HDFS-16816
> URL: https://issues.apache.org/jira/browse/HDFS-16816
> Project: Hadoop HDFS
> Issue Type: Improvement
> Components: rbf
> Reporter: Xing Lin
> Priority: Minor
> Labels: pull-request-available
>
> In RBF, trash files are moved to trash root under user's home dir at the
> corresponding namespace/namenode where the files reside. This was added in
> HDFS-16024. When the user home dir is not created before-hand at a namenode,
> we run into permission denied exceptions when trying to create the parent dir
> for the trash file before moving the file into it. We propose to enhance
> Router, to auto-create a user home's dir at the namenode for trash paths,
> using router's identity (which is assumed to be a super-user).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]