You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-issues@hadoop.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2020/11/09 18:44:00 UTC

[jira] [Work logged] (HDFS-15607) Create trash dir when allowing snapshottable dir

     [ https://issues.apache.org/jira/browse/HDFS-15607?focusedWorklogId=509291&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-509291 ]

ASF GitHub Bot logged work on HDFS-15607:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 09/Nov/20 18:43
            Start Date: 09/Nov/20 18:43
    Worklog Time Spent: 10m 
      Work Description: smengcl opened a new pull request #2448:
URL: https://github.com/apache/hadoop/pull/2448


   This is an addendum to [HDFS-15607|https://issues.apache.org/jira/browse/HDFS-15607].
   
   ## Problem
   
   Pre HDFS-15607, when admin disallows snapshot on a **file**, it throws `PathIsNotDirectoryException`:
   ```
   org.apache.hadoop.fs.PathIsNotDirectoryException: `/ssdir1/file1': Is not a directory
   	at org.apache.hadoop.hdfs.server.namenode.INodeDirectory.valueOf(INodeDirectory.java:65)
   	at org.apache.hadoop.hdfs.server.namenode.snapshot.SnapshotManager.resetSnapshottable(SnapshotManager.java:289)
   	at org.apache.hadoop.hdfs.server.namenode.FSDirSnapshotOp.disallowSnapshot(FSDirSnapshotOp.java:76)
   	at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.disallowSnapshot(FSNamesystem.java:6933)
   	at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.disallowSnapshot(NameNodeRpcServer.java:1969)
   	at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.disallowSnapshot(ClientNamenodeProtocolServerSideTranslatorPB.java:1321)
   ```
   
   After HDFS-15607 (current), the thrown exception changed into `AccessControlException`. Because `DFS#checkTrashRootAndRemoveIfEmpty` is calling `DFS#listStatus` on a file (`/ssdir1/file1/.Trash`) inside a file (`/ssdir1/file1`):
   ```
   2020-11-09 09:50:18,374 [IPC Server handler 3 on default port 52295] INFO  FSNamesystem.audit (FSNamesystem.java:logAuditMessage(8708)) - allowed=false	ugi=smeng (auth:SIMPLE)	ip=/127.0.0.1	cmd=listStatus	src=/ssdir1/file1/.Trash	dst=null	perm=null	proto=rpc
   2020-11-09 09:50:18,374 [IPC Server handler 3 on default port 52295] INFO  ipc.Server (Server.java:logException(3006)) - IPC Server handler 3 on default port 52295, call Call#31 Retry#0 org.apache.hadoop.hdfs.protocol.ClientProtocol.getListing from 127.0.0.1:52305: org.apache.hadoop.security.AccessControlException: /ssdir1/file1 (is not a directory)
   disallowSnapshot: /ssdir1/file1 (is not a directory)
   	at org.apache.hadoop.hdfs.server.namenode.FSDirectory.resolvePath(FSDirectory.java:739)
   	at org.apache.hadoop.hdfs.server.namenode.FSDirStatAndListingOp.getListingInt(FSDirStatAndListingOp.java:57)
   	at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getListing(FSNamesystem.java:4132)
   	at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.getListing(NameNodeRpcServer.java:1175)
   	at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.getListing(ClientNamenodeProtocolServerSideTranslatorPB.java:758)
   ```
   
   ## Solution
   
   We should ignore `AccessControlException` thrown in `DFS#checkTrashRootAndRemoveIfEmpty` and let the original `dfs.disallowSnapshot` logic handle it.
   
   ## Testing
   
   After this change, disallowing snapshot on a file throws `PathIsNotDirectoryException` as expected:
   ```
   2020-11-09 09:49:15,347 [IPC Server handler 4 on default port 52270] INFO  ipc.Server (Server.java:logException(3013)) - IPC Server handler 4 on default port 52270, call Call#30 Retry#0 org.apache.hadoop.hdfs.protocol.ClientProtocol.disallowSnapshot from 127.0.0.1:52280
   org.apache.hadoop.fs.PathIsNotDirectoryException: `/ssdir1/file1': Is not a directory
   	at org.apache.hadoop.hdfs.server.namenode.INodeDirectory.valueOf(INodeDirectory.java:65)
   	at org.apache.hadoop.hdfs.server.namenode.snapshot.SnapshotManager.resetSnapshottable(SnapshotManager.java:289)
   	at org.apache.hadoop.hdfs.server.namenode.FSDirSnapshotOp.disallowSnapshot(FSDirSnapshotOp.java:76)
   	at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.disallowSnapshot(FSNamesystem.java:6933)
   	at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.disallowSnapshot(NameNodeRpcServer.java:1969)
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 509291)
    Time Spent: 2h 10m  (was: 2h)

> Create trash dir when allowing snapshottable dir
> ------------------------------------------------
>
>                 Key: HDFS-15607
>                 URL: https://issues.apache.org/jira/browse/HDFS-15607
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: hdfs
>    Affects Versions: 3.4.0
>            Reporter: Siyao Meng
>            Assignee: Siyao Meng
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 3.4.0
>
>          Time Spent: 2h 10m
>  Remaining Estimate: 0h
>
> In {{TrashPolicyDefault}}, the {{.Trash}} directory will be created with permission 700 (and without sticky bit) by the first user that moves a file to the trash. This is an issue when other users try to move files to that trash because they may not have the permission to move to that trash if the trash root is shared. -- in this case, snapshottable directories.
> This only affects users when trash is enabled inside snapshottable directories ({{dfs.namenode.snapshot.trashroot.enabled}} set to true), and when a user performing move to trash operations doesn't have admin permissions.
> Solution: Create a {{.Trash}} directory with 777 permission and sticky bits enabled (similar solution as HDFS-10324).
> Also need to deal with some corner cases:
> 1. even when the snapshottable directory trash root config is not enabled ({{dfs.namenode.snapshot.trashroot.enabled}} set to false), create the {{.Trash}} directory anyway? Or should we ask the admin to provision trash manually after enabling {{dfs.namenode.snapshot.trashroot.enabled}} on an existing cluster?
> - If the cluster is just upgraded, we need to provision trash manually anyway.
> 2. When immediately disallowing trash, it shouldn't fail. just remove the .Trash directory when disallowing snapshot on a dir if it is empty?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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