hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "stack (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-7365) Safer table creation and deletion using .tmp dir
Date Tue, 18 Dec 2012 00:46:13 GMT

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

stack commented on HBASE-7365:
------------------------------

Makes sense doing stuff in .tmp (which mirrors table .tmp and region .tmp).

In below... the archive tool will be able to make sense of the deleted table?


+    if (fs.exists(tmpdir)) {
+      // Archive table in temp, maybe are failed deletion left over,
+      // if not the cleaner will take care of them.
+      for (Path tabledir: FSUtils.getTableDirs(fs, tmpdir)) {
+        for (Path regiondir: FSUtils.getRegionDirs(fs, tabledir)) {
+          HFileArchiver.archiveRegion(fs, this.rootdir, tabledir, regiondir);
+        }
+      }
+      fs.delete(tmpdir, true);


Do you want to check the returned value on the above delete?


Why not call checkTempDir rather than do this?

+    // Ensure temp exists
+    if (!fs.exists(tempdir) && !fs.mkdirs(tempdir)) {
+      throw new IOException("HBase temp directory '" + tempdir + "' creation failure.");


I love it when TODOs get cleaned up...

-    // TODO: Currently we make the table descriptor and as side-effect the
-    // tableDir is created.  Should we change below method to be createTable
-    // where we create table in tmp dir with its table descriptor file and then
-    // do rename to move it into place?


Should we remove the old handleCreateTable now we have your fancy new one?  Or is it still
used?


Patch looks good otherwise Matteo.
                
> Safer table creation and deletion using .tmp dir
> ------------------------------------------------
>
>                 Key: HBASE-7365
>                 URL: https://issues.apache.org/jira/browse/HBASE-7365
>             Project: HBase
>          Issue Type: Improvement
>          Components: master
>            Reporter: Matteo Bertozzi
>            Assignee: Matteo Bertozzi
>             Fix For: 0.96.0
>
>         Attachments: HBASE-7365-v0.patch
>
>
> Currently tables are created in the root directory, and the removal works on the root
directory.
> Change the code to use a /hbase/.tmp directory to make the creation and removal a bit
safer
> Table Creation steps
>  * Create the table descriptor (table folder, in /hbase/.tmp/)
>  * Create the table regions (always in temp)
>  * Move the table from temp to the root folder
>  * Add the regions to meta
>  * Trigger assignment
>  * Set enable flag in ZooKeeper
> Table Deletion steps
>  * Wait for regions in transition
>  * Remove regions from meta (use bulk delete)
>  * Move the table in /hbase/.tmp
>  * Remove the table from the descriptor cache
>  * Remove table from zookeeper
>  * Archive the table
> The main changes in the current code are:
>  * Writing to /hbase/.tmp and then rename
>  * using bulk delete in DeletionTableHandler

--
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

Mime
View raw message