[ 
https://issues.apache.org/jira/browse/HDFS-4167?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jing Zhao updated HDFS-4167:
----------------------------

    Attachment: HDFS-4167.000.patch

Here is a very initial patch that only provides NameNode side functionalities. 
In general, this patch provides a restoreSnapshot call in FSNamesystem, which 
restores a file/directory to the most recent snapshot of the corresponding 
snapshottable directory. In particular, the patch tries to do the following:
1. For a directory, revert its metadata change, restore deleted children and 
delete newly created files/subdirs.
2. For a file, revert its metadata change, delete blocks that were created 
after the snapshot.
3. For a renamed file/dir, if the target of the rename operation is also under 
the restore root directory, rename the file/dir back. Otherwise keep tracking 
the renamed file/dir in the deleted list of the snapshot diff.
4. Update quota correspondingly.

Note that the snapshot must be the most recent one. We throw exceptions if 
there are intermediate snapshot. This is the same behavior with ZFS.

Remaining work:
1. Unit tests and bug fixes.
2. Protocol change and FileSystem API.
3. CLI support
4. We also need to figure out how to handle the last block when the snapshot 
was taken. Do we want to truncate the block to make the restored file's length 
consistent with the length recorded in snapshot? But because of the current 
snapshot's copy-on-write semantic, the recorded file length is also not 
accurate. We can only guarantee that the file length recorded in the snapshot 
is no less than the real file length at the time when the snapshot was taken.

> Add support for restoring/rolling back to a snapshot
> ----------------------------------------------------
>
>                 Key: HDFS-4167
>                 URL: https://issues.apache.org/jira/browse/HDFS-4167
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: namenode
>    Affects Versions: Snapshot (HDFS-2802)
>            Reporter: Suresh Srinivas
>            Assignee: Jing Zhao
>         Attachments: HDFS Design Proposal.pdf, HDFS-4167.000.patch
>
>
> This jira tracks work related to restoring a directory/file to a snapshot.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to