Matteo Bertozzi created HBASE-8574:
--------------------------------------

             Summary: Add how to rename a table in th docbook 
                 Key: HBASE-8574
                 URL: https://issues.apache.org/jira/browse/HBASE-8574
             Project: HBase
          Issue Type: Task
          Components: documentation
    Affects Versions: 0.95.0, 0.94.7
            Reporter: Matteo Bertozzi
            Assignee: Matteo Bertozzi
             Fix For: 0.98.0, 0.94.8, 0.95.1


Add a section "how to rename a table" in the doc book.

The current easy solution without adding extra code in 94/95 is to use snapshots
{code}
hbase shell> disable 'tableName'
hbase shell> snapshot 'tableName', 'tableSnapshot'
hbase shell> clone 'tableSnapshot', 'newTableName'
hbase shell> delete_snapshot 'tableSnapshot'
{code}

{code}
void rename(HBaseAdmin admin, String oldTableName, String newTableName) {
    String snapshotName = randomName();
    admin.snapshot(snapshotName, oldTableName);
    admin.cloneSnapshot(snapshotName, newTableName);
    admin.deleteSnapshot(snapshotName);
    admin.deleteTable(oldTableName)
}
{code}

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