[ https://issues.apache.org/jira/browse/HDFS-4148?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13497338#comment-13497338 ]
Brandon Li commented on HDFS-4148: ---------------------------------- {quote}Perhaps better would be to leave the getter methods alone and instead add a function along the lines "ensureNotInROSnapshot(INodesInPath)" which would either be a no-op or throw a SnapshotAccessControlException.{quote} if this is to add method ensureNotInROSnapshot(INodesInPath) in all the modification related calls, I think getXAndEnsureMutable is cleaner. {quote}The class comment in TestDisallowModifyROSnapshot is copied from TestSnapshot and isn't accurate.{quote} will fix. {quote}Why was it necessary to use raw DFSClients in testCreate and testCreateSymlink?Couldn't we have just used FileSystem (or FileContext) as was done in the rest of the test cases?{quote} FileSystem doesn't have createSysmlink. will change testCreate. {quote} I don't understand this comment:... What's left to be done here?{quote} Because .snapshot is not a real directory, the test will throw unexpected exception by verifyParentDir. So the test uses "/TestSnapshot/sub1/.snapshot" instead of objInSnapshot("/TestSnapshot/sub1/.snapshot/dir1". The TODO here is saying, we need to fix verifyParentDir() for ".snapshot". Will update the comments. {quote}The method comment for ClientProtocol#createSymlink says...{quote} will update the comment {quote}I recommend you add a no-args constructor to SnapshotAccessControlException with this message as the default, much as the existing AccessControlException has done. I also recommend changing the message to "Permission denied: cannot modify read-only snapshot."{quote} will do. {quote}I'd recommend adding a method comment to FSDirectory#existsMutable{quote} will do. I created a follow-up jira HDFS-4189 to address the feedback. > Disallow write/modify operations on files and directories in a snapshot > ------------------------------------------------------------------------ > > Key: HDFS-4148 > URL: https://issues.apache.org/jira/browse/HDFS-4148 > Project: Hadoop HDFS > Issue Type: Sub-task > Components: name-node > Affects Versions: Snapshot (HDFS-2802) > Reporter: Brandon Li > Assignee: Brandon Li > Fix For: Snapshot (HDFS-2802) > > Attachments: HDFS-4148.patch, HDFS-4148.patch, HDFS-4148.patch, > HDFS-4148.patch, HDFS-4148.patch > > > disallow modification on RO snapshots, including create, append, > setReplication/Permission/Owner, rename, delete, makedir, setQuota/Time, > createSymlink. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira