[ 
https://issues.apache.org/jira/browse/HBASE-10567?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13905571#comment-13905571
 ] 

Jonathan Hsieh commented on HBASE-10567:
----------------------------------------

should check return value here and return error message.

{code}
@@ -686,6 +689,9 @@ public final class ExportSnapshot extends Configured 
implements Tool {
       }
 
       // Step 3 - Rename fs2:/.snapshot/.tmp/<snapshot> 
fs2:/.snapshot/<snapshot>
+      if (overwrite && outputFs.exists(outputSnapshotDir)) {
+        outputFs.delete(outputSnapshotDir, true);
+      }
       if (!outputFs.rename(snapshotTmpDir, outputSnapshotDir)) {
         System.err.println("Snapshot export failed!");
         System.err.println("Unable to rename snapshot directory from=" +
{code}

Otherwise looks good to me.



> Add overwrite manifest option to ExportSnapshot
> -----------------------------------------------
>
>                 Key: HBASE-10567
>                 URL: https://issues.apache.org/jira/browse/HBASE-10567
>             Project: HBase
>          Issue Type: Bug
>          Components: snapshots
>    Affects Versions: 0.98.0, 0.94.16, 0.99.0, 0.96.1.1
>            Reporter: Matteo Bertozzi
>            Assignee: Matteo Bertozzi
>            Priority: Minor
>             Fix For: 0.99.0
>
>         Attachments: HBASE-10567-v0.patch
>
>
> If you want to export a snapshot twice (e.g. in case you accidentally removed 
> a file and now your snapshot is corrupted) you have to manually remove the 
> .hbase-snapshot/SNAPSHOT_NAME directory and then run the ExportSnapshot tool.
> Add an -overwrite option to this operation automatically.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to