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

Himanshu Vashishtha commented on HBASE-8348:
--------------------------------------------

Thinking more about making migration more user friendly and testable, I 
re-worked the attached patch. Hope that's okay Rajesh. The key changes are:

a) Use Tool to handle the upgrade (aka UpgradeTo96), instead of a script.

b) Add unit tests for various steps involved in upgrade (detect HFilesV1, 
upgrading znodes). There is already a test class for namespace upgrade. 
(Figured out via unit tests that HBASE-8778 broke HFileV1Detector).

c) Refactor HFileV1Detector (return proper value, print script friendly output, 
removed duplicate code, etc). It prints processed tables, regions to major 
compact, list HFileV1 and corrupted (Storefile with undefined major version).

d) Delete hbase.id and online-snapshot znodes.

I tested this on a 0.94 cluster, and it works good.
h4. Sample help usage:
{code}
bin/hbase org.apache.hadoop.hbase.migration.UpgradeTo96
This tool helps in upgrading to 0.96. The upgrade involves major compacting any 
HFileV1, upgrading file system layout for namespaces, and updating znodes. 
Please follow the following steps:

1) Major compact HFileV1: On a running pre-0.96 (i.e., 0.94.x, 0.92.x) cluster, 
run this tool using option -checkHFileV1. Look at the console output if there 
are any regions to major compact. (grep for "Regions to Major compact" on the 
console output). Major compact the listed regions. Keep on repeating this step 
till there are no regions to major compact. If none, please shutdown the hbase 
cluster. As we need to update znodes, ensure that zookeeper is up and running.

2) Upgrade Namespace and Znodes: After step 1) run this tool using option 
-upgrade. In case you want to upgrade either of them, use option -ns, or -zk to 
upgrade namespace and znodes, respectively.

Refer below for more help on options.

usage: UpgradeTo96 [-chkHFileV1] [-dirTocheckHFileV1 <arg>] [-h] [-ns]
       [-upgrade] [-zk]
 -chkHFileV1,--checkForHFileV1                     Check for HFileV1
 -dirTocheckHFileV1,--dirToCheckForHFileV1 <arg>   Relative path of
                                                   directory to check for
                                                   HFileV1. Default is
                                                   hbase.rootdir
 -h,--help                                         Help
 -ns,--namespace                                   Upgrade the namespace
                                                   to 0.96
 -upgrade,--upgrade-NS-ZK                          Upgrade both namespace
                                                   and znodes
 -zk,--Znodes                                      Upgrade the znodes
{code}

h4. Detection phase:
{code}
bin/hbase org.apache.hadoop.hbase.migration.UpgradeTo96 -chkHFileV1
Result: 

Tables Processed: 
hdfs://localhost:41020/hbase-0.94/.migration

Number of HFileV1: 0
HFileV1:

Number of corrupted files:0
Corrupted Files: 

Number of Regions with HFileV1: 0
Regions to Major Compact: 

No HFileV1 found.
{code}

h4. Upgrade phase:
{code}
hbase-daemon.sh start zookeeper
himanshu@ubuntu:~/Work/Cloudera/apacheHBase/hbase$ bin/hbase 
org.apache.hadoop.hbase.migration.UpgradeTo96 -upgradeUpgrading Namespace
Successfully Upgraded NameSpace.
Upgrading Znodes
Succesfully upgraded znodes.
{code}


                
> Polish the migration to 0.96
> ----------------------------
>
>                 Key: HBASE-8348
>                 URL: https://issues.apache.org/jira/browse/HBASE-8348
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.95.0
>            Reporter: Jean-Daniel Cryans
>            Assignee: rajeshbabu
>            Priority: Critical
>             Fix For: 0.96.0
>
>         Attachments: HBASE-8348_trunk.patch, HBASE-8348_trunk_v2.patch, 
> HBASE-8348_trunk_v3.patch
>
>
> Currently, migration works but there's still a couple of rough edges:
>  - HBASE-8045 finished the .META. migration but didn't remove ROOT, so it's 
> still on the filesystem.
>  - Data in ZK needs to be removed manually. Either we fix up the data in ZK 
> or we delete it ourselves.
>  - TestMetaMigrationRemovingHTD has a testMetaUpdatedFlagInROOT method, but 
> ROOT is gone now.
> Elliott was also mentioning that we could have "hbase migrate" do the HFileV1 
> checks, clear ZK, remove ROOT, etc.

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

Reply via email to